Contract 699dfd1ae67575da411f086ee86799ea76db953f3c5117de82fb6466eac8fe87

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.94.1

Instances

  • CB42V5HDIQWE74RKZWLVKCZQDJJL4E266FTESO6NMX4JFZ43OVZSKLOW

Interface

Burn ZMOKE owned by the caller. ZmokeAgent calls this when a user redeems 1000 ZMOKE for $1 store credit.

fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)

Mint ZMOKE rewards to an address.

Only callable by the current admin. ZmokeAgent enforces the 10 ZMOKE/$1 rate upstream — this contract does not re-validate business logic.

Amounts are in the smallest unit (10^decimal): mint 10 ZMOKE → amount = 100_000_000 (10 × 10^7)

fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Return the current admin address. Exposed so the TypeScript client can confirm distributor configuration.

fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    expiration_ledger: u32,
)
fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128

Admin-gated in-place Wasm upgrade (CAP-0054). Preserves the contract ID and all persistent + instance storage (balances, admin key, token metadata, allowances).

Without this entrypoint, any Phase 4.5 re-deploy path would mint a new contract ID and orphan every ZMOKE balance permanently — which is survivable on testnet (we patch wrangler.jsonc and move on) but catastrophic on mainnet.

Workflow: stellar contract install uploads the new Wasm blob and returns its sha256 hash; this function swaps the running contract's code to that hash. Caller must be the current admin.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn decimals(env: soroban_sdk::Env) -> u32
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::MuxedAddress,
    amount: i128,
)
fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)

Transfer admin authority. Emits set_admin event.

fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

CAP-0058 atomic constructor. Runs exactly once inside the deploy transaction — no two-step window, no front-run vector.

Do NOT re-add an "already initialized" guard; the protocol guarantees single-call semantics by construction and the check would consume CPU budget on every deploy for no safety gain.

Arguments

  • admin — The address authorized to mint (ZmokeAgent's distributor key)
  • decimal — Token precision. Use 7 to match XLM/USDC Stellar conventions.
  • name — Full token name, e.g. "ZMOKE Loyalty Token"
  • symbol — Ticker, e.g. "ZMOKE"
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    decimal: u32,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
)
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Imports

WebAssembly Text (WAT) ▶