Contract 28c2cfaab1506d1d74d883cd1de3527d2d938c9f85ac4a6eacbfa199cc78c674

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.92.0

Instances

  • CCE3VBWTMGS7TZBOMBXVMPZFD4RUWAJDQHV7L2FT5BHMZKHLQUJKHECE
  • CDV45TTXDDUKBMK2IWPJRUYQSRVEWHTRPKCN2VZ7GEV2HVMRPBOD2KR7

Interface

Get the latest root of the Merkle tree that defines the pool

fn get_root(env: soroban_sdk::Env) -> Result

Register a user's public encryption key

Allows users to publish their public key so others can send them encrypted outputs for private transfers. The account owner must authorize this call

Arguments

  • env - The Soroban environment
  • account - Account data containing owner address and public key
fn register(env: soroban_sdk::Env, account: Account)

Execute a shielded transaction with deposit handling

This is the main entry point for users to interact with the pool. If ext_amount > 0, tokens are transferred from the sender to the pool before processing the transaction.

Arguments

  • env - The Soroban environment
  • proof - Zero-knowledge proof and public inputs
  • ext_data - External transaction data
  • sender - Address of the transaction sender (must authorize funding transaction)

Returns

Returns Ok(()) on success, or an error if validation fails

fn transact(
    env: soroban_sdk::Env,
    proof: Proof,
    ext_data: ExtData,
    sender: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Update the contract administrator

Transfers administrative control to a new address. Requires authorization from the current admin.

Arguments

  • env - The Soroban environment
  • new_admin - New address that will have administrative permissions
fn update_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Constructor: initialize the privacy pool contract

Sets up the contract with the specified token, verifier, and Merkle tree configuration. This function can only be called once.

Arguments

  • env - The Soroban environment
  • admin - Address of the contract administrator
  • token - Address of the token contract for deposits/withdrawals
  • verifier - Address of the ZK proof verifier contract
  • asp_membership - Address of the ASP Membership contract
  • asp_non_membership - Address of the ASP Non-Membership contract
  • maximum_deposit_amount - Maximum allowed deposit per transaction
  • levels - Number of levels in the commitment Merkle tree (1-32)

Returns

Returns Ok(()) on success, or an error if already initialized or invalid configuration

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    verifier: soroban_sdk::Address,
    asp_membership: soroban_sdk::Address,
    asp_non_membership: soroban_sdk::Address,
    maximum_deposit_amount: soroban_sdk::U256,
    levels: u32,
) -> Result<(), soroban_sdk::Error>

Check whether a pool Merkle root is still in the recent root history.

Arguments

  • env - The Soroban environment
  • root - Pool Merkle root to check
fn is_known_root(
    env: soroban_sdk::Env,
    root: soroban_sdk::U256,
) -> Result

Update the ASP Membership contract address

Changes the ASP Membership contract address. Requires admin authorization.

Arguments

  • env - The Soroban environment
  • new_asp_membership - New ASP Membership contract address
fn update_asp_membership(
    env: soroban_sdk::Env,
    new_asp_membership: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Get the current Merkle root from the ASP Membership contract

Makes a cross-contract call to retrieve the current root of the membership Merkle tree.

Arguments

  • env - The Soroban environment

Returns

The current membership Merkle root as U256

fn get_asp_membership_root(
    env: soroban_sdk::Env,
) -> Result

Update the ASP Non-Membership contract address

Changes the ASP Non-Membership contract address. Requires admin authorization.

Arguments

  • env - The Soroban environment
  • new_asp_non_membership - New ASP Non-Membership contract address
fn update_asp_non_membership(
    env: soroban_sdk::Env,
    new_asp_non_membership: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Get the current Merkle root from the ASP Non-Membership contract

Makes a cross-contract call to retrieve the current root of the non-membership Sparse Merkle tree.

Arguments

  • env - The Soroban environment

Returns

The current non-membership Merkle root as U256

fn get_asp_non_membership_root(
    env: soroban_sdk::Env,
) -> Result
fn approve(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
)
fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)
fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128
fn transfer_from(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Imports

WebAssembly Text (WAT) ▶