Contract f0c3b6df2738aaf8f326cd3bf2aa801d594e36ddf7d811ff0aa196105452d707

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.91.0

Instances

  • CAH2QTP6HKF3XXJORLIDET2FFAR5VFMFDXHYV2JLRGZQO6DJCM4Z3QPX
  • CAXCYG36ZYR263O3GWAUT3H5ZPC4B6ZST76VDV62PMTGW6C452IUNMDN
  • CAYYFKAK47NDJSVGXFYY7PMN7ADAFX73M4AYR7RMOVTP6XBRQSFRDDXP
  • CBFH4OZUZEXO5UNTIHRNVFA4SHOK3B6FKZE2YBREUQOPJYUW5P4HPD3C
  • CBJOMGUALH76BYKZW7HYRVEPPG2IG5LDNESVUKNF6AVRMS4APJWL43S7
  • CBK2RYVKSXLTNSEQO6M42PHMKFQ665EOEF665I7QAPTP2EP6WEG6CVTF
  • CBYLTSUN5SKF2AGVINFUTOY5XWQDBOLZ32ILDJT4DI2OHHSWCVNGCW25
  • CC2VTMHCYFURZMYIV2XSDNBHQEKP3LN6GKXHTVSWLYUEGE446R247LEK
  • CC7SGHCDV6HMN3SVA25FLXLWIJTILMR2S5FLIE3EHCWQWCDFS3N3OG66
  • CCJ6CJBFR754YDPENS5QJ2FVUT6BT4VSOM4SKZI2Z2Y4Y2GEZXZJQAI6
  • CCJ75XHD4GZPJVO5RTFKXENLBGQROKO755SZYPIF6ZUCDNMYGIBKMPVB
  • CCTMJUB3OY7CP2TLTFHCONBVLKKY37LP5G2UBMBMIPH3AUFYFJWSR3QZ
  • CCV26YD3QR455GMDLAI3LV3MAVU7XQCPD5X56HEE6ZD2R45QXXZZRRVK
  • CDHQAR4WNBM5PKR7KTFYS7FM3WLIPVUVVGXEIB55HUBMFTLNSR5SNNCQ
  • CDNUGSLUTHZJ5X442QP3NYZC7P36TDPM6JI4SDF3I4PL5H32LZBRKQBI
  • CDOKI3FVDBLUDIXI5CK5F5XN2Z4PJYSJTTOTVL4OS57G6OENDZ3MH4W4
  • CDYQUJS6MOSK23XSJHGPRYFN52JORQT3LGCGPREZ7BQVA5GPW5NHWZPI

Interface

Spend wallet-held asset using spender authorization and stored allowance.

Auth:

  • Requires direct authorization from the spender address.

Effects:

  • Consumes allowance and transfers asset to the recipient.

Notes:

  • Rejects non-positive amounts. -spend_asset validates allowance, reduces it correctly, and transfers from wallet-controlled balance.
fn spend(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    to: soroban_sdk::Address,
) -> Result<(), WalletError>

Approve a spender to use wallet-held asset up to a given amount.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Writes or updates spender allowance for the specified asset.

Notes:

  • Rejects negative amounts.
  • Enforces the configured asset spend limit.
