.derupt-core-yyyymmdd
Users call their own .derupt-profile which then calls .derupt-core-yyyymmdd
The core maybe require or receive upgrades/updates from time to time, for that we follow a simple date based naming convention to track versions.
General:
.derupt-core-yyyymmdd contract is for handling public message & action logic.
.derupt-core-yyyymmdd contract receives calls from .derupt-profile contracts and proceeds to process them accordingly.
Warning:
users should deploy a
.derupt-profile
contract in app before using core features.users should call
.derupt-profile
users should not call
.derupt-core-yyyymmdd
(nor logging contracts)users should only enable 1 extension per 1 key function at a time (eg up to 6 active extensions at a time)
Key Functions Process Transactions Overview:
What happens in a process depends on the function the user is calling.
gift-message:
transfer
of a variable sip-010 token is called during this process.send-message:
mine
cryptocash is called during this process.like-message:
transfer
cryptocash is called during this process.dislike-message:
stack
cryptocash is called during this process.favorable-reply-message:
mine
&transfer
cryptocash is called during this process.unfavorable-reply-message:
mine
&stack
cryptocash is called during this process.
The 6 key functions and arguments in the .derupt-core-yyyymmdd
contract:
gift-message
Broadcast Send Message to the Stacks Blockchain
Data Flow of the Function:
1).derupt-profile
2).derupt-core-yyyymmdd (&.derupt-ext if defined)
3).derupt-gifts
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
send-message
Broadcast Send Message to the Stacks Blockchain
Data Flow of the Function:
1).derupt-profile
2).derupt-core-yyyymmdd (&.derupt-ext if defined)
3).derupt-feed (&.derupt-miners)
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
like-message
Broadcast Like Message to Stacks Blockchain
Data Flow of the Function:
1) .derupt-profile
2) .derupt-core-yyyymmdd (&.derupt-ext if defined)
3) .derupt-sentiment
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
dislike-message
Broadcast Dislike Message to Stacks Blockchain
Data Flow of the Function:
1) .derupt-profile
2) .derupt-core-yyyymmdd (&.derupt-ext if defined)
3) .derupt-sentiment (&.derupt-stackers)
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
favorable-reply-message
Broadcast Favorable Reply Message to Stacks Blockchain
Data Flow of the Function:
1) .derupt-profile
2) .derupt-core-yyyymmdd (&.derupt-ext if defined)
3) .derupt-feed (&.derupt-sentiment &.derupt-miners)
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
unfavorable-reply-message
Broadcast Unfavorable Reply Message to Stacks Blockchain
Data Flow of the Function:
1) .derupt-profile
2) .derupt-core-yyyymmdd (&.derupt-ext if defined)
3) .derupt-feed (&.derupt-sentiment &.derupt-miners &.derupt-stackers)
Arguments:
...
Responses:
Successful Stacks Transaction
Unsuccessful Stacks Transaction
Work in Progress
;; title: derupt-core-20241204
;; version: 1.3.1
;; summary: Gifts Contract
;; description: used to handle core Derupt logic
(impl-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-core-trait.derupt-core-trait)
(use-trait derupt-ext-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-ext-trait.derupt-ext)
(use-trait sip-009-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.sip-009-trait-nft-standard.sip-009-trait)
(use-trait sip-010-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.sip-010-trait-ft-standard.sip-010-trait)
(use-trait sip-013-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.sip-013-trait-sft-standard.sip-013-trait)
(use-trait cryptocash-token-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.cryptocash-token-trait.cryptocash-token)
(use-trait cryptocash-core-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.cryptocash-core-trait.cryptocash-core)
;; Error
(define-constant ERR-UNAUTHORIZED (err u100))
(define-constant ERR-NOTFOUND (err u101))
(define-constant ERR-SELF-GIFT (err u102))
(define-constant ERR-INSUFFICIENT-BALANCE (err u103))
(define-constant ERR-SENDER-MISMATCH (err u104))
(define-constant ERR-INVALID-MEMO (err u105))
(define-constant ERR-CONTENT-REQUIRED (err u106))
(define-constant ERR-WITH-ATTACHMENT (err u107))
(define-constant ERR-WITH-THUMBNAIL (err u108))
(define-constant ERR-WITH-REPLYTO (err u109))
(define-constant ERR-ALT-ORIGIN-REQUIRED (err u110))
(define-constant ERR-WITH-MINE-AMOUNT (err u111))
(define-constant ERR-INVALID-VALUE (err u112))
(define-constant ERR-INVALID-DEV-ADDRESS (err u113))
(define-constant ERR-INVALID-GAIA-ADDRESS (err u114))
(define-constant ERR-LIKED-TXID-REQUIRED (err u115))
(define-constant ERR-INVALID-CC-TOKEN (err u116))
(define-constant ERR-SELF-LIKE (err u117))
(define-constant ERR-INVALID-LIKE-AMOUNT (err u118))
(define-constant ERR-DISLIKED-TXID-REQUIRED (err u119))
(define-constant ERR-SELF-DISLIKE (err u120))
(define-constant ERR-INVALID-CC-CORE (err u121))
(define-constant ERR-INVALID-DISLIKE-AMOUNT (err u122))
(define-constant ERR-INVALID-LOCK-PERIOD (err u123))
(define-constant ERR-INVALID-EXTRA (err u124))
;; Constant Equals Versioning via Contract Naming Convention
(define-constant derupt-core-yyyymmdd (as-contract tx-sender))
;; Get Costs
(define-read-only (get-chime-stx-amount)
(contract-call? .derupt-feed get-chime-stx-amount)
)
(define-read-only (get-chime-ft-amount)
(contract-call? .derupt-feed get-chime-ft-amount)
)
(define-read-only (get-cc-token-contract)
(contract-call? .derupt-feed get-cc-token-contract)
)
(define-read-only (get-cc-core-contract)
(contract-call? .derupt-feed get-cc-core-contract)
)
;; Log Stacking
(define-private (log-stack (stacker principal) (dislike-ft-total uint) (lockPeriod uint))
(contract-call? .derupt-stackers log-stack tx-sender dislike-ft-total lockPeriod)
)
;; Log Mining
(define-private (log-mine (miner principal) (mine-amounts (list 200 uint)))
(contract-call? .derupt-miners log-mine tx-sender mine-amounts)
)
;; Log Gifting
(define-private (log-gift
(sender principal)
(recipient principal)
(is-stx bool)
(contractId <sip-010-trait>)
(amount uint)
(memo (optional (buff 34)))
(ext (optional <derupt-ext-trait>))
)
(contract-call? .derupt-gifts log-gift sender recipient is-stx contractId amount memo ext)
)
;; Log Send Message
(define-private (log-send-message
(content (string-utf8 256))
(attachment-uri (optional (string-utf8 256)))
(thumbnail-uri (optional (string-utf8 256)))
(reply-to (optional (string-utf8 256)))
(mine-amounts (list 200 uint))
(alt-origin (string-utf8 256))
(ext (optional <derupt-ext-trait>))
(pay-dev bool)
(pay-gaia bool)
(dev-stx-amount uint)
(gaia-stx-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
)
(contract-call? .derupt-feed log-send-message content attachment-uri thumbnail-uri reply-to mine-amounts alt-origin ext pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-principal gaia-principal)
)
;; Log Like Message
(define-private (log-like-message
(author-principal principal)
(like-ft-total uint)
(liked-txid (string-utf8 256))
(contractId <sip-010-trait>)
(pay-dev bool)
(pay-gaia bool)
(dev-ft-total uint)
(gaia-ft-total uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
(ext (optional <derupt-ext-trait>))
)
(contract-call? .derupt-sentiment log-like-message tx-sender author-principal like-ft-total liked-txid contractId pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal ext)
)
;; Log Dislike Message
(define-private (log-dislike-message
(author-principal principal)
(dislike-ft-total uint)
(lock-period uint)
(disliked-txid (string-utf8 256))
(contractId <sip-010-trait>)
(pay-dev bool)
(pay-gaia bool)
(dev-ft-total uint)
(gaia-ft-total uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
(ext (optional <derupt-ext-trait>))
)
(contract-call? .derupt-sentiment log-dislike-message tx-sender author-principal dislike-ft-total lock-period disliked-txid contractId pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal ext)
)
;; Mine Reward Claim
(define-private (claim-mining-reward (minerBlockHeight uint))
(contract-call? .cryptocash-core claim-mining-reward minerBlockHeight)
)
(define-public (claim-mining-reward-list (claimHeights (list 200 uint)))
(begin
(map claim-mining-reward claimHeights)
(try! (contract-call? .derupt-miners log-mining-reward-claim claimHeights))
(ok true)
)
)
;; Stack Reward Claim
(define-private (claim-stacking-reward (targetCycle uint))
(contract-call? .cryptocash-core claim-stacking-reward targetCycle)
)
(define-public (claim-stacking-reward-list (targetCycles (list 32 uint)))
(begin
(map claim-stacking-reward targetCycles)
(try! (contract-call? .derupt-stackers log-stacking-reward-claim targetCycles))
(ok true)
)
)
;; Extras validate function
(define-private (validate-extra (extra {
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
})
(res (response bool uint))
)
(begin
;; Validate `cryptocash-token-contract` if present
(if (is-some (get cryptocash-token-contract extra))
(let ((provided-token-contract (unwrap! (get cryptocash-token-contract extra) ERR-NOTFOUND)))
(asserts!
(is-eq (contract-of provided-token-contract) (unwrap! (get-cc-token-contract) ERR-NOTFOUND))
ERR-INVALID-CC-TOKEN
)
)
false ;; Skip validation if none
)
;; Validate `cryptocash-core-contract` if present
(if (is-some (get cryptocash-core-contract extra))
(let ((provided-core-contract (unwrap! (get cryptocash-core-contract extra) ERR-NOTFOUND)))
(asserts!
(is-eq (contract-of provided-core-contract) (unwrap! (get-cc-core-contract) ERR-NOTFOUND))
ERR-INVALID-CC-CORE
)
)
false ;; Skip validation if none
)
res
)
)
;; Core Operation Gift Message - updated
(define-public (gift-message (sender principal)
(recipient principal) (is-stx bool)
(contractId <sip-010-trait>) (amount uint)
(memo (optional (buff 34)))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
)
(begin
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
;; Validate recipient is not sender
(asserts! (not (is-eq sender recipient)) ERR-SELF-GIFT)
;; Sender is tx-sender
(asserts! (is-eq sender tx-sender) ERR-SENDER-MISMATCH)
;; Ensure sender balance is greater than amount being sent
(asserts! (> (unwrap! (contract-call? contractId get-balance sender) ERR-NOTFOUND) amount) ERR-INSUFFICIENT-BALANCE)
;; Ensure memo buff is present, if so len must less than or equal to 34
(if (is-some memo)
(asserts! (<= (len (unwrap! memo ERR-INVALID-MEMO)) u34) ERR-INVALID-MEMO)
false
)
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras ))
true
)
false
)
(is-ok (log-gift sender recipient is-stx contractId amount memo ext))
(ok true)
)
)
;; Core Operation Send Message - updated
(define-public (send-message
(content (string-utf8 256))
(attachment-uri (optional (string-utf8 256)))
(thumbnail-uri (optional (string-utf8 256)))
(reply-to (optional (string-utf8 256)))
(mine-amounts (list 200 uint))
(alt-origin (string-utf8 256))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
(pay-dev bool)
(pay-gaia bool)
(dev-stx-amount uint)
(gaia-stx-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
(cryptocash-core-contract <cryptocash-core-trait>)
)
(let
(
(dev-stx-total dev-stx-amount)
(gaia-stx-total gaia-stx-amount)
)
;; Validate CryptoCash Core - for Derupt use
(asserts! (is-eq (contract-of cryptocash-core-contract) (unwrap! (get-cc-core-contract) ERR-INVALID-CC-CORE)) ERR-INVALID-CC-CORE) ;; needed for dislike-message, but we also need it at send-message validation but accidently skipped it.
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
;; Content Required
(asserts! (> (len content) u0) ERR-CONTENT-REQUIRED)
;; len check attachment-uri and make sure its less than or equal to 256
(asserts! (<= (len (unwrap! attachment-uri ERR-WITH-ATTACHMENT)) u256) ERR-WITH-ATTACHMENT)
;; len check thumbnail-uri and make sure its less than or equal to 256
(asserts! (<= (len (unwrap! thumbnail-uri ERR-WITH-THUMBNAIL)) u256) ERR-WITH-THUMBNAIL)
;; len check reply-to and make sure its less than or equal to 256
(asserts! (<= (len (unwrap! reply-to ERR-WITH-REPLYTO)) u256) ERR-WITH-REPLYTO)
;; sum check of list and make sure its greater than 0
(asserts! (> (fold + mine-amounts u0) u0) ERR-WITH-MINE-AMOUNT)
;; Alt-Origin Required
(asserts! (> (len alt-origin) u0) ERR-ALT-ORIGIN-REQUIRED)
;; Interface Amounts greater than or equal to 0
(asserts! (>= dev-stx-total u0) ERR-INVALID-VALUE)
(asserts! (>= gaia-stx-amount u0) ERR-INVALID-VALUE)
;; Interface Payment Address checks
(asserts! (is-standard (unwrap! dev-principal ERR-INVALID-DEV-ADDRESS)) ERR-INVALID-DEV-ADDRESS)
(asserts! (is-standard (unwrap! gaia-principal ERR-INVALID-GAIA-ADDRESS)) ERR-INVALID-GAIA-ADDRESS)
;; Proceed with calling Feed contract
(try! (contract-call? .derupt-feed pay-stx mine-amounts pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-principal gaia-principal cryptocash-core-contract))
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras))
true
)
false
)
(is-ok (log-send-message content attachment-uri thumbnail-uri reply-to mine-amounts alt-origin ext pay-dev pay-gaia dev-stx-total gaia-stx-total dev-principal gaia-principal))
(is-ok (log-mine tx-sender mine-amounts))
(ok true)
)
)
;; Core Operation Like Message
(define-public (like-message
(author-principal principal)
(liked-txid (string-utf8 256))
(cryptocash-token-contract <cryptocash-token-trait>)
(like-ft-amount uint)
(pay-dev bool)
(pay-gaia bool)
(dev-ft-amount uint)
(gaia-ft-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
)
(let
(
(like-ft-total like-ft-amount)
(dev-ft-total dev-ft-amount)
(gaia-ft-total gaia-ft-amount)
)
;; Validate CryptoCash Token - for Derupt use
(asserts! (is-eq (contract-of cryptocash-token-contract) (unwrap! (get-cc-token-contract) ERR-INVALID-CC-TOKEN)) ERR-INVALID-CC-TOKEN)
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
;; Can't Like Self
(asserts! (not (is-eq tx-sender author-principal)) ERR-SELF-LIKE)
;; Liked Transaction ID Required
(asserts! (> (len liked-txid) u0) ERR-LIKED-TXID-REQUIRED)
;; Like Amount to Author must be greater than 0
(asserts! (> like-ft-amount u0) ERR-INVALID-LIKE-AMOUNT)
;; Interface Amounts greater than or equal to 0
(asserts! (>= dev-ft-total u0) ERR-INVALID-VALUE)
(asserts! (>= gaia-ft-total u0) ERR-INVALID-VALUE)
;; Interface Payment Address checks
(asserts! (is-standard (unwrap! dev-principal ERR-INVALID-DEV-ADDRESS)) ERR-INVALID-DEV-ADDRESS)
(asserts! (is-standard (unwrap! gaia-principal ERR-INVALID-GAIA-ADDRESS)) ERR-INVALID-GAIA-ADDRESS)
;; Proceed with calling Feed contract
(try! (contract-call? .derupt-feed pay-ft-like author-principal like-ft-total pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal cryptocash-token-contract))
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras))
true
)
false
)
(is-ok (log-like-message author-principal like-ft-total liked-txid cryptocash-token-contract pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal ext))
(ok true)
)
)
;; Core Operation Dislike Message
(define-public (dislike-message
(author-principal principal)
(disliked-txid (string-utf8 256))
(cryptocash-token-contract <cryptocash-token-trait>)
(cryptocash-core-contract <cryptocash-core-trait>)
(dislike-ft-amount uint)
(lockPeriod uint)
(pay-dev bool)
(pay-gaia bool)
(dev-ft-amount uint)
(gaia-ft-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
)
(let
(
(dislike-ft-total dislike-ft-amount)
(dev-ft-total dev-ft-amount)
(gaia-ft-total gaia-ft-amount)
)
;; Validate CryptoCash Token - for Derupt use
(asserts! (is-eq (contract-of cryptocash-token-contract) (unwrap! (get-cc-token-contract) ERR-INVALID-CC-TOKEN)) ERR-INVALID-CC-TOKEN)
;; Validate CryptoCash Core - for Derupt use
(asserts! (is-eq (contract-of cryptocash-core-contract) (unwrap! (get-cc-core-contract) ERR-INVALID-CC-CORE)) ERR-INVALID-CC-CORE)
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
;; Can't Dislike Self
(asserts! (not (is-eq tx-sender author-principal)) ERR-SELF-DISLIKE)
;; Liked Transaction ID Required
(asserts! (> (len disliked-txid) u0) ERR-DISLIKED-TXID-REQUIRED)
;; Dislike Amount to Stack must be greater than 0
(asserts! (> dislike-ft-total u0) ERR-INVALID-DISLIKE-AMOUNT)
;; Lock Period must be greater than 0
(asserts! (> lockPeriod u0) ERR-INVALID-LOCK-PERIOD)
;; Interface Amounts greater than or equal to 0
(asserts! (>= dev-ft-total u0) ERR-INVALID-VALUE)
(asserts! (>= gaia-ft-total u0) ERR-INVALID-VALUE)
;; Interface Payment Address checks
(asserts! (is-standard (unwrap! dev-principal ERR-INVALID-DEV-ADDRESS)) ERR-INVALID-DEV-ADDRESS)
(asserts! (is-standard (unwrap! gaia-principal ERR-INVALID-GAIA-ADDRESS)) ERR-INVALID-GAIA-ADDRESS)
;; Proceed with calling Feed contract
(try! (contract-call? .derupt-feed pay-ft-dislike dislike-ft-total lockPeriod pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal cryptocash-token-contract cryptocash-core-contract))
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras))
true
)
false
)
(is-ok (log-dislike-message author-principal dislike-ft-total lockPeriod disliked-txid cryptocash-token-contract pay-dev pay-gaia dev-ft-total gaia-ft-total dev-principal gaia-principal ext))
(is-ok (log-stack tx-sender dislike-ft-total lockPeriod))
(ok true)
)
)
;; Core Operation Favorable Reply Message
(define-public (favorable-reply-message
(content (string-utf8 256))
(author-principal principal)
(attachment-uri (optional (string-utf8 256)))
(thumbnail-uri (optional (string-utf8 256)))
(reply-to (string-utf8 256))
(liked-txid (string-utf8 256))
(mine-amounts (list 200 uint))
(alt-origin (string-utf8 256))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
(cryptocash-token-contract <cryptocash-token-trait>)
(cryptocash-core-contract <cryptocash-core-trait>)
(like-ft-amount uint)
(pay-dev bool)
(pay-gaia bool)
(dev-stx-amount uint)
(gaia-stx-amount uint)
(dev-ft-amount uint)
(gaia-ft-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
)
(begin
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
(asserts! (not (is-eq tx-sender author-principal)) ERR-UNAUTHORIZED)
(try! (send-message content attachment-uri thumbnail-uri (some reply-to) mine-amounts alt-origin none none pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-principal gaia-principal cryptocash-core-contract))
(try! (like-message author-principal liked-txid cryptocash-token-contract like-ft-amount pay-dev pay-gaia dev-ft-amount gaia-ft-amount dev-principal gaia-principal none none))
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras))
true
)
false
)
(ok true)
)
)
;; Core Operation Unfavorable Reply Message
(define-public (unfavorable-reply-message
(content (string-utf8 256))
(author-principal principal)
(attachment-uri (optional (string-utf8 256)))
(thumbnail-uri (optional (string-utf8 256)))
(reply-to (string-utf8 256))
(disliked-txid (string-utf8 256))
(mine-amounts (list 200 uint))
(alt-origin (string-utf8 256))
(ext (optional <derupt-ext-trait>))
(extras (optional (list 10
{
stringutf8: (optional (string-utf8 256)),
stringascii: (optional (string-ascii 256)),
uint: (optional uint),
int: (optional int),
principal: (optional principal),
bool: (optional bool),
buff: (optional (buff 34)),
proxy: (optional (buff 2048)),
cryptocash-token-contract: (optional <cryptocash-token-trait>),
cryptocash-core-contract: (optional <cryptocash-core-trait>),
sip-009-contract: (optional <sip-009-trait>),
sip-010-contract: (optional <sip-010-trait>),
sip-013-contract: (optional <sip-013-trait>)
}))
)
(cryptocash-token-contract <cryptocash-token-trait>)
(cryptocash-core-contract <cryptocash-core-trait>)
(dislike-ft-amount uint)
(lockPeriod uint)
(pay-dev bool)
(pay-gaia bool)
(dev-stx-amount uint)
(gaia-stx-amount uint)
(dev-ft-amount uint)
(gaia-ft-amount uint)
(dev-principal (optional principal))
(gaia-principal (optional principal))
)
(begin
;; Validate EXTRAs Optional CryptoCash Core & Token - for Ext use
(if (is-some extras)
(asserts! (is-ok (fold validate-extra (unwrap! extras ERR-NOTFOUND) (ok true))) ERR-INVALID-EXTRA)
false
)
(asserts! (not (is-eq tx-sender author-principal)) ERR-UNAUTHORIZED)
(try! (send-message content attachment-uri thumbnail-uri (some reply-to) mine-amounts alt-origin none none pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-principal gaia-principal cryptocash-core-contract))
(try! (dislike-message author-principal disliked-txid cryptocash-token-contract cryptocash-core-contract dislike-ft-amount lockPeriod pay-dev pay-gaia dev-ft-amount gaia-ft-amount dev-principal gaia-principal none none))
;; Executes extention contract function if defined
(if (not (is-none ext))
(let
((targetContract (unwrap! ext ERR-NOTFOUND)))
(try! (contract-call? targetContract exec-ext-func extras))
true
)
false
)
(ok true)
)
)
;; Set the derupt-core-yyyymmdd version in derupt-feed contract as a data variable
(contract-call? .derupt-feed set-derupt-core-contract derupt-core-yyyymmdd)
Last updated