Decastecastdocstestnet

Start

Architecture

Users act only through their own contract. That contract pays and notifies the chosen app, then writes to the global feed.

Post flow

Owner walletwalletsigns the transactioncall decast-postxdecast-user-v1userdecast-postx · checks owner + code hashreads feed + app configFees & charityuserprotocol fee · app treasury + referral · optional charitydeposit & stackPoX stacking + post NFTuserstacks STX (skipped in prepare phase) · mints NFTnotify appdecast-interface-v1appdecast-postx hook · prints scope: interfacelog globallydecast-feedglobaldecast-postx · global post stream

When a user posts, their contract runs these steps in a single transaction:

  • Checks the caller is the owner and the signer is the approved signer manager.
  • Asks decast-feed whether its own code hash is approved.
  • Reads the protocol config from decast-feed and the app config from the chosen interface contract.
  • Pays the protocol fee, the app treasury, the referral and the optional charity.
  • Deposits and stacks the STX through PoX (skipped during the prepare phase).
  • Mints a post NFT to the owner and saves its metadata.
  • Prints the payload locally, then calls the app's decast-postx and decast-feed.decast-postx.

Boost flow

Owner walletwalletsigns the transactioncall decast-boostxdecast-user-v1userdecast-boostx · booster's contractreads feed + app configFees & charityuserprotocol fee · app treasury + referral · optional charitypay author / holderBoost valueuserSTX / SIP-010 / SIP-009 · unsold: 100% author · sold: 25% author / 75% holdernotify appdecast-interface-v1appdecast-boostx hook · prints scope: interfacelog globallydecast-boostsglobaldecast-boostx · global boost stream

When a user boosts a post, their contract:

  • Checks the caller is the owner and that its code hash is approved by decast-feed.
  • Pays the protocol fee, the app treasury, the referral and the optional charity.
  • Sends the boost (STX, SIP-010 tokens or SIP-009 NFTs) to the post's author and current holder: 100% to the author if unsold, otherwise 25% author / 75% holder. NFTs go to the holder.
  • Calls the app's decast-boostx hook, then decast-boosts.decast-boostx.

Trust by code hash

Anyone can deploy a contract named decast-user-v1. Decast stays safe because decast-feed keeps a list of approved contract code hashes. Every contract that receives a call from a user contract (another user when following, an app hook, the feed) checks contract-hash? of the caller against this list. Modified copies are rejected with u101.

Where the money goes

Per post or boost (STX)

  • Protocol fee → protocol treasury (set in decast-feed).
  • App fee → split between the referral (referral-percent, max 20%) and the app treasury. With no referral, that share stays unpaid.
  • Charity → optional, set by the user.

Boost value

  • Author still holds the post: author gets 100%.
  • Post was sold: author 25%, current holder 75%. NFTs go to the holder.

Stacking yield (sBTC)

  • 2% protocol, 1% the app used to withdraw, 2% Pond Pals treasury, 95% the user.

Events & indexing

Each action prints the same payload at three levels, so you can index whatever you need:

  • User contract — the raw payload tuple, for one person's timeline.
  • App contract — { event, scope: "interface", author, user-contract-address, user-contract-hash, interface-contract-address, interface-contract-hash, payload }, for everything posted through one app.
  • decast-feed / decast-boosts — the global stream.

The payload is the consensus-serialized tuple; decode it with deserializeCV from @stacks/transactions. Full endpoints and decoding steps are on Events & Hiro API.