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