Contract 1d70be282a612751248f951fcfb75aa9d0d3f425a04136c089aeb6569d8e9b10

← Back to Index 📥 Download WASM

Meta

rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.90.0

Instances

  • CBGAJWY44ON37HD4OIHQHAZS5UMDEZW66ZEQIN4BHDLUY3XENF3TLI2Y

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) ▶