One-time setup. empty_root is the depth-10 empty-tree root (computed
off-chain with the same circomlib Poseidon as the circuits).
fn init(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
usdc: soroban_sdk::Address,
empty_root: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
Deposit amount USDC and append commitment to the tree. The caller
proves the append is correct (old_root → new_root); the contract
trusts no root it didn't verify.
fn deposit(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
commitment: soroban_sdk::BytesN<32>,
ephemeral_pubkey: soroban_sdk::BytesN<32>,
amount: i128,
new_root: soroban_sdk::BytesN<32>,
leaf_index: u32,
proof: ProofBytes,
) -> Result<(), soroban_sdk::Error>
Install the insert + withdraw verification keys (admin only).
fn set_vks(
env: soroban_sdk::Env,
insert_vk: VkBytes,
withdraw_vk: VkBytes,
) -> Result<(), soroban_sdk::Error>
fn is_spent(env: soroban_sdk::Env, nullifier_hash: soroban_sdk::BytesN<32>) -> bool
Withdraw amount USDC to to, proving ownership of an unspent note in
the tree at root without revealing which one. to is bound to the
proof via keccak256(ScAddress) so a relayer can't redirect the payout.
fn withdraw(
env: soroban_sdk::Env,
proof: ProofBytes,
root: soroban_sdk::BytesN<32>,
nullifier_hash: soroban_sdk::BytesN<32>,
to: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
fn leaf_count(env: soroban_sdk::Env) -> u32
fn current_root(env: soroban_sdk::Env) -> Option>