Derupt
Launch Derupt
  • Introduction
  • User Docs
    • Get Started
      • About Stacks
      • About CryptoCash
      • 🚀Launch Derupt
    • Guides
  • Latest Docs
    • Building on Derupt
    • Contracts
      • Testnet Addresses
      • Mainnet Addresses
      • .derupt-ext-trait
      • .derupt-interfaces
      • .derupt-core-trait
      • .derupt-feed
      • .derupt-gifts
      • .derupt-miners
      • .derupt-stackers
      • .derupt-sentiment
      • .derupt-core-yyyymmdd
      • .derupt-profile-trait
      • .derupt-profiles
      • .derupt-ext-reg
      • .derupt-profile
      • .derupt-ext
    • API
      • 📙Sentiment API Setup Guide
      • ⚙️Sentiment API Endpoint
    • Clients
  • FAQ
    • Features FAQ
    • Comparisons FAQ
  • Legacy Docs
    • Contracts (legacy)
      • Testnet Addresses
      • Testnet Addresses (broken)
      • Testnet Addresses (nakamoto)
      • Mainnet Addresses (old)
      • Mainnet Addresses (older)
      • .derupt-interfaces
      • .derupt-core-trait
      • .derupt-feed
      • .derupt-gifts
      • .derupt-miners
      • .derupt-stackers
      • .derupt-sentiment
      • .derupt-core-yyyymmdd
      • .derupt-profile-trait
      • .derupt-profiles
      • .derupt-profile
    • API (legacy)
      • 📙Sentiment API Setup Guide
      • ⚙️Sentiment API Endpoint
    • Clients (legacy)
    • NOSTR Comparison
    • X (Twitter) Comparison
Powered by GitBook
On this page
  1. Latest Docs
  2. Contracts

.derupt-stackers

All .derupt-profile contract stacking actions are logged in .derupt-stackers

The following function calls are only callable by .derupt-core-yyyymmdd:

  • log-stack

  • log-stacking-claim-reward

Work in Progress

;; title: derupt-stackers
;; version: 1.3.1
;; summary: Stackers Contract
;; description: used to log stacking and stacking reward claims

(define-constant ERR-UNAUTHORIZED (err u100))
(define-constant ERR-NOTFOUND (err u101))

;; Get Derupt core contract
(define-read-only (get-derupt-core-contract)
  (contract-call? .derupt-feed get-derupt-core-contract)
)

;; Log Stack
(define-public (log-stack (stacker principal) (dislike-ft-total uint) (lockPeriod uint))
  (let
    ((derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))) 
    (asserts! (is-eq contract-caller derupt-core-contract) ERR-UNAUTHORIZED)
    (print { event: "stack", stacker: stacker, dislike-ft-total: dislike-ft-total, lockPeriod: lockPeriod })
    (ok true)
  )
)

;; Log Stacking Reward Claim
(define-public (log-stacking-reward-claim (targetCycles (list 32 uint)))
  (let 
    ((derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))) 
    (asserts! (is-eq contract-caller derupt-core-contract) ERR-UNAUTHORIZED)
    (print { event: "stacking-reward-claim", stacker: tx-sender, targetCycles: targetCycles })
    (ok true)
  )
)
Previous.derupt-minersNext.derupt-sentiment

Last updated 5 months ago