Contract 0623e0d9f5ac696e499777aab53c8d7232b571211c08460fec28d9ea3d956d6d

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.92.0

Instances

  • CD7HRMO7E6ONVS6JOMGLQJAT4VF46VKMBEJXXG5ZP53BUT6WFTIRERGG

Interface

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

Hash two U256 values using Poseidon2 compression

Computes the Poseidon2 hash of two field elements in compression mode. This is the core hashing function used for Merkle tree operations.

fn hash_pair(
    env: soroban_sdk::Env,
    left: soroban_sdk::U256,
    right: soroban_sdk::U256,
) -> soroban_sdk::U256

Insert a new leaf into the Merkle tree

Adds a new member to the Merkle tree and updates the root. The leaf is inserted at the next available index and the tree is updated efficiently by only recomputing the hashes along the path to the root. If admin_insert_only is enabled (the default), only the admin can insert leaves; otherwise, anyone can call this function.

fn insert_leaf(
    env: soroban_sdk::Env,
    leaf: soroban_sdk::U256,
) -> Result<(), soroban_sdk::Error>

Update the contract administrator

Changes the admin address to a new address. Only the current admin can call this function.

fn update_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Constructor: initialize the ASP Membership contract

Creates a new Merkle tree with the specified number of levels and sets the admin address. The tree is initialized with zero hashes at each level.

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    levels: u32,
) -> Result<(), soroban_sdk::Error>

Set whether admin permission is required to insert a leaf

When admin_only is true (default), only the admin can insert leaves. When false, anyone can insert leaves. Only the admin can change this setting.

fn set_admin_insert_only(
    env: soroban_sdk::Env,
    admin_only: bool,
) -> Result<(), soroban_sdk::Error>
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) ▶