Decastecastdocstestnet

User scope

decast-user-v1

Each user deploys their own copy. It is their identity, their post archive and their stacking vault.
  • Owner-only writes. Almost every action requires the deployer to call directly from their wallet — no other contract can act on their behalf.
  • Posts are NFTs. Each post mints a decast-post token that can be traded for sBTC.
  • Posts stack STX. The amount you post with is stacked via PoX-5 and earns sBTC.
  • App choice per action. You pass the app contract on every post, boost and withdrawal. Cap what apps can charge with set-interface-fee-max.

Profile & configuration

Settings the owner controls on their own contract.

get-decast-user-config

read-only

Returns charity settings, interface-fee-max, last-token-id and the contract owner.

clarity
(get-decast-user-config)

Returns (ok { charity-principal, charity-amount-ustx, interface-fee-max, last-token-id, contract-owner })

get-storage-uri

read-only

The user's backup storage root URL.

clarity
(get-storage-uri)

Returns (ok (string-utf8 256))

set-storage-uri

owner only

Set the backup storage root URL.

clarity
(set-storage-uri (uri (string-utf8 256)))
err u106

set-charity-principal

owner only

Choose an address that receives a donation on each post.

clarity
(set-charity-principal (address principal))
err u106

set-charity-amount-ustx

owner only

Donation amount in micro-STX sent to the charity on each post.

clarity
(set-charity-amount-ustx (amount-ustx uint))
err u106

set-interface-fee-max

owner only

Highest app fee you accept. Posts and boosts through an app charging more fail. Default 1 STX.

clarity
(set-interface-fee-max (amount-ustx uint))
err u106err u108

Social graph

Follows are stored on both sides: your contract records who you follow, the target's contract records you as a follower.

follow-user

owner only

Follow another user contract. Calls the target's new-follower so both lists stay in sync.

clarity
(follow-user (target <decast-user-trait>))
  • The target must be an approved user-contract hash in decast-feed.
err u101err u115err u116err u118

unfollow-user

owner only

Stop following. Calls the target's remove-follower.

clarity
(unfollow-user (target <decast-user-trait>))
err u117

new-follower

contract hook

Hook called by another approved user contract during follow-user. Not called directly.

clarity
(new-follower (follower principal))

remove-follower

contract hook

Hook called by another approved user contract during unfollow-user.

clarity
(remove-follower (follower principal))

get-follow-counts

read-only

Following and followers totals.

clarity
(get-follow-counts)

get-follow-lists

read-only

Paginated following and followers lists (pages of up to 50).

clarity
(get-follow-lists (offset uint) (limit uint))
err u114

is-following / is-follower

read-only

Check a relationship with a specific user.

clarity
(is-following (user principal))
(is-follower (user principal))

Posting (decast-postx)

A post is a stacking action: the owner deposits STX that are stacked through PoX, mints a post NFT and logs the post at all three scopes.

decast-postx

owner only

Publish a post through an app.

clarity
(decast-postx
  (message (string-utf8 256))
  (via-url (string-utf8 256))
  (amount-to-stack uint)
  (content-uri (optional (string-utf8 224)))
  (content-hash (optional (buff 32)))
  (thumbnail-uri (optional (string-utf8 224)))
  (thumbnail-hash (optional (buff 32)))
  (metadata-uri (string-ascii 256))
  (interface-contract <decast-interface-trait>)
  (referral-principal (optional principal))
  (signer <signer-manager-trait>))
