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