Claims rewards for a set of users based on Merkle proofs
caller - Address initiating the claim (must be user or authorized operator)users - Addresses claiming rewards (or being claimed for)tokens - ERC20 tokens being claimedamounts - Cumulative amounts earned (not incremental amounts)proofs - Merkle proofs validating each claimfn claim(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
users: soroban_sdk::Vec,
tokens: soroban_sdk::Vec,
amounts: soroban_sdk::Vec,
proofs: soroban_sdk::Vec>>,
) -> Result<(), soroban_sdk::Error>
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Returns the current active Merkle tree
Option<MerkleTree> - The current tree with merkle root and IPFS hash, or None if not setfn get_tree(env: soroban_sdk::Env) -> Option
Extends the TTL of the contract instance, code, and key persistent entries
fn extend_ttl(env: soroban_sdk::Env)
Returns the claim details for a specific user and token
user - The user address to querytoken - The token address to queryOption<Claim> - Claim details including amount, timestamp, and merkle root, or None if no claim existsfn get_claimed(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> Option
Reverts to the previous Merkle tree immediately
caller - Address calling the function (must be governor)fn revoke_tree(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Updates the active Merkle tree with new reward data
caller - Address calling the function (must be trusted address or governor)merkle_root - New Merkle root containing updated reward informationipfs_hash - IPFS hash of the complete tree datafn update_tree(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
merkle_root: soroban_sdk::BytesN<32>,
ipfs_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
Creates a dispute to freeze the current Merkle tree update
caller - Address creating the disputereason - Explanation for why the tree update is being disputeddispute_amount of dispute_token as collateralfn dispute_tree(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
reason: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Returns the address of the current disputer, or None if no active dispute
fn get_disputer(env: soroban_sdk::Env) -> Option
Returns whether an operator is authorized to claim on behalf of a user
user - The user address to queryoperator - The operator address to query (None = any operator)bool - True if operator is authorized, false otherwisefn get_operator(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
operator: Option,
) -> bool
Initializes the contract with access control manager
access_control_manager - Address of the access control manager contractfn __constructor(
env: soroban_sdk::Env,
access_control_manager: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the previous Merkle tree (for rollback purposes)
Option<MerkleTree> - The last tree before the most recent update, or None if not setfn get_last_tree(env: soroban_sdk::Env) -> Option
Recovers SEP-41 tokens accidentally sent to the contract
caller - Address calling the function (must be governor)token_address - Address of the token to recoverto - Address that will receive the recovered tokensamount_to_recover - Amount of tokens to recoverfn recover_sep41(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token_address: soroban_sdk::Address,
to: soroban_sdk::Address,
amount_to_recover: i128,
) -> Result<(), soroban_sdk::Error>
Returns whether an address is trusted to update the Merkle root
address - The address to querybool - True if address is trusted, false otherwisefn get_is_trusted(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool
Toggles an address's authorization to update the Merkle tree
caller - Address calling the function (must be governor)trust_address - Address whose trusted status is being toggledfn toggle_trusted(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
trust_address: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the currently active Merkle root for claim verification
BytesN<32> - The Merkle root that is currently valid for claimsfn get_merkle_root(
env: soroban_sdk::Env,
) -> Result, soroban_sdk::Error>
Resolves an ongoing dispute
caller - Address calling the function (must be governor)valid - True if the dispute is valid (tree reverted, deposit returned to disputer)
False if invalid (deposit sent to governor, dispute period extended)fn resolve_dispute(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
valid: bool,
) -> Result<(), soroban_sdk::Error>
Toggles an operator's authorization to claim rewards on behalf of a user
caller - Address toggling the authorization (must be user or governance)user - User granting or revoking the authorizationoperator - Operator address being authorized or deauthorized (None = any address)fn toggle_operator(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
operator: Option,
) -> Result<(), soroban_sdk::Error>
Returns the dispute token address
fn get_dispute_token(env: soroban_sdk::Env) -> Option
Returns whether an operator is a main operator for a token
operator - The operator address to querytoken - The token address to query (None = all tokens)bool - True if operator is authorized as main operator, false otherwisefn get_main_operator(
env: soroban_sdk::Env,
operator: soroban_sdk::Address,
token: Option,
) -> bool
Updates the token required as collateral for disputes
caller - Address calling the function (must be governor)dispute_token - New dispute token addressfn set_dispute_token(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
dispute_token: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the dispute amount required to create a dispute
fn get_dispute_amount(env: soroban_sdk::Env) -> i128
Returns the dispute period in epoch units
fn get_dispute_period(env: soroban_sdk::Env) -> u64
Returns the epoch duration used for timing calculations
u32 - The current epoch duration in secondsfn get_epoch_duration(env: soroban_sdk::Env) -> u32
Updates the amount of tokens required to create a dispute
caller - Address calling the function (must be governor)dispute_amount - New dispute amountfn set_dispute_amount(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
dispute_amount: i128,
) -> Result<(), soroban_sdk::Error>
Updates the dispute period duration
caller - Address calling the function (must be governor)dispute_period - Number of epochs to wait before a tree update becomes effectivefn set_dispute_period(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
dispute_period: u64,
) -> Result<(), soroban_sdk::Error>
Updates the epoch duration used for timing calculations
caller - Address calling the function (must be governor)epoch_duration - New epoch duration in secondsfn set_epoch_duration(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
epoch_duration: u32,
) -> Result<(), soroban_sdk::Error>
Returns the custom claim recipient for a user and token
user - The user address to querytoken - The token address to query (None = default for all tokens)Option<Address> - The recipient address, or None if no custom recipient is setfn get_claim_recipient(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
token: Option,
) -> Option
Sets a custom recipient address for a user's token claims
caller - User setting their claim recipientrecipient - Address that will receive claimed tokens (None = default to user)token - Token for which to set the recipient (None = all tokens)fn set_claim_recipient(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
recipient: Option,
token: Option,
) -> Result<(), soroban_sdk::Error>
Public wrapper for verifying a Merkle proof (for testing purposes)
user - User address in the prooftoken - Token address in the proofamount - Amount in the proofproof - Merkle proof to verifybool - True if proof is valid, false otherwisefn verify_proof_public(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
proof: soroban_sdk::Vec>,
) -> Result
Claims rewards with custom recipient addresses and callback data
caller - Address initiating the claimusers - Addresses claiming rewards (or being claimed for)tokens - ERC20 tokens being claimedamounts - Cumulative amounts earned (not incremental amounts)proofs - Merkle proofs validating each claimrecipients - Custom recipient addresses for each claim (None = use default)datas - Arbitrary data passed to recipient's onClaim callback (if recipient is a contract)fn claim_with_recipient(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
users: soroban_sdk::Vec,
tokens: soroban_sdk::Vec,
amounts: soroban_sdk::Vec,
proofs: soroban_sdk::Vec>>,
recipients: soroban_sdk::Vec
Permanently disables contract upgradeability
caller - Address calling the function (must be governor)fn revoke_upgradeability(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the timestamp at which the current dispute period ends
fn get_end_of_dispute_period(env: soroban_sdk::Env) -> u64
Returns the AccessControlManager contract address
Address - The AccessControlManager contract addressfn get_access_control_manager(env: soroban_sdk::Env) -> soroban_sdk::Address
Toggles a main operator's authorization to claim tokens on behalf of any user
caller - Address calling the function (must be guardian or governor)operator - Operator whose status is being toggledtoken - Token for which authorization applies (None = all tokens)fn toggle_main_operator_status(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
operator: soroban_sdk::Address,
token: Option,
) -> Result<(), soroban_sdk::Error>
Returns whether upgradeability is deactivated
bool - True if upgradeability is deactivated, false otherwisefn get_upgradeability_deactivated(env: soroban_sdk::Env) -> bool