Contract c3fe70f0e0e5d03ee373aaf419010715467a7671fc11c817154d5b32f6cd3ad9

← Back to Index 📥 Download WASM

Meta

cliver 26.1.0#1228cff8022b804659750b94b315932b0e0f3f6a
rssdkver 27.0.6#60926a20d1f9f0a669d5fe551636f42a1302f0c0
rsver 1.96.0

Instances

  • CA5TTQCSZ6OJRHKWZGYX3H4UUMWJMHE2V2SUTCUKUGR7C6L4TXR6YNFY

Interface

Burns amount YT from from, on a holder's own direct call. The holder is settled first so their accrued yield is banked before the balance shrinks, at a rate observed through the tokenizer. The tokenizer's recombine burns through burn_settled instead, passing the rate down, because it is on the call stack here and cannot be called back into.

This can drop YT total_supply below PT total_supply by design — not a bug. No economic path reads YT total_supply; the tokenizer's escrow, PT-senior cap, and pro-rata math read only pt_total_supply.

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

Mints amount YT to to. Restricted to the tokenizer recorded at initialization, which mints YT when a holder splits SY. The recipient is settled first, so a fresh holder's checkpoint starts at the current rate and an existing holder's prior yield is banked before the balance grows.

fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn config(env: soroban_sdk::Env) -> Result

Settles holder at the rate supplied by the tokenizer and returns their current banked total in SY shares WITHOUT zeroing it. Restricted to the tokenizer. Moves no tokens; it is the first half of a claim.

This is deliberately split from consume (they used to be one settle_and_consume that zeroed the whole ledger). All-or-nothing consume could not express a partial payment, but the tokenizer now caps a claim to the escrow surplus over the senior PT reservation. So it settles to learn the owed total, decides how much the surplus can cover, and consumes only that. Whatever it does not consume stays banked and is claimable later.

The rate is passed in, not read here, on purpose. The tokenizer is already on the call stack when it invokes this (claim_yield -> here), so yt cannot call back into the tokenizer to fetch the canonical maturity rate: Soroban prohibits re-entering a contract already on the stack. The tokenizer instead computes its single canonical rate (live before maturity, its frozen snapsh

fn settle(
    env: soroban_sdk::Env,
    holder: soroban_sdk::Address,
    rate: i128,
) -> Result
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    expiration_ledger: u32,
)
fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128

Subtracts exactly amount SY shares from holder's banked ledger. Restricted to the tokenizer, which calls this after settle and pushes the same amount of SY out of escrow itself. Moves no tokens. amount == 0 is a no-op; amount must be <= banked (the tokenizer only ever consumes what a prior settle reported), enforced so the ledger can never go negative. The remainder stays banked and claimable later once escrow can cover it.

fn consume(
    env: soroban_sdk::Env,
    holder: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>
fn decimals(env: soroban_sdk::Env) -> u32
fn maturity(env: soroban_sdk::Env) -> Result
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)
fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)

The SY rate the holder's yield was last settled at. Zero means the holder has never been settled (no YT minted to them yet).

fn checkpoint(
    env: soroban_sdk::Env,
    holder: soroban_sdk::Address,
) -> Result
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    tokenizer: soroban_sdk::Address,
    sy_token: soroban_sdk::Address,
    maturity: u64,
) -> Result<(), soroban_sdk::Error>

Burns amount YT from from, settling them first at the rate supplied by the tokenizer. Restricted to the tokenizer, which calls this from recombine while it is on the call stack: yt cannot call back into it to observe a rate, so the tokenizer hands down the same rate it observed in that transaction. Trusting the argument is safe because of the auth gate, the same model as settle and consume. The holder's own authorization is enforced by recombine itself.

fn burn_settled(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount: i128,
    rate: i128,
) -> Result<(), soroban_sdk::Error>
fn total_supply(env: soroban_sdk::Env) -> i128

SY shares already banked to the holder but not yet claimed.

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

Total SY shares claimable by holder right now: already-banked yield plus what a settle at the current SY rate would add. The contract reads the rate from the SY contract itself, so no caller can supply a fake one.

Before maturity this is a point-in-time read of the live rate, so the executed claim_yield amount may differ if the rate moves between this quote and submission. After maturity it uses the tokenizer's frozen maturity rate (see preview_rate), so it no longer tracks live accrual.

fn preview_claim_yield(
    env: soroban_sdk::Env,
    holder: soroban_sdk::Address,
) -> Result

Imports

WebAssembly Text (WAT) ▶