Read current nonce (monotonic).
fn get_nonce(env: soroban_sdk::Env) -> u64
Read the stored passkey pubkey (for debugging/verification).
fn get_passkey(env: soroban_sdk::Env) -> soroban_sdk::BytesN<65>
Constructor: Automatically called during deployment Initializes the contract with the passkey secp256r1 public key (65-byte uncompressed), the DeFindex vault contract address, and the USDC token address.
fn __constructor(
env: soroban_sdk::Env,
passkey_pubkey: soroban_sdk::BytesN<65>,
vault_address: soroban_sdk::Address,
usdc_token: soroban_sdk::Address,
)
Transfer USDC from this contract to a recipient address. Only the registered passkey can authorize.
auth_data and client_data_json come from the WebAuthn assertion.
The signature is over SHA256(auth_data || SHA256(client_data_json)).
The challenge inside client_data_json must equal SHA256("transfer_usdc" | amount | nonce).
fn transfer_usdc(
env: soroban_sdk::Env,
recipient: soroban_sdk::Address,
amount: i128,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
)
Get the fee rates (vault_fee, protocol_fee) in basis points.
fn get_vault_fees(env: soroban_sdk::Env) -> (u32, u32)
Deposit assets into the DeFindex vault. Only the registered passkey can authorize.
auth_data and client_data_json come from the WebAuthn assertion.
The signature is over SHA256(auth_data || SHA256(client_data_json)).
The challenge inside client_data_json must equal:
SHA256("deposit" || amount1_le || amount2_le || ... || nonce_le)
fn deposit_to_vault(
env: soroban_sdk::Env,
amounts_desired: soroban_sdk::Vec,
amounts_min: soroban_sdk::Vec,
invest: bool,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
) -> (soroban_sdk::Vec, i128)
Get the assets managed by the vault.
fn get_vault_assets(env: soroban_sdk::Env) -> soroban_sdk::Vec
Read the stored vault contract address.
fn get_vault_address(env: soroban_sdk::Env) -> soroban_sdk::Address
Withdraw assets from the DeFindex vault. Only the registered passkey can authorize.
auth_data and client_data_json come from the WebAuthn assertion.
The signature is over SHA256(auth_data || SHA256(client_data_json)).
The challenge inside client_data_json must equal:
SHA256("withdraw" || withdraw_shares_le || nonce_le)
fn withdraw_from_vault(
env: soroban_sdk::Env,
withdraw_shares: i128,
min_amounts_out: soroban_sdk::Vec,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
) -> soroban_sdk::Vec
Get the asset amounts corresponding to a given number of vault shares.
fn get_vault_amounts_per_shares(
env: soroban_sdk::Env,
vault_shares: i128,
) -> soroban_sdk::Vec
Get the total managed funds of the vault.
fn get_vault_total_managed_funds(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec