Contract 50afa30e0c67c32ca90b3331f6cff8d4461c83bed0e5d170e7447b965f97e4b2

← Back to Index 📥 Download WASM

Meta

rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.90.0

Interface

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 Returns the session ID

fn create_game(
    env: soroban_sdk::Env,
    player1: soroban_sdk::Address,
    player2: soroban_sdk::Address,
    player1_wager: i128,
    player2_wager: i128,
    target_number: u32,
) -> u64

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

Imports

WebAssembly Text (WAT) ▶