.derupt-gifts

All .derupt-profile contract gifting are logged in .derupt-gifts

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

  • log-gift

Work in Progress

;; title: derupt-gifts
;; version: 1.3.1
;; summary: Gifts Contract
;; description: used to log Gifts

(use-trait sip-010-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.sip-010-trait-ft-standard.sip-010-trait)
;; (use-trait sip-010-trait 'MAINNETADDRESS.sip-010-trait-ft-standard.sip-010-trait)

(use-trait derupt-ext-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-ext-trait.derupt-ext)
;; (use-trait derupt-ext-trait 'MAINNETADDRESS.derupt-ext-trait.derupt-ext)

;; Error Constants
(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 Gift
(define-public (log-gift (sender principal) 
  (recipient principal) (is-stx bool) 
  (contractId <sip-010-trait>) (amount uint) (memo (optional (buff 34))) (ext (optional <derupt-ext-trait>))
)
  (let 
    ((derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))) 
    (asserts! (is-eq contract-caller derupt-core-contract) ERR-UNAUTHORIZED)
    (print { event: "gift", sender: sender, recipient: recipient, is-stx: is-stx, contractId: contractId, amount: amount, memo: memo, ext: ext})
    (ok true)
  )
)

Last updated