Constructor called once during contract deployment Sets up the admin and game engine address
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
game_engine_address: soroban_sdk::Address,
)
Get the admin address
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Get the game engine address
fn get_game_engine(env: soroban_sdk::Env) -> soroban_sdk::Address
Upgrade the contract to new WASM bytecode (admin only)
fn upgrade(env: soroban_sdk::Env, hash: soroban_sdk::BytesN<32>)
Create a new game with two players and their wagers This calls the game engine to create a session and lock points The session_id must be provided by the caller to ensure deterministic simulation
fn create_game(
env: soroban_sdk::Env,
session_id: u64,
player1: soroban_sdk::Address,
player2: soroban_sdk::Address,
player1_wager: i128,
player2_wager: i128,
target_number: u32,
)
Player 1 submits their guess (1-10)
fn player1_guess(env: soroban_sdk::Env, session_id: u64, guess: u32)
Player 2 submits their guess (1-10) This automatically resolves the game and awards faction points!
fn player2_guess(env: soroban_sdk::Env, session_id: u64, guess: u32)
Get game details
fn get_game(env: soroban_sdk::Env, session_id: u64) -> Game
Get the winner of a game
fn get_winner(env: soroban_sdk::Env, session_id: u64) -> Winner