Pause all money-moving operations (admin only).
When paused, place_bet, claim_payout, and claim_refund will all
reject with "contract is paused". Use in emergencies (suspected exploit,
oracle compromise, etc.) to prevent further fund movement while the
situation is assessed. Does not affect read-only queries.
fn pause(env: soroban_sdk::Env)
Resume normal operations after a pause (admin only).
fn unpause(env: soroban_sdk::Env)
Upgrade the contract WASM in-place (admin only). Allows patching the contract without redeploying or losing state.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Returns true if the contract is currently paused.
fn is_paused(env: soroban_sdk::Env) -> bool
Place an XLM bet on a market outcome.
Flow:
amount XLM stroops from bettor into the contract.fn place_bet(
env: soroban_sdk::Env,
bettor: soroban_sdk::Address,
market_id: u64,
outcome: soroban_sdk::Symbol,
amount: i128,
)
Extend instance storage TTL (callable by anyone to keep contract alive)
fn extend_ttl(env: soroban_sdk::Env)
fn get_market(env: soroban_sdk::Env, market_id: u64) -> MarketState
Deploy and configure the contract.
admin — Oracle / admin keypair that creates/locks/settles marketsxlm_token — SEP-41 contract address for native XLM on this networkgmb_token — SEP-41 contract address for the GMB utility tokentreasury — Separate address that receives the platform rake on claimsfn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
xlm_token: soroban_sdk::Address,
gmb_token: soroban_sdk::Address,
treasury: soroban_sdk::Address,
)
Lock a market (admin only). No new bets accepted after this point. Typically called when the chess game starts.
fn lock_market(env: soroban_sdk::Env, market_id: u64)
Accept the pending admin role — step 2 of a two-step key rotation.
Must be called by the address previously nominated via propose_admin.
Clears PendingAdmin and promotes the caller to Admin.
fn accept_admin(env: soroban_sdk::Env)
Claim XLM winnings for a settled market (pull model, winner-initiated).
Payout formula (pari-mutuel with per-bettor fee tier): gross_share = (bet.amount / winning_pool) × total_pool rake = gross_share × bet.fee_bps / 10000 payout = gross_share − rake
The rake is routed to the treasury; the net payout goes to the bettor.
fn claim_payout(env: soroban_sdk::Env, bettor: soroban_sdk::Address, market_id: u64)
Claim a full XLM refund for a cancelled market (bettor-initiated).
fn claim_refund(env: soroban_sdk::Env, bettor: soroban_sdk::Address, market_id: u64)
fn get_user_bet(
env: soroban_sdk::Env,
market_id: u64,
bettor: soroban_sdk::Address,
) -> Option
Update the treasury address (admin only)
fn set_treasury(env: soroban_sdk::Env, treasury: soroban_sdk::Address)
Cancel a market (admin only). Enables full XLM refunds for all bettors.
fn cancel_market(env: soroban_sdk::Env, market_id: u64)
Create a new market. Returns the market ID. Permissionless — anyone can open a market via their wallet.
market_type_id — 0 = Standard, 1 = PropBet, 2 = Tournamentoutcomes — Non-empty list of outcome labels, e.g. ["White", "Black", "Draw"]fn create_market(
env: soroban_sdk::Env,
market_type_id: u32,
outcomes: soroban_sdk::Vec,
) -> u64
Propose a new admin address — step 1 of a two-step key rotation (admin only).
The proposed address must call accept_admin to complete the transfer.
Until accepted, the current admin retains full control. This prevents
accidentally locking the contract by proposing an unreachable address.
fn propose_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Record the winning outcome (admin / oracle only).
This is STRICTLY a state update — it does NOT push any payouts.
Winners must call claim_payout individually (pull model) to avoid
Soroban instruction-limit issues on markets with many bettors.
fn settle_market(env: soroban_sdk::Env, market_id: u64, result: soroban_sdk::Symbol)
Update the GMB token contract address (admin only). Use this to correct the address if the wrong GMB contract was set at initialize time.
fn set_gmb_token(env: soroban_sdk::Env, gmb_token: soroban_sdk::Address)
Update the XLM token contract address (admin only). Use this to correct the address if the wrong SAC was set at initialize time.
fn set_xlm_token(env: soroban_sdk::Env, xlm_token: soroban_sdk::Address)
fn get_fee_config(env: soroban_sdk::Env) -> FeeConfig
fn is_initialized(env: soroban_sdk::Env) -> bool
Update the fee tier thresholds and rates. All values must be non-zero and tiers must be ordered (tier1 < tier2).
fn set_fee_config(
env: soroban_sdk::Env,
default_fee_bps: u32,
tier1_threshold: i128,
tier1_fee_bps: u32,
tier2_threshold: i128,
tier2_fee_bps: u32,
)
fn get_market_count(env: soroban_sdk::Env) -> u64
fn get_rakeback_rate_bps(env: soroban_sdk::Env) -> u32
Update the GMB rakeback rate.
rate_bps is expressed in basis points of the XLM bet amount:
1000 bps = 10% → for a 10 XLM bet the bettor receives 1 GMB.
Set to 0 to disable rakeback entirely.
fn set_rakeback_rate_bps(env: soroban_sdk::Env, rate_bps: u32)