Skip to main content
You trade by calling rwa_market instructions, reading the price from the Asset account and the settlement mint from the token’s TokenMeta. The full IDL JSON files (loadable with Anchor’s Program) are the ground truth; below is the trader-facing subset. All prices are integer USD cents (price_cents).

Read the price — Asset account

The Asset PDA (["asset", mint]) holds everything you quote against:
  • price_cents — USD cents per whole token.
  • fee_bps — fee in basis points taken off your trade.
  • is_active — whether trading is currently enabled.
  • max_per_tx / max_per_user — trade-size caps (0 = unlimited).

Trade — buy / sell

Trades are non-custodial — your wallet signs, and the vault side moves automatically via a pre-authorized delegate. Both buy and sell use the same Trade account context:
  • trader (signer) — your wallet
  • asset PDA — ["asset", mint]
  • rwa_mint, payout_mint
  • the vault’s RWA + payout token accounts (ATAs owned by the vault PDA)
  • your RWA + payout token accounts (ATAs)
  • both token programs (SPL Token + Token-2022)

Trade math

The amounts are computed in u128, against the accrued price rather than the stored price_cents (see below):
On a buy you pay proceeds + fee (capped by max_cost); on a sell you receive proceeds - fee (floored by min_proceeds).

Reading the accrued price

Interest is not paid out — it accrues into the price, every second, at the asset’s annual rate. Everything needed to compute it is on the Asset account, so there is no oracle program to call:
Simple interest pro-rated by the second — it does not compound between checkpoints.
Do not read price_cents and stop there. It is only rewritten when a checkpoint is taken, so between checkpoints it is both stale and rounded to whole hundredths. On a low-priced asset it can sit unchanged for weeks while the real value accrues. Use the formula above.
An on-chain program can skip the arithmetic entirely by depending on the rwa_market crate and calling rwa_market::current_price_scaled(&asset, now) — the same function every pricing path inside the program uses.

Read the settlement token — TokenMeta

Before trading, read payout_token (and decimals) from the token’s TokenMeta PDA (["meta", mint]) so you know which mint you’re spending/receiving and how to scale amounts.

Redemption — rwa_exit.claim

At end-of-life the asset admin freezes a final price and opens claims. Redemption is claim-based — you pull your principal: The ExitState PDA (["exit", mint]) exposes final_price_cents, initiated, and completed so you can check whether claiming is open. Payout math matches trading: amount * final_price_cents * 10^payout_dec / (100 * 10^rwa_dec).

Download the IDLs

The IDL JSON files are the complete, machine-readable contract surface — the ground truth for every instruction, account, and type. Download the ones you need and load them with Anchor’s Program. Each program id is embedded in the IDL’s address field, so you don’t need to hard-code it.

rwa_market.json

Trading — buy / sell, the Asset account.

rwa_token.json

Asset terms & the TokenMeta account (payout_token, decimals).

rwa_exit.json

Redemption — claim, the ExitState account.

rwa_vault.json

The vault accounts a trade touches.

Loading the IDL (Anchor)

Save the file you downloaded above into your project (e.g. ./idl/) and import it: