Decastecastdocstestnet

App scope

decast-interface-v1

Each app deploys its own copy. It's how apps get paid and how they find the posts made through them.

Quickstart

Deploy, configure, and pass your contract into users' calls. Users stay in control: if your fee is above their interface-fee-max, their transaction fails.

clarity
;; 1. Deploy decast-interface-v1 from your app's wallet
;; 2. Configure it (direct wallet calls by the deployer)
(contract-call? .decast-interface-v1 set-interface-uri u"https://myapp.xyz")
(contract-call? .decast-interface-v1 set-interface-fee-ustx u100000)        ;; 0.1 STX
(contract-call? .decast-interface-v1 set-interface-referral-percent u10)    ;; 10%
(contract-call? .decast-interface-v1 set-interface-treasury-principal 'SP...TREASURY)

;; 3. In your app, pass your contract on every user action
(contract-call? 'ST...USER.decast-user-v1 decast-postx
  u"gm" u"https://myapp.xyz/compose" u1000000
  none none none none "ipfs://..."
  'ST...APP.decast-interface-v1   ;; <- your app
  (some 'ST...REFERRER)
  'ST27J8CK2MP0TE57CT9DP0X672EWXDRR3FEGZJKPJ.fastpool-max500-signer-manager)

How your app earns

  • Per post and boost: your fee, minus the referral share when a referral is passed.
  • Yield: 1% of the sBTC a user withdraws when they choose your app in withdraw-yield.

Indexing

Watch print events from your interface contract. Every event includes the author, their user contract and the serialized payload.

Configuration

Read by user contracts on every post, boost and yield withdrawal.

get-interface-config

read-only

The app's fee, referral share and treasury.

clarity
(get-interface-config)

Returns (ok { fee-ustx, referral-percent, treasury-principal })

get-interface-uri

read-only

The root URL the app lives at.

clarity
(get-interface-uri)

Returns (string-utf8)

Admin

Only the deployer can call these, directly from their wallet.

set-interface-fee-ustx

deployer only

Fee charged per post and boost made through this app. Users reject fees above their interface-fee-max.

clarity
(set-interface-fee-ustx (fee-ustx uint))
err u103

set-interface-referral-percent

deployer only

Share of the fee paid to the referral, 0–20. Default 10.

clarity
(set-interface-referral-percent (referral-percent uint))
err u103err u105

set-interface-treasury-principal

deployer only

Where the app's fees and 1% yield share go. Defaults to the deployer.

clarity
(set-interface-treasury-principal (treasury-principal principal))
err u103

set-interface-uri

deployer only

Set the app's root URL.

clarity
(set-interface-uri (uri (string-utf8 256)))
err u103

Event hooks

Called by user contracts. They verify the caller is an approved user contract and print an interface-scope event your indexer can follow.

decast-postx

contract hook

Logs a post made through this app.

clarity
(decast-postx (payload (buff 6144)))
  • Event fields: event, scope "interface", author, user-contract-address, user-contract-hash, interface-contract-address, interface-contract-hash, payload.
err u101

decast-boostx

contract hook

Logs a boost made through this app.

clarity
(decast-boostx (payload (buff 6144)))
err u101

Events via Hiro API

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

App contract

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