Contract befa64d9d56feba32e18e09f1c364b8a4d863016337bb933ba12cc5c0a8e5b08

← Back to Index 📥 Download WASM

Meta

cliver 25.1.0#a048a57a75762458b487052e0021ea704a926bee
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.95.0
source_repo github:skyhitz/hitz-gravity

Instances

  • CBAPZAZNNB4X3VPXV2LYA5RMV7XHXIVREES2GG7R5GUXDZ4R4CKOY4EU

Interface

Burn tokens from caller's own balance. Vaulted accounts CANNOT burn (no exit route).

Lazy evaluation applies here too: if the protocol grew past the caller's balance between when they were vaulted and now, the first read re-syncs the flag and the burn proceeds. If they remain genuinely over L, the burn is blocked — burning would be a sneaky exit path (destroy HITZ to avoid sacrifice).

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

Mint new HITZ tokens. Only callable by admin.

TWO HARD GUARDS:

  1. Supply cap — refuses any mint that would push TotalSupply past MAX_SUPPLY (100,000,000 HITZ). This closes the historical "blank check" where mint had no upper bound.
  2. Integrity — if the recipient is a registered pool / router, its on-chain WASM must still match what was approved; a bytecode swap aborts the mint before any balance write.

"Roach Motel" semantics: within those guards, mint never fails due to vault logic. If the recipient breaches L they are silently vaulted.

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

SEP-41 approve: set allowance for a spender with expiration.

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

Check if an address is registered as an approved pool.

This is a pure read — it does NOT run the WASM integrity check. Use pool_wasm_hash to fetch the bound hash, or call any state-changing transfer / burn to trigger the enforced check.

fn is_pool(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Upgrade the contract WASM in-place. Admin-only.

TEMPORARY — to be removed before mainnet immutable deployment.

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::Address,
    amount: i128,
)

SEP-41 allowance: returns current allowance (0 if expired).

fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Burn tokens from another account via allowance. Vaulted accounts CANNOT be burned from (no exit route).

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

Check if an address is registered as an approved router. Pure read — see is_pool for the integrity-check semantics.

fn is_router(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Transfer admin role to a new address. Requires auth from BOTH current admin and new admin.

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

Initialize the Gravity HITZ token with admin, name, symbol. Decimals are fixed at 7 (Stellar standard).

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
)

Enumerate every currently-registered pool.

Authoritative, O(n) in the list size. Clients should prefer this over event-log scraping + localStorage heuristics — the list is updated in lockstep with every register_pool_address / remove_pool_address call, so it always reflects the current on-chain state regardless of RPC event retention windows.

fn list_pools(env: soroban_sdk::Env) -> soroban_sdk::Vec

The hard-coded supply cap in raw units (7 decimals). Equal to 100,000,000 HITZ.

fn max_supply(env: soroban_sdk::Env) -> i128

Returns the raw TotalMass accumulator (sum of approved pool balances).

fn total_mass(env: soroban_sdk::Env) -> i128

Enumerate every currently-registered router. See list_pools.

fn list_routers(env: soroban_sdk::Env) -> soroban_sdk::Vec

Returns the current Safety Limit L = sqrt(TotalMass × 10^decimals). O(1) — reads the pre-computed accumulator.

fn safety_limit(env: soroban_sdk::Env) -> i128

Circulating supply — sum of all outstanding balances. Always ≤ max_supply().

fn total_supply(env: soroban_sdk::Env) -> i128

SEP-41 transfer_from: delegated transfer via allowance. Same Roach Motel rules + lazy evaluation — vault check on from, not spender.

fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Returns the WASM hash the admin bound to pool at registration, or None if not registered. Off-chain observers can compare this to the pool's current on-chain executable to audit integrity without submitting a fee-bearing transaction. A returned value of all zeros means "classic account, no integrity binding".

fn pool_wasm_hash(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> Option>

Returns the WASM hash bound to router at registration, or None.

fn router_wasm_hash(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> Option>

Returns whether an account is currently vaulted.

NOTE: This is a passive read — it reflects the LAST WRITTEN flag. If the protocol has grown since the user was trapped, their real ("lazy-evaluated") status may be "safe" even though this returns true. The flag will be corrected the moment they transact. For a canonical realtime answer see would_be_vaulted_if(balance).

fn is_account_vaulted(env: soroban_sdk::Env, id: soroban_sdk::Address) -> bool

Canonical "is this account actually stuck right now?" query — evaluates the physics against their CURRENT balance and the CURRENT L. Independent of the stored flag.

Returns true iff the account is non-infrastructure and holds more than L. UIs can call this to decide whether to show the "vaulted" banner without relying on stale flags.

fn is_actually_vaulted(env: soroban_sdk::Env, id: soroban_sdk::Address) -> bool

Remove an address from the approved pools list. Admin-gated. The pool's current balance is subtracted from TotalMass.

fn remove_pool_address(env: soroban_sdk::Env, address: soroban_sdk::Address)

Register an address as an approved pool. Admin-gated. Pools affect TotalMass and are the ONLY destination vaulted users can send to (sacrifice mass to widen the road).

The current on-chain WASM hash of address is captured at registration and bound as the approved bytecode — any later in-place upgrade of the pool will trip the integrity check. For classic accounts (no WASM) a zero-hash sentinel is stored and the integrity check is skipped on subsequent state moves. Re-registering an existing pool rebinds the current hash — intended path after a deliberate, reviewed pool upgrade.

fn register_pool_address(env: soroban_sdk::Env, address: soroban_sdk::Address)

Remove an address from the approved routers list. Admin-gated.

fn remove_router_address(env: soroban_sdk::Env, address: soroban_sdk::Address)

Register an address as an approved router. Admin-gated. Routers are pass-through entities (DEX aggregators, swap contracts). They NEVER affect TotalMass and vaulted users CANNOT send to them.

The current on-chain WASM hash of address is captured at registration — see register_pool_address for the integrity semantics and the non-Wasm fallback.

fn register_router_address(env: soroban_sdk::Env, address: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