Upgrade the contract code in place. The contract id and all storage (active quests, fee balances) are preserved.
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
Contract release number; bump per deploy to verify upgrades landed.
fn version(env: soroban_sdk::Env) -> u32
fn get_quest(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result
Rotate the platform admin.
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn get_config(env: soroban_sdk::Env) -> Result
One-time platform setup.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
fee_bps: u32,
) -> Result<(), soroban_sdk::Error>
Pause or resume new activity (create/take). Settlement paths stay open by design — the admin must never be able to trap user funds.
fn set_paused(env: soroban_sdk::Env, paused: bool) -> Result<(), soroban_sdk::Error>
Lock an available quest for a scout.
The GPS radius is pre-checked off-chain by the backend before it builds this transaction.
fn take_quest(
env: soroban_sdk::Env,
scout: soroban_sdk::Address,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Navigator cancels an untaken quest and reclaims the escrow.
fn cancel_quest(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Create a quest and fund its escrow in a single invocation.
Transfers reward stroops from the navigator into the contract, so
every on-chain quest starts funded and Available.
fn create_quest(
env: soroban_sdk::Env,
navigator: soroban_sdk::Address,
quest_id: soroban_sdk::String,
token: soroban_sdk::Address,
reward: i128,
completion_deadline_secs: u64,
review_window_secs: u64,
) -> Result<(), soroban_sdk::Error>
Mark proof as submitted and start the navigator review window.
Proof media and GPS coordinates live off-chain; the backend validates them before building this transaction.
fn submit_proof(
env: soroban_sdk::Env,
scout: soroban_sdk::Address,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Navigator reclaims the escrow after the scout missed the completion deadline without submitting proof. Terminal for this quest.
fn claim_expired(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Admin withdraws accrued platform fees for a given escrow token.
fn withdraw_fees(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Reopen a quest whose scout missed the completion deadline, returning it
to Available so another scout can take it.
Permissionless by design: the backend sweeper calls this periodically, but anyone may. The escrow stays locked in the contract.
fn reopen_expired(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
fn get_fee_balance(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128
Navigator rejects the submission: refund the escrow to the navigator.
Terminal for this quest. reason_hash is the SHA-256 of the rejection
reason stored off-chain, kept on-chain for accountability.
fn reject_submission(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
reason_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
Navigator approves the submission: pay the scout reward − fee.
fn approve_submission(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Scout self-claims the payout after the navigator let the review window elapse without approving or rejecting (anti-fund-lock).
fn claim_after_review(
env: soroban_sdk::Env,
quest_id: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>