Contract 1f3ff9e2e1dde06da0cb99f28dca461e6ddc89c2811f78b6c1c555744e70ee11

← Back to Index 📥 Download WASM

Meta

cliver 23.2.0#8c559e832fd969aa469784b66e70891fadf94f0a
rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.91.1

Instances

  • CDB6IODG5BNNVILLJXBXYZVR7NP4HDO2NL7WALWIXGIDMA6VY4V75CEX

Interface

Update the contract WASM hash (upgrade contract)

Arguments

  • new_wasm_hash - The hash of the new WASM binary
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Get game information.

Arguments

  • session_id - The session ID of the game

Returns

  • Game - The game state (includes winning number after game ends)
fn get_game(env: soroban_sdk::Env, session_id: u32) -> Result

Get the current admin address

Returns

  • Address - The admin address
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Set a new admin address

Arguments

  • new_admin - The new admin address
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Make a guess for the current game. Players can guess a number between 1 and 10.

Arguments

  • session_id - The session ID of the game
  • player - Address of the player making the guess
  • guess - The guessed number (1-10)
fn make_guess(
    env: soroban_sdk::Env,
    session_id: u32,
    player: soroban_sdk::Address,
    guess: u32,
) -> Result<(), soroban_sdk::Error>

Start a new game between two players with FP wagers. This creates a session in Blendizzard and locks FP before starting the game.

CRITICAL: This method requires authorization from THIS contract (not players). Blendizzard will call game_id.require_auth() which checks this contract's address.

Arguments

  • session_id - Unique session identifier (u32)
  • player1 - Address of first player
  • player2 - Address of second player
  • player1_wager - FP amount player1 is wagering
  • player2_wager - FP amount player2 is wagering
fn start_game(
    env: soroban_sdk::Env,
    session_id: u32,
    player1: soroban_sdk::Address,
    player2: soroban_sdk::Address,
    player1_wager: i128,
    player2_wager: i128,
) -> Result<(), soroban_sdk::Error>

Initialize the contract with Blendizzard address and admin

Arguments

  • admin - Admin address (can upgrade contract)
  • blendizzard - Address of the Blendizzard contract
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    blendizzard: soroban_sdk::Address,
)

Reveal the winner of the game and submit outcome to Blendizzard. Can only be called after both players have made their guesses. This generates the winning number, determines the winner, and ends the session.

Arguments

  • session_id - The session ID of the game

Returns

  • Address - Address of the winning player
fn reveal_winner(
    env: soroban_sdk::Env,
    session_id: u32,
) -> Result

Get the current Blendizzard contract address

Returns

  • Address - The Blendizzard contract address
fn get_blendizzard(env: soroban_sdk::Env) -> soroban_sdk::Address

Set a new Blendizzard contract address

Arguments

  • new_blendizzard - The new Blendizzard contract address
fn set_blendizzard(env: soroban_sdk::Env, new_blendizzard: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