Contract fd59a72482bb2e9f619c374556b7865f0eaac396b7663e8067f2ffefb3938894

← Back to Index 📥 Download WASM

Meta

cliver 28.0.0#300aaf69ab100536678bdb641428b06f06b318ea
rssdk_spec_shaking 2
rssdkver 26.1.1#8ac18efb681a1c0b4b85a38c5a380300344e3f39
rsver 1.94.1

Instances

  • CAPWH2L7YVV627WXNGN2ST4QPXZIDPDZ35WVRBLPUMZGFRMG4AGQI726
  • CBA3PCQKWZHU7SN33QMP5MPBFNMKSBSAGG65KORFN36URT2K5C5ZN3N7
  • CBK4YKR43Q5O24O5HKGISBDJANG7OXW4IHUYMWO7SOUHNL6JCHWQK26V
  • CCT5ULIAWDDFAMX4R5THTT2T5CZ76PRLD2QZJTDGCQJL4MSR2CMM27CS
  • CD5OXHIY3CI5EQPF6LOENE54N2BCWWCEXEBT675GZSTZX5CQNISWXSFM
  • CDJHYYBAD6BPT5QSLBKNPVTP3YU6KL5VUAVMZN5K2QXGWE5YOAW55CXQ

Interface

Executes a function call on a target contract from within the smart account context.

Arguments

  • e - Access to the Soroban environment.
  • target - The address of the contract to call.
  • target_fn - The function name to invoke on the target contract.
  • target_args - Arguments to pass to the target function.

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then calling e.invoke_contract().

fn execute(
    env: soroban_sdk::Env,
    target: soroban_sdk::Address,
    target_fn: soroban_sdk::Symbol,
    target_args: soroban_sdk::Vec,
)
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)

Adds a new policy to an existing context rule, installs it, and returns the assigned policy ID. The policy's install method will be called during this operation.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to modify.
  • policy - The address of the policy contract to add.
  • install_param - The installation parameter for the policy.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
  • [SmartAccountError::DuplicatePolicy] - When the policy already exists in the rule.
  • [SmartAccountError::TooManyPolicies] - When adding would exceed MAX_POLICIES (5).

Events

  • topics - ["policy_added", context_rule_id: u32]
  • data - [policy_id: u32]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::add_policy].

fn add_policy(
    env: soroban_sdk::Env,
    context_rule_id: u32,
    policy: soroban_sdk::Address,
    install_param: soroban_sdk::Val,
) -> u32

Adds a new signer to an existing context rule, returning the assigned signer ID.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to modify.
  • signer - The signer to add to the context rule.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
  • [SmartAccountError::DuplicateSigner] - When the signer already exists in the rule.
  • [SmartAccountError::TooManySigners] - When adding would exceed MAX_SIGNERS (15).

Events

  • topics - ["signer_added", context_rule_id: u32]
  • data - [signer_id: u32]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::add_signer].

fn add_signer(env: soroban_sdk::Env, context_rule_id: u32, signer: Signer) -> u32
fn __check_auth(
    env: soroban_sdk::Env,
    signature_payload: soroban_sdk::BytesN<32>,
    signatures: AuthPayload,
    auth_contexts: soroban_sdk::Vec,
) -> Result<(), SmartAccountError>

Contract constructor — invoked exactly once by the host as part of create_contract_v2 (deploy_v2) and never callable afterward, so it needs no "already initialized" guard or require_auth: the deploying transaction authorizes the whole creation, and the host will not dispatch a later invocation to __constructor. Installs the initial Default context rule with the deployer-supplied signers/policies.

fn __constructor(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    policies: soroban_sdk::Map,
)

Retrieves the global registry ID for a policy.

Arguments

  • e - Access to the Soroban environment.
  • policy - The policy address to look up.

Errors

  • [SmartAccountError::PolicyNotFound] - When the policy is not registered in the global registry.
fn get_policy_id(env: soroban_sdk::Env, policy: soroban_sdk::Address) -> u32

Retrieves the global registry ID for a signer.

Arguments

  • e - Access to the Soroban environment.
  • signer - The signer to look up.

Errors

  • [SmartAccountError::SignerNotFound] - When the signer is not registered in the global registry.
fn get_signer_id(env: soroban_sdk::Env, signer: Signer) -> u32

Removes a policy from an existing context rule and uninstalls it. The policy's uninstall method will be called during this operation. Removing the last policy is allowed only if the rule has at least one signer.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to modify.
  • policy_id - The ID of the policy to remove from the context rule.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
  • [SmartAccountError::PolicyNotFound] - When the policy doesn't exist in the rule.

Events

  • topics - ["policy_removed", context_rule_id: u32]
  • data - [policy_id: u32]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::remove_policy].

fn remove_policy(env: soroban_sdk::Env, context_rule_id: u32, policy_id: u32)

Removes a signer from an existing context rule. Removing the last signer is allowed only if the rule has at least one policy.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to modify.
  • signer_id - The ID of the signer to remove from the context rule.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
  • [SmartAccountError::SignerNotFound] - When the signer doesn't exist in the rule.

Events

  • topics - ["signer_removed", context_rule_id: u32]
  • data - [signer_id: u32]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::remove_signer].

