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.
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:
caller.require_auth() against owner before issuing the YT burn.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,
)