.derupt-profile

Derupt users need their own .derupt-profile contract on Stacks Mainnet. (deployed & activated in app)

General:

  • A distinct .derupt-profile contract should be deployed and activated per user.

  • .derupt-profile contract calls the .derupt-core-yyyymmdd contract for application logic purposes

Warning:

  • users should deploy a .derupt-profilecontract in app to interact with core features.

  • users should call.derupt-profile

  • users should not call.derupt-core-yyyymmdd (nor logging contracts)

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 a users .derupt-profile 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-sentiments

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-sentiments (&.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-sentiments &.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-sentiments &.derupt-miners &.derupt-stackers)

Arguments:

  • ...

Responses:

  • Successful Stacks Transaction

  • Unsuccessful Stacks Transaction

Work In Progress

;; title: derupt-profile
;; version: 1.3.1
;; summary: Profile Contract
;; description: Each user should deploy one of these contracts, and call these functions to interface with the Derupt protocol.

(impl-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-profile-trait.derupt-profile-trait)

(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 derupt-core-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-core-trait.derupt-core-trait)
(use-trait derupt-profile-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-profile-trait.derupt-profile-trait)
(use-trait derupt-ext-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-ext-trait.derupt-ext)

(use-trait cryptocash-token-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.cryptocash-token-trait.cryptocash-token)
(use-trait cryptocash-core-trait 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.cryptocash-core-trait.cryptocash-core)

;; User Principal
(define-constant APP_USER tx-sender)

;; Error constants
(define-constant ERR-UNAUTHORIZED (err u100))
(define-constant ERR-NOTFOUND (err u101))
(define-constant ERR-VALIDATION-FAILED (err u102))
(define-constant ERR-INSUFFICIENT-BALANCE (err u104))
(define-constant ERR-UNAUTHORIZED-CONTRACT (err u105))
(define-constant ERR-INVALID-VALUE (err u106))

;; Member activation map
(define-map member-status principal bool)

(define-data-var loadoutUri (optional (string-utf8 256)) (some u"default"))

