Contract b9691a1928d603162bcc8ce360c28c64134e37c53be8b1fcd03c91f1a73e5784

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.95.0

Instances

  • CCV5LP3EWRSH4AGPRCYVXLIH7RY7OJOLAMN75P56BO67SAPPPXYJVKNW

Interface

Pause all charge operations (emergency stop)

fn pause(env: soroban_sdk::Env)

Pull tokens for fixed subscription (triggered by backend relayer). User must have called token.approve(contract_address, amount, expiry_ledger) beforehand.

fn charge(
    env: soroban_sdk::Env,
    auth_id: soroban_sdk::BytesN<32>,
    amount: i128,
    invoice_id: soroban_sdk::BytesN<32>,
)

User revokes their own authorization. Separate events per type so indexers can subscribe without a storage lookup.

fn revoke(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    auth_id: soroban_sdk::BytesN<32>,
    is_metered: bool,
)

Unpause charge operations

fn unpause(env: soroban_sdk::Env)
fn get_auth(
    env: soroban_sdk::Env,
    auth_id: soroban_sdk::BytesN<32>,
) -> Option
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn is_paused(env: soroban_sdk::Env) -> bool

Initialize roles and global config. Must be signed by admin to prevent front-running between deploy and init.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    collector: soroban_sdk::Address,
    charger: soroban_sdk::Address,
)

Admin can update the collector/charger. Emits separate events so indexers see the old→new transition.

fn set_config(
    env: soroban_sdk::Env,
    collector: Option,
    charger: Option,
)

Create fixed recurring authorization. User must authorize this call AND must separately call token.approve(contract_address, cap, expiry_ledger).

fn create_auth(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    auth_id: soroban_sdk::BytesN<32>,
    merchant_id: soroban_sdk::BytesN<32>,
    token: soroban_sdk::Address,
    cap: i128,
    max_per_charge: i128,
    next_due: u64,
    period: u64,
    expiry: u64,
)
fn get_charger(env: soroban_sdk::Env) -> soroban_sdk::Address

Step 2 of admin transfer: proposed admin accepts the role. Guards against typos in propose_admin since only the real keyholder can accept.

fn accept_admin(env: soroban_sdk::Env)
fn get_collector(env: soroban_sdk::Env) -> soroban_sdk::Address

Step 1 of admin transfer: current admin proposes new admin.

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

Cancel a pending upgrade.

fn cancel_upgrade(env: soroban_sdk::Env)

Pull tokens for metered subscription.

fn charge_metered(
    env: soroban_sdk::Env,
    auth_id: soroban_sdk::BytesN<32>,
    amount: i128,
    invoice_id: soroban_sdk::BytesN<32>,
)

Create cycle-based metered authorization. User must separately call token.approve(contract_address, total_allowance, expiry_ledger).

fn create_metered(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    auth_id: soroban_sdk::BytesN<32>,
    merchant_id: soroban_sdk::BytesN<32>,
    token: soroban_sdk::Address,
    total_allowance: i128,
    max_per_charge: i128,
    total_cycles: u32,
)

Step 2 of upgrade: execute after timelock elapses.

fn execute_upgrade(env: soroban_sdk::Env)

Step 1 of upgrade: admin proposes a new WASM hash. Executable after UPGRADE_DELAY.

fn propose_upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn get_metered_auth(
    env: soroban_sdk::Env,
    auth_id: soroban_sdk::BytesN<32>,
) -> Option
fn get_pending_admin(env: soroban_sdk::Env) -> Option
fn get_pending_upgrade(env: soroban_sdk::Env) -> Option

Cancel a pending admin proposal (current admin only).

fn cancel_admin_transfer(env: soroban_sdk::Env)

Imports

WebAssembly Text (WAT) ▶