Deposit tokens into the pool. Returns the leaf index.
fn deposit(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
commitment: soroban_sdk::U256,
) -> u32
Check if a nullifier has been spent.
fn is_spent(env: soroban_sdk::Env, nullifier_hash: soroban_sdk::U256) -> bool
Withdraw tokens from the pool using a ZK proof.
fn withdraw(
env: soroban_sdk::Env,
proof: ProofData,
root: soroban_sdk::U256,
nullifier_hash: soroban_sdk::U256,
recipient: soroban_sdk::Address,
relayer: soroban_sdk::Address,
fee: i128,
refund: i128,
)
Initialize the Veil Pool.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token: soroban_sdk::Address,
verifier: soroban_sdk::Address,
denomination: i128,
)
Get the latest Merkle root.
fn get_last_root(env: soroban_sdk::Env) -> soroban_sdk::U256
Check if a Merkle root is known.
fn is_known_root(env: soroban_sdk::Env, root: soroban_sdk::U256) -> bool
Withdraw tokens from the pool and swap to a different token via the router.
The ZK proof binds recipient as an anti-frontrun constraint. token_out
and min_amount_out are user preferences — not security-critical — because
funds can only go to the proof-bound recipient regardless of swap params.
fn withdraw_swap(
env: soroban_sdk::Env,
proof: ProofData,
root: soroban_sdk::U256,
nullifier_hash: soroban_sdk::U256,
recipient: soroban_sdk::Address,
relayer: soroban_sdk::Address,
fee: i128,
refund: i128,
token_out: soroban_sdk::Address,
min_amount_out: i128,
)
Get the next leaf index (total deposits).
fn get_next_index(env: soroban_sdk::Env) -> u32
Set the swap router contract address. Admin-only.
fn set_swap_router(env: soroban_sdk::Env, router: soroban_sdk::Address)
Get the fixed denomination amount.
fn get_denomination(env: soroban_sdk::Env) -> i128
Deposit with an encrypted note stored on-chain.
fn deposit_with_note(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
commitment: soroban_sdk::U256,
encrypted_note: soroban_sdk::Bytes,
) -> u32
Get an encrypted note by leaf index.
fn get_encrypted_note(env: soroban_sdk::Env, leaf_index: u32) -> soroban_sdk::Bytes