messagestring-utf8 256Post text.
via-urlstring-utf8 256URL of the app page the post was made from.
amount-to-stackuintuSTX deposited and stacked. Must be 0 in the prepare phase, above 0 otherwise.
content-uri / content-hashoptionalAttached media and its hash.
thumbnail-uri / thumbnail-hashoptionalPreview image and its hash.
metadata-uristring-ascii 256Link to the post's SIP-016 JSON with the Decast schema (see Post metadata). Returned by get-token-uri.
interface-contract<decast-interface-trait>The app the post is made through. Receives its fee and an interface-scope event.
referral-principaloptional principalGets the app's referral share of the app fee.
signer<signer-manager-trait>Must be the fastpool-max500-signer-manager.
  • Order of operations: check owner and signer, check this contract's hash is approved in decast-feed, read protocol and app config, pay protocol fee, app treasury, referral and charity, deposit and stake (outside prepare phase), mint the post NFT, then print the payload locally, on the app contract and on decast-feed.
  • App fee split: referral gets referral-percent of the fee (only if a referral is given), the app treasury gets the rest.
  • Staking sets a cycle guard so the principal stays stacked for at least the next reward cycle.
Post conditions →
err u101err u106err u108err u112err u113

Boosting (decast-boostx)

Boost someone else's post with STX, any SIP-010 token or an NFT.

decast-boostx

owner only

Send value to a post's author and current owner, and log the boost.

clarity
(decast-boostx
  amount-or-id is-stx is-nft
  ft-contract-id nft-contract-id
  author-contract content-nft-id
  interface-contract referral-principal)
  • You can't boost your own posts, including from another user contract you own.
  • Asset selection: NFT first, then STX, then FT.
  • If the post NFT still belongs to its author, the author gets everything. If it was sold, the author gets 25% and the current owner 75%. NFTs go to the current owner.
  • Protocol fee, app fee and referral are paid like a post, then the payload is logged locally, on the app contract and on decast-boosts.
Post conditions →
err u101err u103err u108err u119err u122

Post NFTs & marketplace

Every post mints a SIP-009 NFT (decast-post) owned by the author. It can be listed and sold for sBTC from the user's own contract.

get-last-token-id / get-owner / get-token-uri

read-only

Standard SIP-009 reads.

clarity
(get-owner (token-id uint))
(get-token-uri (token-id uint))

transfer

public

Transfer a post NFT you hold. Listed tokens can't be transferred.

clarity
(transfer (token-id uint) (sender principal) (recipient principal))
Post conditions →
err u107

list-in-usbtc

public

List a post you own for sale, priced in sats of sBTC.

clarity
(list-in-usbtc (token-id uint) (price-usbtc uint))
err u107err u121

unlist-in-usbtc

public

Remove your listing.

clarity
(unlist-in-usbtc (token-id uint))

buy-in-usbtc

public

Buy a listed post. The listing id and max price protect against the listing changing under you.

clarity
(buy-in-usbtc (token-id uint) (expected-listing-id uint) (max-price-usbtc uint))
Post conditions →
err u120

get-listing-in-usbtc

read-only

Current listing { seller, price-usbtc, listing-id }.

clarity
(get-listing-in-usbtc (token-id uint))

Stacking & yield

Principal from posts is stacked via PoX-5 and earns sBTC.

get-staking-status / get-staked-cycles

read-only

Locked/unlocked balance and the reward cycles this contract took part in.

clarity
(get-staking-status)
(get-staked-cycles (offset uint) (limit uint))

withdraw-yield

owner only

Settle cycles, collect pending sBTC rewards and distribute them.

clarity
(withdraw-yield (reward-cycles (list 95 uint)) (interface-contract <decast-interface-trait>))
  • Split: 2% protocol, 1% the chosen app, 2% Pond Pals treasury, 95% to you.
  • Needs more than 100 sats available.
Post conditions →
err u109

withdraw-principal

owner only

Withdraw unlocked STX back to your wallet. Omit the amount to withdraw everything.

clarity
(withdraw-principal (amount-ustx (optional uint)))
Post conditions →
err u110

revoke-staked-principal

owner only

Stop stacking. Only allowed once the cycle guard from your latest post has passed.

clarity
(revoke-staked-principal)
err u111

Events via Hiro API

Fetch this scope's print events directly. See Events & Hiro API for decoding.

User contract

GEThttps://api.testnet.hiro.so/extended/v2/smart-contracts/ST2K5SEC5KQ863QM3H0AN3FK69XSJV3YV16507WX8.decast-user-v1/logs?limit=50