Contract 1548732c24baeb358f236a564deaecafff5d613f6473636fe4a73b4d179bed68

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.95.0

Instances

  • CBP4HWOFUTPIIQQ6ULOZ5325LGPCL5MDBHJJINXB6Z4F6XRBIDI3ONUF

Interface

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)

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:

  1. Snapshot bettor's GMB balance → determine fee tier (locked for this bet).
  2. Transfer amount XLM stroops from bettor into the contract.
  3. Record the bet.
  4. Attempt to send GMB rakeback from the contract's reserve to the bettor. If the reserve is insufficient the bet still succeeds — the reward is skipped.
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.

Parameters

  • admin — Oracle / admin keypair that creates/locks/settles markets
  • xlm_token — SEP-41 contract address for native XLM on this network
  • gmb_token — SEP-41 contract address for the GMB utility token
  • treasury — Separate address that receives the platform rake on claims
fn 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.

Parameters

  • market_type_id — 0 = Standard, 1 = PropBet, 2 = Tournament
  • outcomes — 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)
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)

Imports

WebAssembly Text (WAT) ▶