Contract 19173258dc8d5cd819032df3f6fb031e57545d044848b9b288acafb39d051496

← Back to Index 📥 Download WASM

Meta

rssdkver 25.1.1#94c2a3b3a5ded6b9cf9cef0c207bf8804f3eb294
rsver 1.94.0
source_repo lumenbro/soroban-policies

Instances

  • CBRGH27ZFVFDIHYKC4K3CSLKXHQSR5CFG2PLPZ2M37NH4PYBOBTTQAEC
  • CCRIFGLMG3PT7R3V2IFSRNDNKR2Y2DLJAI5KXYBKNJPFCL2QC4MDIZNJ
  • CCSPAXNEVBNA5QAEU2YEUTU56O5KOZM4C2O7ONQ6GFPSHEWV5OJJS5H2

Interface

Admin: kill switch — immediately blocks ALL is_authorized calls. Pausing one policy instance only affects signers using that instance.

fn pause(env: soroban_sdk::Env)
fn on_add(env: soroban_sdk::Env, source: soroban_sdk::Address)

Admin: unpause — re-enables is_authorized checks.

fn unpause(env: soroban_sdk::Env)

View: cached price for a token (0 if not set).

fn get_price(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128

View: whether the policy is currently paused.

fn is_paused(env: soroban_sdk::Env) -> bool
fn on_revoke(env: soroban_sdk::Env, source: soroban_sdk::Address)

View: remaining USDC-equivalent budget for a signer today.

fn remaining(env: soroban_sdk::Env, signer: soroban_sdk::Address) -> i128

Admin: update the daily limit (in USDC stroops).

fn set_limit(env: soroban_sdk::Env, new_limit: i128)

Admin: set cached price for a token.

usdc_per_unit = how many USDC stroops you get for 1e7 (1.0) token units. Example: XLM at $0.15 → usdc_per_unit = 1_500_000

fn set_price(env: soroban_sdk::Env, token: soroban_sdk::Address, usdc_per_unit: i128)

One-time initialization. Sets admin, USDC contract, optional router, and daily limit.

  • daily_limit_usdc: limit in USDC stroops (e.g. 500_0000000 = $500)
  • router: Soroswap router address for live price fallback. Pass the contract's own address as a sentinel if no router is available.
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    usdc: soroban_sdk::Address,
    router: soroban_sdk::Address,
    daily_limit_usdc: i128,
)

Admin: batch-set prices for multiple tokens at once.

fn set_prices(
    env: soroban_sdk::Env,
    tokens: soroban_sdk::Vec,
    prices_vec: soroban_sdk::Vec,
)

Admin: update the router address.

fn set_router(env: soroban_sdk::Env, router: soroban_sdk::Address)

View: current daily limit.

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

View: USDC-equivalent spent today by a signer.

fn spent_today(env: soroban_sdk::Env, signer: soroban_sdk::Address) -> i128
fn is_authorized(
    env: soroban_sdk::Env,
    source: soroban_sdk::Address,
    contexts: soroban_sdk::Vec,
) -> bool

Imports

WebAssembly Text (WAT) ▶