Keeper pushes the latest SY->asset rate and accrues yield to YT holders.
fn sync(env: soroban_sdk::Env, new_index: i128)
Buy PT with quote_in of the stable token, this LOCKS A FIXED RATE.
fn buy_pt(env: soroban_sdk::Env, buyer: soroban_sdk::Address, quote_in: i128) -> i128
Recombine amt PT + amt YT back into SY at any time (PT + YT == SY).
fn combine(env: soroban_sdk::Env, user: soroban_sdk::Address, amt: i128) -> i128
Deposit sy_amt of the underlying SY; mint equal PT and YT (asset-denominated).
fn deposit(env: soroban_sdk::Env, user: soroban_sdk::Address, sy_amt: i128) -> i128
Sell pt_in PT back to the pool for the stable token.
fn sell_pt(env: soroban_sdk::Env, seller: soroban_sdk::Address, pt_in: i128) -> i128
PT spot price in quote units (1e7-scaled). 1.0 == par. Uses the time-decayed effective reserve so the mark converges to par as maturity approaches.
fn pt_price(env: soroban_sdk::Env) -> i128
After maturity, redeem amt PT for its asset value in SY (the fixed-rate settles).
fn redeem_pt(env: soroban_sdk::Env, user: soroban_sdk::Address, amt: i128) -> i128
Implied annualized fixed rate (1e7-scaled) from the pool's current PT price.
fn fixed_rate(env: soroban_sdk::Env) -> i128
Create the market. index_init is the starting SY->asset rate (1e7 = 1:1).
quote is the stable token (e.g. USDC) the built-in PT AMM prices against.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
underlying: soroban_sdk::Address,
quote: soroban_sdk::Address,
maturity: u64,
index_init: i128,
)
fn pt_balance(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
fn vault_info(env: soroban_sdk::Env) -> VaultInfo
fn yt_balance(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Claim accrued yield (paid in SY worth the owed asset value).
fn claim_yield(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
fn market_info(env: soroban_sdk::Env) -> MarketInfo
fn transfer_pt(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amt: i128,
)
fn transfer_yt(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amt: i128,
)
After settlement, claim your pro-rata SY and any uninvested cash, burning shares.
fn vault_claim(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
View: how much PT quote_in would buy right now (no state change).
fn quote_buy_pt(env: soroban_sdk::Env, quote_in: i128) -> i128
Keeper deploys amount of idle vault cash into PT at the current price (the carry).
fn vault_invest(env: soroban_sdk::Env, amount: i128) -> i128
After maturity, redeem all vault PT at par into SY. This locks in the fixed return.
fn vault_settle(env: soroban_sdk::Env)
fn vault_shares(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Seed / add liquidity to the PT-quote pool. Returns LP shares minted.
fn add_liquidity(
env: soroban_sdk::Env,
provider: soroban_sdk::Address,
pt_in: i128,
quote_in: i128,
) -> i128
Live claimable yield (asset units) without mutating state.
fn pending_yield(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Fraction of the tenor elapsed, 1e7-scaled (0 at issuance, 1e7 at maturity).
fn time_progress(env: soroban_sdk::Env) -> i128
Deposit quote_in of the stable token into the carry vault. Returns shares minted.
fn vault_deposit(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
quote_in: i128,
) -> i128
Annualized fixed rate (1e7-scaled) implied by a PT quoted at pt_price (asset per PT,
1e7-scaled) with secs_to_maturity left. rate = (1/price - 1) * year/tenor.
fn implied_fixed_rate(
env: soroban_sdk::Env,
pt_price: i128,
secs_to_maturity: u64,
) -> i128