Contract 6e92cf3881626f2390343b37ac74eeb2abffec72459b274e68c4f8de2cfed793

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.96.0

Interface

Read the configured admin (the account that funded the contract).

fn admin(env: soroban_sdk::Env) -> Option

Submit a guess. Returns Ok(true) if the guess matches and the caller has been rewarded, Ok(false) on a wrong guess. Returns:

  • Err(InvalidGuess) if the guess is outside 1..=5.
  • Err(InsufficientRewardFunds) if the contract cannot pay the full 10 XLM reward (no transfer, no reset).
  • Err(FailedToTransferReward) if the token transfer itself fails.

On a correct guess the contract pays 10 XLM to the guesser and immediately rolls a new random number for the next round.

fn guess(
    env: soroban_sdk::Env,
    user_number: u64,
    guesser: soroban_sdk::Address,
) -> Result

Constructor.

admin funds the contract with INITIAL_FUNDING_XLM XLM out of its own balance (the deployer should friendbot the admin first). xlm is the address of the XLM Stellar Asset Contract on the target network — the deployer supplies it explicitly so the contract stays network-agnostic.

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    xlm: soroban_sdk::Address,
)

Imports

WebAssembly Text (WAT) ▶