Contract 4435bfab3881f4e660592ee167fd0e6755674341ab371e1a3a36cc2df64a86b2

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.93.0

Instances

  • CBTDB7A3MZNBH7GRCFUZTQM3QESUHPLAVFJQ43Z2LQAEVAH5Z3AG3NDG

Interface

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

Gateway (admin) charges a user's credit for API usage. Charged funds become treasury revenue (they stay in the contract). Returns the user's new balance.

fn debit(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amount: i128,
) -> Result
fn token(env: soroban_sdk::Env) -> soroban_sdk::Address
fn paused(env: soroban_sdk::Env) -> bool
fn balance(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Admin sweeps accumulated treasury revenue to a wallet. Returns remaining treasury.

fn collect(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result

Agent/user deposits USDC and receives API credit 1:1. Returns the new credit balance.

fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount: i128,
) -> Result
fn treasury(env: soroban_sdk::Env) -> i128

User reclaims unused credit back to their wallet as USDC. Returns new balance.

fn withdraw(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amount: i128,
) -> Result

Rotate the admin (gateway operator) key. Emits an event for auditability.

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

Incident switch: pausing blocks new deposits and gateway debits, but NEVER withdrawals — users can always exit with their balance.

fn set_paused(env: soroban_sdk::Env, paused: bool)

Initialize once at deploy time (Protocol 22+ constructor — cannot be re-run).

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

Imports

WebAssembly Text (WAT) ▶