Contract afad1f43f65aad65c5f044574d0280f277fc7cde6c3ae788029e2c72505a3449

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.96.0

Instances

  • CANNERRPWTOQCGSLQKNP7RKQGK7ILFKFVKTNZ4HFOKUCKTET5HCXX2HS
  • CCNKEPPTEBDC2JKVFZIR5EBGISXWUKW7BWLOVZOCT236WP7W6G36BZD2

Interface

Permissionless maintenance against Soroban state-expiration: extend the contract instance (tree state) and any supplied spent nullifiers to the network max TTL. A keeper calls this periodically so a long-lived pool's spent-note set is never evicted (which would re-enable a double-spend). Safe for anyone to call — it only extends lifetimes, never alters funds/notes.

fn bump(env: soroban_sdk::Env, nullifiers: soroban_sdk::Vec>)
fn init(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn root(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>

Admin sets the immutable transfer verifying key.

fn set_vk(
    env: soroban_sdk::Env,
    alpha: soroban_sdk::BytesN<96>,
    beta: soroban_sdk::BytesN<192>,
    gamma: soroban_sdk::BytesN<192>,
    delta: soroban_sdk::BytesN<192>,
    ic: soroban_sdk::Vec>,
) -> Result<(), soroban_sdk::Error>

Shield: pull USDC, recompute the note commitment on-chain (binds the deposited amount to the note), insert it, emit a Note event.

fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount: i128,
    ak: soroban_sdk::BytesN<32>,
    blinding: soroban_sdk::BytesN<32>,
    label: soroban_sdk::BytesN<32>,
    enc: soroban_sdk::Bytes,
) -> Result
fn reserve(env: soroban_sdk::Env) -> i128

TEST/REFERENCE: root of a fresh tree holding leaves at positions 0..n. Used to prove on-chain tree == circuit/JS tree without token/storage setup.

fn root_of(
    env: soroban_sdk::Env,
    leaves: soroban_sdk::Vec>,
) -> soroban_sdk::BytesN<32>

THE shielded payment. Verify the 2-in/2-out proof against a known root, spend both nullifiers, insert both output commitments, settle publicAmount. extDataHash is recomputed on-chain from ext_data (recipient/fee/etc. preimage), which BINDS the proof to this settlement — the fix for Proven's redirect bug.

fn transact(
    env: soroban_sdk::Env,
    proof_a: soroban_sdk::BytesN<96>,
    proof_b: soroban_sdk::BytesN<192>,
    proof_c: soroban_sdk::BytesN<96>,
    root: soroban_sdk::BytesN<32>,
    public_amount: i128,
    ext_data: soroban_sdk::Bytes,
    nf0: soroban_sdk::BytesN<32>,
    nf1: soroban_sdk::BytesN<32>,
    out0: soroban_sdk::BytesN<32>,
    out1: soroban_sdk::BytesN<32>,
    recipient: soroban_sdk::Address,
    enc0: soroban_sdk::Bytes,
    enc1: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

TEST helper: ak = H([TAG_PK=1, ask]) and a commitment, both on-chain.

fn test_commit(
    env: soroban_sdk::Env,
    amount: i128,
    ask: i128,
    blinding: i128,
    label: i128,
) -> soroban_sdk::BytesN<32>

SPIKE — shared-VK BATCHED Groth16 verification. All Veil proofs reuse one VK, so the alpha/gamma/delta terms collapse into G1 MSMs and N proofs verify in ONE pairing_check of N+3 pairs (vs 4N naive). r_i are Fiat-Shamir scalars from a keccak transcript over every proof + public input, so a relayer cannot grind a malicious batch. Verify-only (no tree/ nullifier settle) — measures the on-chain cost curve for the aggregation design.

fn batch_verify(
    env: soroban_sdk::Env,
    a: soroban_sdk::Vec>,
    b: soroban_sdk::Vec>,
    c: soroban_sdk::Vec>,
    pubs: soroban_sdk::Vec>>,
) -> bool
fn is_known_root(env: soroban_sdk::Env, r: soroban_sdk::BytesN<32>) -> bool
fn nullifier_used(env: soroban_sdk::Env, nf: soroban_sdk::BytesN<32>) -> bool

PRODUCTION batched private settlement: N transfers verified + applied in ONE tx. Reuses the proven shared-VK batch_verify (N+3 pairings) and the proven batched subtree insert (insert_leaves). Same per-transfer semantics as transact (root ring, distinct/ unused nullifiers + intra-batch dedup, recipient binding for unshield, keccak extData), but the 2N output commitments insert in one frontier walk and unshield legs settle together. NOTE: not yet deployed to the live vaults — audit + N-distinct-proof e2e gate a mainnet batch.

fn batched_transact(
    env: soroban_sdk::Env,
    proof_a: soroban_sdk::Vec>,
    proof_b: soroban_sdk::Vec>,
    proof_c: soroban_sdk::Vec>,
    root: soroban_sdk::Vec>,
    public_amount: soroban_sdk::Vec,
    ext_data: soroban_sdk::Vec,
    nf0: soroban_sdk::Vec>,
    nf1: soroban_sdk::Vec>,
    out0: soroban_sdk::Vec>,
    out1: soroban_sdk::Vec>,
    recipient: soroban_sdk::Vec,
    enc0: soroban_sdk::Vec,
    enc1: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