Contract daeb931b9507440b6dc4f73256ac33c6089964f5d035f7eec5fcedc10e732c8e

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdk_spec_shaking 2
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.96.0

Instances

  • CAGGP4UHMIUT76HJZESWKOIWDQWSKKCHGW22MW7AQHQYENVRLMPCGRHB
  • CAQPNK37HP3BVDNYNYJ7USCFCLXO4S7K75VSLF54BD25APTHSM5COT5L
  • CAUKKZSHKNCP44C2CLNNDMI4H5JF4EJUJ7CRZR2Z7NTLI2N6BE2SRBYP
  • CBDQZFWY735RH3PQLNK4BIOO7DTJY4ZQWK5YDFCZ7EIL5DAO2567TORX
  • CBRI2RSGUJJOTP3W7HLICWOFHCDB64S73EIUYU653JG7GKZRTQDT72V7
  • CC3MKDR62O4Q7EEBOXXCNFJH3Z6AZQLB3QUTUEKAMSIJIYAHLUPVQR5G
  • CCZVSODQH6UVMSENOAPBGVH3ZHMUSM5OXZJGMRYIO2V22HPI56U6PBFL
  • CDNNGBZOH2OOJ2OKON3A3IVD2JS323BAI2DX55JEWKD327XBJDYDUPAR

Interface

Public burn (spec-03 §3.5). Settles yield via pt.update_yield(caller, pre_burn_balance) before burning. Panics with FungibleTokenError::InsufficientBalance if expired and amount != 0. Base::burn handles caller.require_auth() internally.

fn burn(env: soroban_sdk::Env, caller: soroban_sdk::Address, amount: i128)

PT-only: mint YT to to (spec-03 §3.4).

fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn pause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn get_pt(env: soroban_sdk::Env) -> soroban_sdk::Address
fn paused(env: soroban_sdk::Env) -> bool
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    live_until_ledger: u32,
)

Returns 0 after expiry (YT becomes worthless at maturity). Use [actual_balance_of] to query the real stored balance.

fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128
fn unpause(env: soroban_sdk::Env, caller: soroban_sdk::Address)

PT-only: upgrade YT's WASM. Mirrors the pause/unpause gating pattern — PT is the policy authority for YT, so YT instances roll forward only when PT (whose admin holds UPGRADE_ROLE) drives the upgrade. Uses Soroban's native update_current_contract_wasm (no proxy/beacon).

Intentionally not #[when_not_paused]: a paused YT must remain upgradeable so PT's admin can patch out the bug that caused the pause. Trades a small "upgrade hides a paused state" surface for being able to recover an otherwise wedged contract.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn decimals(env: soroban_sdk::Env) -> u32

Panics with InsufficientBalance if expired and amount != 0. Reads pre-transfer balances and pushes them into pt.before_yt_transfer(from, to, from_bal, to_bal) so yield is settled on pre-transfer state (spec-04 §17.1).

fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::MuxedAddress,
    amount: i128,
)

Panics with InsufficientBalance post-expiry. Mirrors the post-expiry reverts on transfer/transfer_from/burn: once YT is expired the allowance is unspendable, so the query is hardened to fail loudly instead of returning a stale non-zero value (Solidity returns the raw value but its transferFrom reverts, making the allowance effectively dead — same outcome, surfaced earlier here).

fn allowance(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

decimals and maturity are passed by PT (it already has both) instead of YT calling pt.decimals() / pt.maturity(). At init time, PT is on the call stack (since PT deploys+inits YT), so a YT→PT cross-call would hit the Soroban host reentrancy guard. Same pattern as before_yt_transfer in spec-04 §17.1.

Caching maturity (immutable in PT) also decouples YT's liveness from PT's instance TTL — a YT read no longer requires PT to be alive in storage.

fn initialize(
    env: soroban_sdk::Env,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    decimals: u32,
    maturity: u64,
    pt: soroban_sdk::Address,
)

Returns 0 after expiry.

fn total_supply(env: soroban_sdk::Env) -> i128
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Returns the actual stored balance, ignoring maturity (spec-03 §3.6). Used by PT for yield accounting.

fn actual_balance_of(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128

PT-only: burn amount from owner without calling update_yield (spec-03 §3.4). PT is responsible for settling yield before calling. If spender != owner, spends spender's allowance from owner.

Auth invariant

Gated by pt.require_auth(). When owner == spender, the inner Base::burn skips its allowance/auth bookkeeping because PT is expected to have already obtained owner's consent on the PT side before reaching this branch:

  • Self-redeem / self-withdraw: PT's entrypoint sees caller.require_auth() against owner before issuing the YT burn.
  • Behalf-of via approval: PT consumes a PT-side allowance via Base::burn_from on the PT shares before the YT burn.

Callers (PT only) MUST preserve this invariant on every code path that lands here; otherwise PT can burn arbitrary YT balances for any holder.

fn burn_without_yield_update(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
)

Imports

WebAssembly Text (WAT) ▶