fn remove_signer(env: soroban_sdk::Env, context_rule_id: u32, signer_id: u32)

Deploys a new contract owned by this account, deriving its address from this account (the deployer) and salt — the same primitive factory-contract uses to deploy accounts, just invoked from within an account instead of the factory.

Unlike batch_add_signer/upgrade, this method does not call e.current_contract_address().require_auth() itself. deploy_v2's underlying create_contract_with_constructor host function already requires authorization from the deployer address — since with_current_contract makes that deployer this account itself, the host produces a real CreateContractHostFn/CreateContractWithCtorHostFn auth context for __check_auth to validate against a stored CreateContract(wasm_hash) context rule. Adding an explicit self-require_auth() here as well would just demand a second, unrelated authorization (matched as a generic Context::Contract call to this function, gated by a Default/CallContract(self) rule instead) — that's what the other methods need, since non

fn deploy_contract(
    env: soroban_sdk::Env,
    wasm_hash: soroban_sdk::BytesN<32>,
    salt: soroban_sdk::BytesN<32>,
    constructor_args: soroban_sdk::Vec,
) -> soroban_sdk::Address

Creates a new context rule with the specified configuration, returning the newly created ContextRule with a unique ID assigned. Installs all specified policies during creation.

Arguments

  • e - Access to the Soroban environment.
  • context_type - The type of context this rule applies to.
  • name - Human-readable name for the context rule.
  • valid_until - Optional expiration ledger sequence.
  • signers - List of signers authorized by this rule.
  • policies - Map of policy addresses to their installation parameters.

Errors

  • [SmartAccountError::NoSignersAndPolicies] - When both signers and policies are empty.
  • [SmartAccountError::TooManySigners] - When signers exceed MAX_SIGNERS (15).
  • [SmartAccountError::TooManyPolicies] - When policies exceed MAX_POLICIES (5).
  • [SmartAccountError::DuplicateSigner] - When the same signer appears multiple times.
  • [SmartAccountError::PastValidUntil] - When valid_until is in the past.
  • [SmartAccountError::MathOverflow] - When the context rule, si
fn add_context_rule(
    env: soroban_sdk::Env,
    context_type: ContextRuleType,
    name: soroban_sdk::String,
    valid_until: Option,
    signers: soroban_sdk::Vec,
    policies: soroban_sdk::Map,
) -> ContextRule
fn batch_add_signer(
    env: soroban_sdk::Env,
    context_rule_id: u32,
    signers: soroban_sdk::Vec,
)

Retrieves a context rule by its unique ID, returning the ContextRule containing all metadata, signers, and policies.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The unique identifier of the context rule to retrieve.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
fn get_context_rule(env: soroban_sdk::Env, context_rule_id: u32) -> ContextRule

Removes a context rule and cleans up all associated data. This function uninstalls all policies associated with the rule and removes all stored data including signers, policies, and metadata.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to remove.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.

Events

  • topics - ["context_rule_removed", context_rule_id: u32]
  • data - []

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::remove_context_rule].

fn remove_context_rule(env: soroban_sdk::Env, context_rule_id: u32)

Returns the index-th contract this account has deployed via deploy_contract, in deployment order.

Errors

  • [LatchSmartAccountError::DeployedContractNotFound] - If no deployed contract is recorded at index.
fn get_deployed_contract(env: soroban_sdk::Env, index: u32) -> DeployedContract

Retrieves the number of all context rules, including expired rules. Defaults to 0.

Arguments

  • e - Access to the Soroban environment.
fn get_context_rules_count(env: soroban_sdk::Env) -> u32

Updates the name of an existing context rule, returning the updated ContextRule with the new name.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to update.
  • name - The new human-readable name for the context rule.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.

Events

  • topics - ["context_rule_meta_updated", context_rule_id: u32]
  • data - [name: String, context_type: ContextRuleType, valid_until: Option<u32>]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::update_context_rule_name].

fn update_context_rule_name(
    env: soroban_sdk::Env,
    context_rule_id: u32,
    name: soroban_sdk::String,
) -> ContextRule

Returns the number of contracts this account has deployed via deploy_contract. Defaults to 0.

fn get_deployed_contract_count(env: soroban_sdk::Env) -> u32

Updates the expiration time of an existing context rule, returning the updated ContextRule with the new expiration time.

Arguments

  • e - Access to the Soroban environment.
  • context_rule_id - The ID of the context rule to update.
  • valid_until - New optional expiration ledger sequence. Use None for no expiration.

Errors

  • [SmartAccountError::ContextRuleNotFound] - When no context rule exists with the given ID.
  • [SmartAccountError::PastValidUntil] - When valid_until is in the past.

Events

  • topics - ["context_rule_meta_updated", context_rule_id: u32]
  • data - [name: String, context_type: ContextRuleType, valid_until: Option<u32>]

Notes

Defaults to requiring authorization from the smart account itself (e.current_contract_address().require_auth()) and then delegating to [storage::update_context_rule_valid_until].

fn update_context_rule_valid_until(
    env: soroban_sdk::Env,
    context_rule_id: u32,
    valid_until: Option,
) -> ContextRule

Imports

WebAssembly Text (WAT) ▶