Contract 1f22904bf0edb5b75e4ac7e2358f19a1d7e42f2b0a56b0e0730b17ea5a95dab2

← Back to Index 📥 Download WASM

Meta

rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.96.0

Instances

  • CCU3RNBDB3EIVF2NDVTPZ4E2URZYXVMRJ3S7HTBYMMGCM3VGWIQ4SL2G

Interface

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>,
) -> 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,
) -> 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>
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

Imports

WebAssembly Text (WAT) ▶