Contract 155eb31c1867254eacbf1b7a4755164d15cc6b6f939644705ab6b8df61579239

← Back to Index 📥 Download WASM

Meta

cliver 27.1.0#8e402ea28202950b272fbabc34caad4d2f64fe87
rssdkver 27.0.6#60926a20d1f9f0a669d5fe551636f42a1302f0c0
rsver 1.96.0

Instances

  • CB5LYXFKKTKDDSCM6JO6C4GNRQUFBGSLYDET6Q56JNFJQSMBKH6KWSYP

Interface

Agent-initiated payment, bounded by the policy.

The returned error is the product: it says exactly why the human-in-the-loop path should take over, in a form the caller can match on rather than parse.

fn pay(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>
fn owner(env: soroban_sdk::Env) -> soroban_sdk::Address

The current UTC day index, as the contract computes it.

fn today(env: soroban_sdk::Env) -> u64
fn token(env: soroban_sdk::Env) -> soroban_sdk::Address
fn frozen(env: soroban_sdk::Env) -> bool
fn balance(env: soroban_sdk::Env) -> i128
fn decimals(env: soroban_sdk::Env) -> u32
fn operator(env: soroban_sdk::Env) -> soroban_sdk::Address

Move funds out of the vault. Owner only, and not counted against the day, because a withdrawal is the owner reclaiming their own money rather than the agent spending it.

fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>
fn daily_cap(env: soroban_sdk::Env) -> i128

The owner settles a payment they approved out of band. Bypasses the ceiling, the allowlist and the freeze, because it is a human act. Still counts toward the daily cap, so the on-chain record of total outflow stays honest.

fn owner_pay(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>
fn is_allowed(env: soroban_sdk::Env, payee: soroban_sdk::Address) -> bool
fn set_frozen(env: soroban_sdk::Env, frozen: bool)
fn set_policy(
    env: soroban_sdk::Env,
    daily_cap: i128,
    auto_approve_max: i128,
    allowlist_enabled: bool,
) -> Result<(), soroban_sdk::Error>
fn set_allowed(env: soroban_sdk::Env, payee: soroban_sdk::Address, ok: bool)
fn spent_today(env: soroban_sdk::Env) -> i128
fn set_operator(
    env: soroban_sdk::Env,
    operator: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Deploy-time initialization. Runs once, atomically, and cannot be re-run.

Reading decimals() from the token here does double duty: it keeps the hot path free of a cross-contract call, and it means a token address that does not actually implement SEP-41 fails at deploy, before the vault has ever held anything.

fn __constructor(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    daily_cap: i128,
    auto_approve_max: i128,
)
fn auto_approve_max(env: soroban_sdk::Env) -> i128
fn allowlist_enabled(env: soroban_sdk::Env) -> bool
fn session_key_expiry(env: soroban_sdk::Env) -> u64

Grant, extend or revoke the session key by setting the Unix time after which the agent's pay stops working. A future time grants or extends, a past time (or the current one) revokes immediately, and 0 removes the time bound entirely. owner_pay is never time-bound.

fn set_session_key_expiry(env: soroban_sdk::Env, expiry: u64)

Imports

WebAssembly Text (WAT) ▶