Initialize the mixer contract.
relayer: address authorized to submit withdrawals on behalf of recipients.token: SAC address for the deposited asset (native XLM on testnet:
CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC).fn init(env: soroban_sdk::Env)
Record a commitment in the Merkle tree.
The token transfer is handled separately by the frontend — the user
calls the SAC's transfer() directly to fund the contract, then
calls this function to store the commitment on-chain.
This keeps the deposit function free of amount information.
fn deposit(
env: soroban_sdk::Env,
depositor: soroban_sdk::Address,
commitment: soroban_sdk::BytesN<32>,
) -> u32
fn is_spent(env: soroban_sdk::Env, nullifier_hash: soroban_sdk::BytesN<32>) -> bool
Withdraw XLM from the mixer to a recipient.
Called by the relayer AFTER verifying the ZK proof off-chain.
proof_amount is the BN254 field element from the ZK proof's public
inputs that encodes the withdrawal amount in stroops. The contract
derives the actual i128 amount by interpreting the lower 16 bytes of
the 32-byte big-endian field element.
The contract:
proof_amountfn withdraw(
env: soroban_sdk::Env,
nullifier_hash: soroban_sdk::BytesN<32>,
recipient: soroban_sdk::Address,
proof_amount: soroban_sdk::BytesN<32>,
)
fn get_token(env: soroban_sdk::Env) -> soroban_sdk::Address
fn get_balance(env: soroban_sdk::Env) -> i128
fn is_valid_root(env: soroban_sdk::Env, root: soroban_sdk::BytesN<32>) -> bool
fn get_next_index(env: soroban_sdk::Env) -> u32
fn get_latest_root(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>