Initialize the competition
fn init(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
end_time: u64,
token: soroban_sdk::Address,
epoch_duration: Option,
)
Award entire prize pool to #1 player. Callable by anyone after end_time. Returns true if prize was distributed, false if no pool or no participants
fn payout(env: soroban_sdk::Env) -> bool
Upgrade the contract to a new WASM binary Can only be called by admin
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Get competition state
fn get_state(env: soroban_sdk::Env) -> GameConfig
Update token address (admin only) Use this to fix misconfigured token address
fn set_token(env: soroban_sdk::Env, token: soroban_sdk::Address)
Get current leader (backwards compatible - returns top of leaderboard)
fn get_leader(env: soroban_sdk::Env) -> (soroban_sdk::Address, u64)
Submit a verified score (called by backend oracle) Only updates if it's a new personal best
fn submit_score(env: soroban_sdk::Env, player: soroban_sdk::Address, score: u64)
Migrate old 6-field GameConfig to new 7-field GameConfig Call this once after upgrade if get_state fails with "UnexpectedSize"
fn migrate_config(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Emergency function to recover all funds Can ONLY be called by the hardcoded panic admin address Returns all XLM to the panic admin
fn panic_withdraw(env: soroban_sdk::Env)
Get the full leaderboard (top 10)
fn get_leaderboard(env: soroban_sdk::Env) -> soroban_sdk::Vec
Start a new epoch (admin only)
fn start_new_epoch(env: soroban_sdk::Env)
Legacy function for backwards compatibility Now calls start_new_epoch internally
fn start_new_round(env: soroban_sdk::Env, _new_end_time: u64)
Get historical config for a specific completed round
fn get_round_config(env: soroban_sdk::Env, round_id: u32) -> Option
Get a player's personal best score
fn get_personal_best(env: soroban_sdk::Env, player: soroban_sdk::Address) -> u64
Get historical leaderboard for a specific completed round
fn get_round_history(
env: soroban_sdk::Env,
round_id: u32,
) -> soroban_sdk::Vec
Update epoch duration (admin only) Takes effect on the next epoch
fn set_epoch_duration(env: soroban_sdk::Env, duration_seconds: u64)