fn approve(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Deposit asset into the wallet.

Auth:

  • Requires authorization from the source address.

Effects:

  • Pulls asset from the source address into wallet-controlled balance.

Notes:

  • Rejects non-positive amounts. -take_asset transfers funds into the current contract context.
fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Result<(), WalletError>

Upgrade the current contract to the latest factory-approved wasm.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Retrieves the approved wallet wasm hash from the factory.
  • Replaces the currently deployed contract code with that version.

Notes:

  • Authorization payload is bound to the target wasm hash.
  • Replay protection is enforced through the wallet authorization flow.
fn upgrade(
    env: soroban_sdk::Env,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Withdraw asset from the wallet to a recipient.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Quotes and handles protocol transaction fees before withdrawal.
  • Transfers the requested asset amount from the wallet to the recipient.

Notes:

  • Rejects non-positive amounts.
  • Enforces the configured asset spend limit before withdrawal.
fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    amount: i128,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Returns the configured spend limit for an asset.

Audit note: Returning Option<i128> avoids overloading sentinel values (e.g. 0) and makes the semantics explicit:

  • Some(limit) → enforce the configured limit
  • None → no asset-specific limit configured
fn get_limit(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> Option

Return the linked external owner wallet, if set.

Effects:

  • Reads owner state from storage.

Notes:

  • Read-only helper.
fn get_owner(env: soroban_sdk::Env) -> Option

Return wallet balance for the specified asset.

Effects:

  • Reads asset balance associated with the wallet.

Notes:

  • Read-only helper.
fn get_balance(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> i128

Return the configured factory contract address, if set.

Effects:

  • Reads factory reference from storage.

Notes:

  • Read-only helper.
fn get_factory(env: soroban_sdk::Env) -> Option

Return the stored passkey, if configured.

Effects:

  • Reads passkey state from storage.

Notes:

  • Read-only helper.
fn get_passkey(env: soroban_sdk::Env) -> Option>

Invoke an external contract/dapp through the wallet.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Validates top-level token operations against configured spend limits.
  • Optionally validates and registers deep auth entries.
  • Performs an external contract call with the provided function and args.

Notes:

  • Payload binds owner authorization to the target contract, function, args, and optional deep auth payload.
  • Deep auth entries are authorized only after owner auth succeeds.
fn dapp_invoker(
    env: soroban_sdk::Env,
    contract_id: soroban_sdk::Address,
    func: soroban_sdk::Symbol,
    args: Option>,
    auth_vec: Option<
        soroban_sdk::Vec>,
    >,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Return the configured registry contract address, if set.

Effects:

  • Reads registry reference from storage.

Notes:

  • Read-only helper.
fn get_registry(env: soroban_sdk::Env) -> Option

Initialize wallet state and linked contract addresses.

Auth:

  • Intended to run once during wallet deployment/creation.

Effects:

  • Stores access keys and linked contract references.
  • Marks the wallet as initialized.

Notes:

  • Reverts if initialization was already completed.
fn __constructor(
    env: soroban_sdk::Env,
    challenge: soroban_sdk::BytesN<32>,
    passkey: soroban_sdk::BytesN<65>,
    passkey_sig: PasskeySignature,
    rpid_hash: soroban_sdk::BytesN<32>,
    bls_keys_pop: soroban_sdk::Vec,
    registry: soroban_sdk::Address,
    social_router: soroban_sdk::Address,
    fee_manager: soroban_sdk::Address,
    factory: soroban_sdk::Address,
    external_wallet: Option,
) -> Result<(), WalletError>

Return current allowance for a spender on a asset.

Effects:

  • Reads allowance state from storage.

Notes:

  • Read-only helper.
fn get_allowance(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Compute the authorization payload hash for a function call.

Effects:

  • Returns the payload derived from function name, args, and nonce.

Notes:

  • Read-only helper for off-chain signing flows.
  • Reviewers should confirm payload construction matches verification logic.
fn get_tx_payload(
    env: soroban_sdk::Env,
    func: soroban_sdk::String,
    args: soroban_sdk::Vec,
    valid_until_ledger: u32,
) -> Result, WalletError>

Return the configured fee manager contract address, if set.

Effects:

  • Reads fee manager reference from storage.

Notes:

  • Read-only helper.
fn get_fee_manager(env: soroban_sdk::Env) -> Option

Set a asset-specific spend limit. Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Stores a per-asset limit override.

Notes:

  • Rejects negative values.
  • Payload includes asset, limit, and nonce to prevent replay.
fn set_asset_limit(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    limit: i128,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Links a (platform, user_id) identity to this wallet in the registry.

Requires wallet authorization before forwarding the request to the registry. The mapping is used to associate an external identity (e.g. X, Discord, Telegram) with the current wallet address.

Validation of platform support, signature threshold, and identity ownership is enforced by the registry contract.

fn add_id_wallet_map(
    env: soroban_sdk::Env,
    user_id: soroban_sdk::String,
    platform_str: soroban_sdk::String,
    signatures: soroban_sdk::Vec,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Return the configured social router contract address, if set.

Effects:

  • Reads social router reference from storage.

Notes:

  • Read-only helper.
fn get_social_router(env: soroban_sdk::Env) -> Option

Set or replace the linked external owner wallet.

Auth:

  • Requires owner authorization through the wallet bls auth flow.

Effects:

  • Updates the stored external owner address.

Notes:

  • Payload includes the new address and nonce to prevent replay.
fn set_external_wallet(
    env: soroban_sdk::Env,
    external_wallet: soroban_sdk::Address,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Removes an existing (platform, user_id) identity mapping from the registry.

Requires wallet authorization before forwarding the request to the registry. This operation detaches the external identity from the current wallet address.

Registry-level validation ensures only valid and authorized removals occur.

fn remove_id_wallet_map(
    env: soroban_sdk::Env,
    user_id: soroban_sdk::String,
    platform_str: soroban_sdk::String,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Synchronizes wallet protocol dependencies from the currently configured factory.

SECURITY:

  • Dependencies are not accepted from caller input.
  • Reads approved protocol addresses directly from the trusted factory.
  • Keeps existing wallets aligned with current protocol configuration.
  • Synchronization is authenticated and nonce protected.
  • Updates only local dependency references and does not modify factory state.
fn sync_protocol_dependencies(
    env: soroban_sdk::Env,
    passkey_sig: Option,
    valid_until_ledger: u32,
) -> Result<(), WalletError>

Imports

WebAssembly Text (WAT) ▶