Contract 888b330e4df6bc388de71b0b0a9889d605c74fb7533ac5d1bf2c32d3649cb985

← Back to Index 📥 Download WASM

Meta

rssdkver 23.4.0#673d6c4f2368d282d25da29bda55c21b8be69ca6
rsver 1.90.0

Instances

  • CAOYBUZIFHPHGLVUQHYCLJ7BG4KCNH4D6NBMYY6GVI4UBBCD7526NOM3

Interface

Check if the spending limit policy can be enforced.

Verifies that the transaction amount does not exceed the remaining spending limit for the current time period.

Returns

  • true if the spending limit allows the transaction
  • false otherwise
fn can_enforce(
    env: soroban_sdk::Env,
    context: Context,
    authenticated_signers: soroban_sdk::Vec,
    context_rule: ContextRule,
    smart_account: soroban_sdk::Address,
) -> bool

Enforce the spending limit policy.

Records the transaction amount and updates the spending history. This is called after can_enforce returns true.

fn enforce(
    env: soroban_sdk::Env,
    context: Context,
    authenticated_signers: soroban_sdk::Vec,
    context_rule: ContextRule,
    smart_account: soroban_sdk::Address,
)

Install the spending limit policy for a smart account.

Stores the spending limit configuration for the given context rule.

fn install(
    env: soroban_sdk::Env,
    install_params: SpendingLimitAccountParams,
    context_rule: ContextRule,
    smart_account: soroban_sdk::Address,
)

Uninstall the spending limit policy for a smart account.

Removes the spending limit configuration and history for the given context rule.

fn uninstall(
    env: soroban_sdk::Env,
    context_rule: ContextRule,
    smart_account: soroban_sdk::Address,
)

Get the current spending limit data for a smart account

fn get_spending_limit_data(
    env: soroban_sdk::Env,
    context_rule_id: u32,
    smart_account: soroban_sdk::Address,
) -> SpendingLimitData

Set a new spending limit for a smart account

fn set_spending_limit(
    env: soroban_sdk::Env,
    spending_limit: i128,
    context_rule: ContextRule,
    smart_account: soroban_sdk::Address,
)

Imports

WebAssembly Text (WAT) ▶