Contract f1c549e2491e0f8d9cc7683f6056da2edd8a8c3d6786723ab1c86dae74a96b0e

← Back to Index 📥 Download WASM

Meta

rssdk_spec_shaking 2
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.94.1

Instances

  • CDASVYLQISK4WX7NC6C3GTUSYVZFOWQHSPWVGRP6R4COVQ2DK4K2SFBV

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,
)

Completa la inicialización del Smart Account: persiste signers + verifiers en storage e instala las 3 context rules base (biometric-tx × N + admin-cfg

  • sep10-auth).

Solo puede llamarse UNA VEZ y solo por el deployer registrado en __constructor. Tras el éxito, el storage de Deployer se borra y el flag Initialized se setea — futuras llamadas a bootstrap panican.

Arguments

  • owner_ed25519 — Pubkey ed25519 reconstruida F1+F2+F3 (32 bytes).
  • email_commitmentsha256(email || salt) (32 bytes).
  • secp256r1_pubkey — Pubkey del passkey (65 bytes uncompressed).
  • ed25519_verifier — Address del Ed25519Verifier compartido.
  • secp256r1_verifier — Address del Secp256r1Verifier compartido.
  • spending_limit_policy — Address del SpendingLimitPolicy compartido.
  • spending_limit_params — XDR SpendingLimitAccountParams.
  • tx_targets — Vec de SAC addresses para spending-limit. Vacío → solo 2 rules base (admin-cfg + sep10-auth); el ba
fn bootstrap(
    env: soroban_sdk::Env,
    owner_ed25519: soroban_sdk::BytesN<32>,
    email_commitment: soroban_sdk::BytesN<32>,
    secp256r1_pubkey: soroban_sdk::BytesN<65>,
    ed25519_verifier: soroban_sdk::Address,
    secp256r1_verifier: soroban_sdk::Address,
    spending_limit_policy: soroban_sdk::Address,
    spending_limit_params: soroban_sdk::Val,
    tx_targets: soroban_sdk::Vec,
)

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>

Crea el Smart Account v3 con storage mínimo. Solo guarda el deployer autorizado para llamar a bootstrap().

Esta separación deploy/bootstrap es por el cap de txWriteBytes de Soroban protocol 27 (132KB). Un constructor que invocara setup_context_rules tocaría las WASMs de los 2 verifiers (~47KB) + la WASM del SA (~91KB) + storage = ~163KB, sobre el cap. Splitea:

  • Deploy (__constructor): SA WASM + 1 storage entry → ~95KB ✓
  • Bootstrap: verifiers como readOnly + rules/signers data → ~30KB ✓

Arguments

  • deployer — Address que firmó el createContract. Es el único que puede llamar bootstrap() para completar la inicialización. En el backend de Accesly esto es siempre channels-fund.
fn __constructor(env: soroban_sdk::Env, deployer: soroban_sdk::Address)

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)

Rota los signers principales del Smart Account en una sola tx atómica.

Pieza clave del flujo de recovery v2:

  1. SDK reconstruye seed con F2+F3 (sin device).
  2. SDK registra un new passkey + genera nuevo Shamir → F1', F2', F3'.
  3. SDK firma esta tx con la seed VIEJA (sigue válida hasta rotate).
  4. Soroban valida la firma contra admin-cfg rule.
  5. Esta función rota:
  • owner_ed25519 en todas las reglas biometric-tx + admin-cfg
  • secp256r1_pubkey en sep10-auth
  • email_commitment en storage
  1. Emite SignerRotated event para audit trail del backend.

Auth

Requiere que el Smart Account autorice (via context rule admin-cfg).

fn rotate_signer(
    env: soroban_sdk::Env,
    new_owner_ed25519: soroban_sdk::BytesN<32>,
    new_secp256r1_pubkey: soroban_sdk::BytesN<65>,
    new_email_commitment: soroban_sdk::BytesN<32>,
)

Devuelve true si bootstrap() ya fue llamado y el SA está operativo.

fn is_initialized(env: soroban_sdk::Env) -> bool

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

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

Cierra un flow de rotate particionado — pieza 2 (final) de v3.2.0.

Persiste email_commitment en storage y emite SignerRotated con el set completo de nuevos identificadores. NO toca ningún rule; asume que las calls previas a rotate_signer_partial ya cubrieron todas las rules que tenían el signer viejo.

Auth

Requiere admin-cfg firmado por el nuevo owner ed25519 (las calls previas ya migraron al menos la rule admin-cfg). Este check funciona como safety net contra un caller que llame finalize_rotation sin haber ejecutado el batch completo.

fn finalize_rotation(
    env: soroban_sdk::Env,
    new_owner_ed25519: soroban_sdk::BytesN<32>,
    new_secp256r1_pubkey: soroban_sdk::BytesN<65>,
    new_email_commitment: soroban_sdk::BytesN<32>,
)

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)

Devuelve el email_commitment actual (útil para auditoría off-chain). Devuelve zeros si el SA aún no se bootstrappeó.

fn get_email_commitment(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>

Rota el signer de un subconjunto de rules — pieza 1 del flow de recovery particionado (v3.2.0, Fase T).

Diseñada para wallets con 4+ context rules donde el rotate_signer atómico excede el cap P27 de txWriteBytes (132KB). El caller (SDK) enumera las rules on-chain, agrupa por batches que caben bajo el cap (~2-3 rules por batch en la práctica), y llama esta función N veces. Termina con finalize_rotation para persistir email_commitment y emitir SignerRotated.

Estado intermedio

Durante la ventana entre el primer rotate_signer_partial y el finalize_rotation, algunas rules apuntan al signer viejo y otras al nuevo. Ambos pueden firmar mientras dure ese estado — es responsabilidad del SDK completar el flow en el mismo commit lógico. Si el SDK falla entre calls, retry hasta cerrar la rotación con finalize_rotation.

Auth

Requiere admin-cfg. La primera call se autoriza con el signer viejo; las siguientes también, mientras admin-cfg aún tenga el viejo. Si el caller decidió incluir `a

fn rotate_signer_partial(
    env: soroban_sdk::Env,
    rule_ids: soroban_sdk::Vec,
    new_owner_ed25519: soroban_sdk::BytesN<32>,
    new_secp256r1_pubkey: soroban_sdk::BytesN<65>,
)

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

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) ▶