Read AMM protocol identifier
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Read pool reserves for market
fn get_pool(env: soroban_sdk::Env, market_id: u64) -> PoolReserves
Initialize the AMM contract with admin and default fee in BPS (e.g. 30 = 0.3%)
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address, fee_bps: u32)
Calculate shares received for a buy order under constant-product formula (x*y=k) Also returns protocol fee and estimated price impact in BPS
fn calculate_buy(
env: soroban_sdk::Env,
yes_reserves: i128,
no_reserves: i128,
payment: i128,
is_yes: bool,
fee_bps: u32,
) -> (i128, i128, u32)
Calculate collateral payout for a sell order
fn calculate_sell(
env: soroban_sdk::Env,
yes_reserves: i128,
no_reserves: i128,
shares: i128,
is_yes: bool,
fee_bps: u32,
) -> (i128, i128)
Calculate outcome probability in BPS (0 to 10,000 basis points) Price of YES = no_reserves / (yes_reserves + no_reserves) * 10000
fn calculate_price(
env: soroban_sdk::Env,
yes_reserves: i128,
no_reserves: i128,
is_yes: bool,
) -> u32