fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
arbiter: soroban_sdk::Address,
token: soroban_sdk::Address,
protocol_fee_bps: u32,
lp_fee_bps: u32,
min_bond: i128,
)
Emergency stop. Blocks NEW risk only — never blocks exits (I6).
fn set_paused(env: soroban_sdk::Env, paused: bool)
Rotate the arbiter (e.g. new multisig account). Admin-gated. NOTE (accepted risk, see review M-2): no timelock in hackathon scope.
fn set_arbiter(env: soroban_sdk::Env, new_arbiter: soroban_sdk::Address)
fn set_fees(env: soroban_sdk::Env, protocol_fee_bps: u32, lp_fee_bps: u32)
fn withdraw_protocol_fees(env: soroban_sdk::Env, to: soroban_sdk::Address) -> i128
Create a market and seed its AMM. Admin-gated in hackathon scope
(permissionless creation = spam + malicious-question risk; see L-1).
The creator's initial_liquidity is split into equal YES/NO reserves
(starting price 0.50) and the creator receives LP shares, minus a
small permanently-locked amount (prevents full-drain / div-by-zero).
fn create_market(
env: soroban_sdk::Env,
creator: soroban_sdk::Address,
question: soroban_sdk::String,
category: soroban_sdk::Symbol,
criteria_ref: soroban_sdk::String,
lock_time: u64,
resolve_time: u64,
dispute_window: u64,
position_cap: i128,
bond: i128,
initial_liquidity: i128,
) -> u64
Add liquidity proportional to current reserves (Gnosis FPMM style):
deposit amount collateral -> mint amount complete sets -> add the
proportional amounts to reserves -> refund the surplus outcome shares
to the LP as a position. LP shares minted pro-rata on the larger reserve.
fn add_liquidity(
env: soroban_sdk::Env,
market_id: u64,
from: soroban_sdk::Address,
amount: i128,
) -> i128
Remove liquidity BEFORE resolution: burn LP shares, receive pro-rata
YES/NO shares from the reserves (NOT collateral — the pool cannot know
final value yet). After resolution use claim_lp instead.
fn remove_liquidity(
env: soroban_sdk::Env,
market_id: u64,
from: soroban_sdk::Address,
lp_amount: i128,
)
Buy YES (buy_yes=true) or NO shares with amount_in collateral.
Fees are taken from the input. Reverts if output < min_shares_out
(caller-side slippage protection) or the position cap is exceeded.
fn buy(
env: soroban_sdk::Env,
market_id: u64,
from: soroban_sdk::Address,
buy_yes: bool,
amount_in: i128,
min_shares_out: i128,
) -> i128
Sell shares_in YES/NO shares back to the pool for collateral.
Uses the closed-form FPMM sell: solve (y + s - x)(n - x) = y*n for x
(selling YES), pay x minus fees. Rounding favors the pool.
fn sell(
env: soroban_sdk::Env,
market_id: u64,
from: soroban_sdk::Address,
sell_yes: bool,
shares_in: i128,
min_amount_out: i128,
) -> i128
Propose an outcome after resolve_time, escrowing the market's bond.
Anyone can propose (permissionless) — in practice Orakel's AI Result
Agent proposes first, but nothing on-chain privileges it.
fn propose(
env: soroban_sdk::Env,
market_id: u64,
proposer: soroban_sdk::Address,
outcome: Outcome,
)
Dispute an active proposal within the dispute window, escrowing an equal bond. Escalates settlement to the arbiter multisig.
fn dispute(env: soroban_sdk::Env, market_id: u64, disputer: soroban_sdk::Address)
Permissionless finalize after an undisputed window. Returns the proposer's bond and freezes the outcome. Callable even when paused (I6).
fn finalize(env: soroban_sdk::Env, market_id: u64)
Arbiter (2-of-3 multisig Stellar account) settles a disputed market. Winner of the bond game gets their bond back + half the loser's bond; the other half accrues to the protocol (anti-collusion: disputing your own proposal from a second wallet always loses you half a bond). Callable even when paused (I6).
fn arbiter_resolve(env: soroban_sdk::Env, market_id: u64, outcome: Outcome)
Redeem a resolved position. Yes/No pay 1 per winning share; Void pays 0.5 per share on BOTH sides (floor — dust stays in the contract). Callable even when paused (I6).
fn claim(env: soroban_sdk::Env, market_id: u64, user: soroban_sdk::Address) -> i128
LP redemption after resolution: pro-rata share of the pool's final value (winning reserves valued at 1, plus accrued fees). Callable even when paused (I6).
fn claim_lp(env: soroban_sdk::Env, market_id: u64, user: soroban_sdk::Address) -> i128
fn get_market(env: soroban_sdk::Env, market_id: u64) -> Market
fn get_user_position(
env: soroban_sdk::Env,
market_id: u64,
user: soroban_sdk::Address,
) -> Position
fn get_user_lp(
env: soroban_sdk::Env,
market_id: u64,
user: soroban_sdk::Address,
) -> i128
Current implied YES probability in bps (0..10_000).
fn yes_price_bps(env: soroban_sdk::Env, market_id: u64) -> i128
fn market_count(env: soroban_sdk::Env) -> u64