Read the configured admin (the account that funded the contract).
fn admin(env: soroban_sdk::Env) -> Option
Submit a guess. The caller must first authorize a 0.1 XLM transfer to the contract as the cost of playing.
Returns:
Ok("correct") if the guess matches — the contract pays the
0.5 XLM reward to the guesser and rolls a new random number.Ok("incorrect") if the guess does not match — the bet stays
in the contract and the number is NOT rolled.Errors (all state changes are rolled back atomically by Soroban):
Err(InvalidGuess) if the guess is outside 1..=5.Err(FailedToTransferBet) if the 0.1 XLM bet could not be pulled
from the guesser.Err(InsufficientRewardFunds) if the contract cannot pay the
full 0.5 XLM reward on a correct guess.Err(FailedToTransferReward) if the reward transfer itself
fails.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 fund 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,
)