;; Get Derupt-core contract
(define-private (get-derupt-core-contract)
  (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-feed get-derupt-core-contract) 
  ;; (contract-call? 'MAINNETADDRESS.derupt-feed get-derupt-core-contract) 
)

(define-private (get-chime-stx-amount)
  (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-feed get-chime-stx-amount)  
  ;; (contract-call? 'MAINNETADDRESS.derupt-feed get-chime-stx-amount)  
)

(define-private (get-chime-ft-amount)
  (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-feed get-chime-ft-amount)  
  ;; (contract-call? 'MAINNETADDRESS.derupt-feed get-chime-ft-amount)  
)

(define-read-only (get-loadout-uri)
  (ok (var-get loadoutUri))
)

;; User Operation Loadout - set URI to new value
(define-public (set-loadout-uri (newUri (optional (string-utf8 256))))
  (begin
    (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)
    (asserts! (is-some newUri) ERR-INVALID-VALUE)
    (ok (var-set loadoutUri newUri))
  )
)

;; validatation of core contract (Derupt Core)
(define-private (validate-core-contract (contract principal))
  (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-feed validate-core-contract contract)
  ;; (contract-call? 'MAINNETADDRESS.derupt-feed validate-core-contract contract)
)

;; Member activation
(define-public (registration-activation (member principal))
  (let 
    (
      (caller (unwrap! (get name (unwrap! (principal-destruct? contract-caller) ERR-NOTFOUND)) ERR-NOTFOUND))
    ) 
      (asserts! (is-eq tx-sender member) ERR-UNAUTHORIZED)
      (asserts! (is-eq caller "derupt-profiles") ERR-UNAUTHORIZED)
      (map-set member-status APP_USER true)
      (ok true)
  )
)

;; Get status via chain change
(define-public (get-activation-status (member principal))
  (begin
    (asserts! (is-eq tx-sender member) ERR-UNAUTHORIZED)
    (ok (unwrap! (map-get? member-status APP_USER) ERR-NOTFOUND))
  )
)

;; Get status via api
(define-read-only (activation-status)
  (ok (unwrap! (map-get? member-status APP_USER) ERR-NOTFOUND))
)

;; this contract-address should be this users specific .derupt-profile contract address
(define-public (activate-member (contract-address <derupt-profile-trait>)) 
  (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-profiles activate-member contract-address)
  ;; (contract-call? 'MAINNETADDRESS.derupt-profiles activate-member contract-address)
)

;; User Operation Gifting
(define-public (gift-message (chime-author principal) (amount uint) 
  (via-id (string-utf8 256)) (is-stx bool) (contractId <sip-010-trait>)
  (core-contract <derupt-core-trait>) (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>)
    }))
  )
)
  (let 
    (
      (profile-balance-ft (unwrap! (contract-call? contractId get-balance tx-sender) ERR-INSUFFICIENT-BALANCE))
      (profile-balance-stx (stx-get-balance tx-sender))
      (inputed-core-contract (contract-of core-contract)) 
    ) 
      (if is-stx
        (begin 
          (asserts! (>= profile-balance-stx amount) ERR-INSUFFICIENT-BALANCE)
          (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
          (if (is-some memo) 
            (try! (stx-transfer-memo? amount tx-sender chime-author (unwrap! memo ERR-NOTFOUND)))
            (try! (stx-transfer? amount tx-sender chime-author))
          )          
          (try! (contract-call? core-contract gift-message tx-sender chime-author is-stx contractId amount memo ext extras))
          (print {event: "gift-message", chime-author: chime-author, amount: amount, via-id: via-id, is-stx: true, memo: memo, ext: ext})
          (ok true)
        )
        (begin 
          (asserts! (>= profile-balance-ft amount) ERR-INSUFFICIENT-BALANCE)
          (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
          (try! (contract-call? contractId transfer amount tx-sender chime-author memo))
          (try! (contract-call? core-contract gift-message tx-sender chime-author is-stx contractId amount memo ext extras))
          (print {event: "gift-message", chime-author: chime-author, amount: amount, via-id: via-id, is-stx: false, contractId: contractId, memo: memo, ext: ext})
          (ok true)
        )
      )
    )
)

;; User Operation Send Message
(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>)
    }))
  )
  (core-contract <derupt-core-trait>)
  (cryptocash-core-contract <cryptocash-core-trait>)
)           
  (let 
    (
      (tpi-values (unwrap! (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      ;;(tpi-values (unwrap! (contract-call? 'MAINNETADDRESS.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      (pay-dev (unwrap! (get pay-dev tpi-values) ERR-NOTFOUND)) 
      (pay-gaia (unwrap! (get pay-gaia tpi-values) ERR-NOTFOUND)) 
      (dev-stx-amount (unwrap! (get dev-stx-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-stx-amount (unwrap! (get gaia-stx-amount tpi-values) ERR-NOTFOUND))      
      (dev-principal  (get dev-principal tpi-values)) 
      (gaia-principal  (unwrap! (get gaia-principal tpi-values) ERR-NOTFOUND))
      (derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))
      (chime-stx-total (unwrap! (get-chime-stx-amount) ERR-NOTFOUND))
      (dev-stx-total dev-stx-amount) 
      (gaia-stx-total gaia-stx-amount) 
      (inputed-core-contract (contract-of core-contract))      
    )            
    (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)
    (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
    (try! (contract-call? core-contract send-message content attachment-uri thumbnail-uri reply-to mine-amounts alt-origin ext extras pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-principal (some gaia-principal) cryptocash-core-contract))   
    (print 
      { 
        event: "send-message", content: content, attachment-uri: attachment-uri, thumbnail-uri: thumbnail-uri, reply-to: reply-to, 
        alt-origin: alt-origin, ext: ext, 
        mine-total: (fold + mine-amounts u0), mine-amounts: mine-amounts,
        chime-stx-total: chime-stx-total,
        dev-stx-total: dev-stx-total, gaia-stx-total: gaia-stx-total,
        dev-principal: dev-principal, gaia-principal: gaia-principal
      }
    )
    (ok true)
  )
)

;; User Operation Like Message
(define-public (like-message 
    (author-principal principal) 
    (liked-txid (string-utf8 256)) 
    (cryptocash-token-contract <cryptocash-token-trait>)
    (core-contract <derupt-core-trait>)
    (like-ft-amount 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>)
      }))
    )
  )    
  (let 
    (
      (tpi-values (unwrap! (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      ;; (tpi-values (unwrap! (contract-call? 'MAINNETADDRESS.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      (pay-dev (unwrap! (get pay-dev tpi-values) ERR-NOTFOUND)) 
      (pay-gaia (unwrap! (get pay-gaia tpi-values) ERR-NOTFOUND))       
      (dev-ft-amount (unwrap! (get dev-ft-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-ft-amount (unwrap! (get gaia-ft-amount tpi-values) ERR-NOTFOUND))
      (dev-principal  (get dev-principal tpi-values)) 
      (gaia-principal  (unwrap! (get gaia-principal tpi-values) ERR-NOTFOUND))
      (derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))
      (like-ft-total like-ft-amount)
      (chime-ft-total (unwrap! (get-chime-ft-amount) ERR-NOTFOUND))
      (dev-ft-total dev-ft-amount)
      (gaia-ft-total gaia-ft-amount)
      (inputed-core-contract (contract-of core-contract))
    )
    (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)      
    (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
    (try! (contract-call? core-contract like-message author-principal liked-txid cryptocash-token-contract like-ft-amount pay-dev pay-gaia dev-ft-amount gaia-ft-amount dev-principal (some gaia-principal) ext extras))
    (print 
      { 
        event: "like-message", author-principal: author-principal, liked-txid: liked-txid, 
        cryptocash-token-contract: cryptocash-token-contract,
        like-ft-total: like-ft-total,
        chime-ft-total: chime-ft-total,
        alt-origin: alt-origin,
        ext: ext,
        pay-dev: pay-dev,
        pay-gaia: pay-gaia,
        dev-ft-total: dev-ft-total, 
        gaia-ft-total: gaia-ft-total,
        dev-principal: dev-principal, 
        gaia-principal: gaia-principal
      }
    )
    (ok true)
  )
)

;; User 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>)
    (core-contract <derupt-core-trait>)
    (dislike-ft-amount uint)
    (lockPeriod 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>)
      }))
    )
  ) 
  (let 
    (
      (tpi-values (unwrap! (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      ;; (tpi-values (unwrap! (contract-call? 'MAINNETADDRESS.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      (pay-dev (unwrap! (get pay-dev tpi-values) ERR-NOTFOUND)) 
      (pay-gaia (unwrap! (get pay-gaia tpi-values) ERR-NOTFOUND))
      (dev-ft-amount (unwrap! (get dev-ft-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-ft-amount (unwrap! (get gaia-ft-amount tpi-values) ERR-NOTFOUND))
      (dev-principal  (get dev-principal tpi-values)) 
      (gaia-principal  (unwrap! (get gaia-principal tpi-values) ERR-NOTFOUND))
      (derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))
      (dislike-ft-total dislike-ft-amount)
      (chime-ft-total (unwrap! (get-chime-ft-amount) ERR-NOTFOUND))
      (dev-ft-total dev-ft-amount)
      (gaia-ft-total gaia-ft-amount) 
      (inputed-core-contract (contract-of core-contract))      
    )
    (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)
    (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
    (try! (contract-call? core-contract 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 (some gaia-principal) ext extras))
    (print 
      { 
        event: "dislike-message", author-principal: author-principal, disliked-txid: disliked-txid,
        cryptocash-token-contract: cryptocash-token-contract,
        dislike-ft-total: dislike-ft-total,
        lockPeriod: lockPeriod,
        chime-ft-total: chime-ft-total,
        alt-origin: alt-origin,
        ext: ext,
        pay-dev: pay-dev,
        pay-gaia: pay-gaia,
        dev-ft-total: dev-ft-total, 
        gaia-ft-total: gaia-ft-total,
        dev-principal: dev-principal, 
        gaia-principal: gaia-principal
      }
    )
    (ok true)  
  )           
)

;; User Operation Favorable Reply Message
(define-public (favorable-reply-message 
    (content (string-utf8 256)) 
    (attachment-uri (optional (string-utf8 256))) 
    (thumbnail-uri (optional (string-utf8 256))) 
    (reply-to (string-utf8 256)) 
    (author-principal principal) 
    (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>)
    (core-contract <derupt-core-trait>)
    (like-ft-amount uint)
  )
  (let 
    (
      (tpi-values (unwrap! (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      ;; (tpi-values (unwrap! (contract-call? 'MAINNETADDRESS.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      (pay-dev (unwrap! (get pay-dev tpi-values) ERR-NOTFOUND)) 
      (pay-gaia (unwrap! (get pay-gaia tpi-values) ERR-NOTFOUND)) 
      (dev-stx-amount (unwrap! (get dev-stx-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-stx-amount (unwrap! (get gaia-stx-amount tpi-values) ERR-NOTFOUND))
      (dev-ft-amount (unwrap! (get dev-ft-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-ft-amount (unwrap! (get gaia-ft-amount tpi-values) ERR-NOTFOUND))
      (dev-principal  (get dev-principal tpi-values)) 
      (gaia-principal  (unwrap! (get gaia-principal tpi-values) ERR-NOTFOUND))
      (derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))
      (like-ft-total like-ft-amount)
      (chime-stx-total (unwrap! (get-chime-stx-amount) ERR-NOTFOUND))
      (chime-ft-total (unwrap! (get-chime-ft-amount) ERR-NOTFOUND))
      (dev-stx-total dev-stx-amount)
      (gaia-stx-total gaia-stx-amount)
      (dev-ft-total dev-ft-amount)
      (gaia-ft-total gaia-ft-amount)
      (inputed-core-contract (contract-of core-contract))
    )
      (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)      
      (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)
      (try! (contract-call? core-contract favorable-reply-message content author-principal attachment-uri thumbnail-uri reply-to liked-txid mine-amounts alt-origin ext extras cryptocash-token-contract cryptocash-core-contract like-ft-amount pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-ft-amount gaia-ft-amount dev-principal (some gaia-principal)))
      (print 
        { 
          event: "favorable-reply-message", content: content, publisher: author-principal, attachment-uri: attachment-uri, thumbnail-uri: thumbnail-uri, reply-to: reply-to, 
          cryptocash-token-contract: cryptocash-token-contract,
          alt-origin: alt-origin, ext: ext,
          mine-total: (fold + mine-amounts u0),
          mine-amounts: mine-amounts,
          like-ft-total: like-ft-total,
          chime-stx-total: chime-stx-total,
          chime-ft-total: chime-ft-total,
          pay-dev: pay-dev,
          pay-gaia: pay-gaia,
          dev-stx-total: dev-stx-total, 
          gaia-stx-total: gaia-stx-total,
          dev-ft-total: dev-ft-total, 
          gaia-ft-total: gaia-ft-total,
          dev-principal: dev-principal, 
          gaia-principal: gaia-principal
        }
      )
      (ok true)
  )
)

;; User Operation Favorable Reply Message
(define-public (unfavorable-reply-message 
    (content (string-utf8 256)) 
    (attachment-uri (optional (string-utf8 256))) 
    (thumbnail-uri (optional (string-utf8 256))) 
    (reply-to (string-utf8 256)) 
    (author-principal principal) 
    (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>) 
    (core-contract <derupt-core-trait>)
    (dislike-ft-amount uint)
    (lockPeriod uint)
  )
  (let 
    (
      (tpi-values (unwrap! (contract-call? 'ST1ZK4MRVTQQJMVAAJQWBV2WPQ87QV2851YCTHD7X.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      ;; (tpi-values (unwrap! (contract-call? 'MAINNETADDRESS.derupt-interfaces get-token-interface alt-origin) ERR-NOTFOUND))
      (pay-dev (unwrap! (get pay-dev tpi-values) ERR-NOTFOUND)) 
      (pay-gaia (unwrap! (get pay-gaia tpi-values) ERR-NOTFOUND)) 
      (dev-stx-amount (unwrap! (get dev-stx-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-stx-amount (unwrap! (get gaia-stx-amount tpi-values) ERR-NOTFOUND))
      (dev-ft-amount (unwrap! (get dev-ft-amount tpi-values) ERR-NOTFOUND)) 
      (gaia-ft-amount (unwrap! (get gaia-ft-amount tpi-values) ERR-NOTFOUND))
      (dev-principal  (get dev-principal tpi-values)) 
      (gaia-principal  (unwrap! (get gaia-principal tpi-values) ERR-NOTFOUND))
      (derupt-core-contract (unwrap! (get-derupt-core-contract) ERR-NOTFOUND))
      (dislike-ft-total dislike-ft-amount)
      (chime-stx-total (unwrap! (get-chime-stx-amount) ERR-NOTFOUND))
      (chime-ft-total (unwrap! (get-chime-ft-amount) ERR-NOTFOUND))
      (dev-stx-total dev-stx-amount)
      (gaia-stx-total gaia-stx-amount)
      (dev-ft-total dev-ft-amount)
      (gaia-ft-total gaia-ft-amount)
      (inputed-core-contract (contract-of core-contract))
    )
    (asserts! (is-eq tx-sender APP_USER) ERR-UNAUTHORIZED)
    (asserts! (unwrap! (validate-core-contract inputed-core-contract) ERR-VALIDATION-FAILED) ERR-UNAUTHORIZED-CONTRACT)     
    (try! (contract-call? core-contract unfavorable-reply-message content author-principal attachment-uri thumbnail-uri reply-to disliked-txid mine-amounts alt-origin ext extras cryptocash-token-contract cryptocash-core-contract dislike-ft-amount lockPeriod pay-dev pay-gaia dev-stx-amount gaia-stx-amount dev-ft-amount gaia-ft-amount dev-principal (some gaia-principal)))
    (print 
      { 
        event: "unfavorable-reply-message", content: content, publisher: author-principal, attachment-uri: attachment-uri, thumbnail-uri: thumbnail-uri, reply-to: reply-to, 
        cryptocash-token-contract: cryptocash-token-contract, 
        alt-origin: alt-origin, ext: ext,
        mine-total: (fold + mine-amounts u0),
        mine-amounts: mine-amounts,
        dislike-ft-total: dislike-ft-total,
        lockPeriod: lockPeriod,
        chime-stx-total: chime-stx-total,
        chime-ft-total: chime-ft-total,
        pay-dev: pay-dev,
        pay-gaia: pay-gaia,
        dev-stx-total: dev-stx-total, 
        gaia-stx-total: gaia-stx-total,
        dev-ft-total: dev-ft-total, 
        gaia-ft-total: gaia-ft-total,
        dev-principal: dev-principal, 
        gaia-principal: gaia-principal
      }
    )
    (ok true)
  )
)

(map-insert member-status APP_USER false)

Last updated