fn wad(env: soroban_sdk::Env) -> i128
Initialise a freshly-deployed scalar-Gaussian market. See the Sprint-1
docs; Sprint 2 appends the usdc SAC contract id (the settlement asset,
resolved per-network at deploy time — never hardcoded).
fn init(
env: soroban_sdk::Env,
k: i128,
b: i128,
fee_bps: u32,
resolver: soroban_sdk::Address,
tier: u32,
window_open: u64,
window_lock: u64,
window_resolve: u64,
mu0: i128,
sigma0: i128,
usdc: soroban_sdk::Address,
capped_flag: u32,
treasury: soroban_sdk::Address,
creator: soroban_sdk::Address,
fee_lp_bps: u32,
fee_treasury_bps: u32,
fee_creator_bps: u32,
blend_adapter: Option,
)
Claim a resolved position: returns collateral + (g(x₀) − f(x₀))
clamped at 0 in USDC (floor 7-dp), deletes the position.
fn claim(env: soroban_sdk::Env, position_id: u64) -> i128
Submit a belief (μ₂, σ₂): scale to λ₂ = k·√(2σ₂√π), compute the
position g − f and worst-case collateral, add the fee, pull USDC, mint
a position, advance the curve to g, return the position id.
max_collateral_7dp guards slippage (total = collateral + fee, 7-dp).
fn trade(
env: soroban_sdk::Env,
trader: soroban_sdk::Address,
mu2: i128,
sigma2: i128,
max_collateral_7dp: i128,
) -> u64
After window.resolve, pull x₀ from the resolver. Stale ⇒ market
becomes Disputable (no payouts). Pending ⇒ reverts
ResolverNotReady. Otherwise Resolved(x₀) and claim opens.
fn resolve(env: soroban_sdk::Env)
fn get_state(env: soroban_sdk::Env) -> MarketState
LP shares held by lp.
fn lp_shares(env: soroban_sdk::Env, lp: soroban_sdk::Address) -> i128
fn get_params(env: soroban_sdk::Env) -> MarketParams
(collateral_pool_wad, lp_total_shares, fee_pool_wad).
fn pool_state(env: soroban_sdk::Env) -> (i128, i128, i128)
Live per-checkpoint curves (trajectory markets only).
fn get_beliefs(env: soroban_sdk::Env) -> soroban_sdk::Vec
A stored position (panics PositionNotFound if claimed/unknown).
fn get_position(env: soroban_sdk::Env, id: u64) -> PositionData
(treasury_fees_wad, creator_fees_wad).
fn pending_fees(env: soroban_sdk::Env) -> (i128, i128)
Add liquidity at scale scale_y (WAD; WAD = 100%). Deposits
scale_y·(b − locked_collateral) USDC and mints scale_y·L LP shares
(or scale_y shares when L = 0). Only while Open.
fn add_liquidity(
env: soroban_sdk::Env,
lp: soroban_sdk::Address,
scale_y: i128,
) -> i128
Free collateral available for LP entry: b − locked − pool (WAD).
fn free_collateral(env: soroban_sdk::Env) -> i128
The checkpoint timestamps (trajectory markets only).
fn get_checkpoints(env: soroban_sdk::Env) -> soroban_sdk::Vec
Initialise a freshly-deployed trajectory market. checkpoints are Unix
timestamps (ascending, ≤ window.resolve); mus0/sigmas0 are the
initial per-checkpoint Gaussian params (WAD), one per checkpoint. The
σ-floor + peak ≤ b solvency checks apply to every checkpoint.
fn init_trajectory(
env: soroban_sdk::Env,
k: i128,
b: i128,
fee_bps: u32,
resolver: soroban_sdk::Address,
tier: u32,
checkpoints: soroban_sdk::Vec,
window_open: u64,
window_lock: u64,
window_resolve: u64,
mus0: soroban_sdk::Vec,
sigmas0: soroban_sdk::Vec,
usdc: soroban_sdk::Address,
treasury: soroban_sdk::Address,
creator: soroban_sdk::Address,
fee_lp_bps: u32,
fee_treasury_bps: u32,
fee_creator_bps: u32,
blend_adapter: Option,
)
Claim a resolved trajectory position: returns collateral + Σ_i (g_i(x_i) − f_i(x_i)) clamped at 0 in USDC (floor 7-dp), deletes
the position.
fn claim_trajectory(env: soroban_sdk::Env, position_id: u64) -> i128
Burn LP shares and withdraw the proportional slice of pool + fee_pool
in USDC. While Open, only the slice not reserved for locked trader
collateral is withdrawable. Blocked during Locked, Disputable, and
after resolution until every position is claimed.
fn remove_liquidity(
env: soroban_sdk::Env,
lp: soroban_sdk::Address,
shares: i128,
) -> i128
Submit per-checkpoint beliefs (μ_i, σ_i): for each checkpoint compute
the position g_i − f_i and its worst-case collateral; the trade's
collateral is the sum (the checkpoints are independent ⇒ worst-case of
the sum is the sum of worst-cases). Adds the fee, pulls USDC, mints a
trajectory position, advances every checkpoint curve to g_i.
fn trade_trajectory(
env: soroban_sdk::Env,
trader: soroban_sdk::Address,
mus2: soroban_sdk::Vec,
sigmas2: soroban_sdk::Vec,
max_collateral_7dp: i128,
) -> u64
USDC (7-dp) from Blend borrows still held by this market's wallet.
fn blend_backed_usdc(env: soroban_sdk::Env) -> i128
The realised per-checkpoint outcomes once resolved (trajectory markets).
fn resolved_outcomes(env: soroban_sdk::Env) -> soroban_sdk::Vec
Blend-backed borrow headroom for this market (7-dp USDC), 0 if disabled.
fn blend_backed_depth(env: soroban_sdk::Env) -> i128
Market creator claims accrued fee share (7-dp USDC).
fn claim_creator_fees(env: soroban_sdk::Env) -> i128
Treasury claims accrued fee share (7-dp USDC).
fn claim_treasury_fees(env: soroban_sdk::Env) -> i128
A stored trajectory position (panics PositionNotFound if unknown).
fn get_trajectory_position(env: soroban_sdk::Env, id: u64) -> TrajectoryPositionData