Contract e13706e466a257a4c101afc1b5e54e0bf5db00c3e50aef1e9d3728950efe08c3

← Back to Index 📥 Download WASM

Meta

binver 0.1.0
cliver 25.1.0#
rssdkver 23.4.1#e671b396f8bacf1370925f722df158b31c0baae5
rsver 1.95.0

Instances

  • CAAMRQZ5W24TKAJIIP6DZZE3OWRVKVW4MTD6ZMGERMDJRZALFUETZVGE

Interface

Claims rewards for a set of users based on Merkle proofs

Arguments

  • caller - Address initiating the claim (must be user or authorized operator)
  • users - Addresses claiming rewards (or being claimed for)
  • tokens - ERC20 tokens being claimed
  • amounts - Cumulative amounts earned (not incremental amounts)
  • proofs - Merkle proofs validating each claim

Notes

  • Users can only claim for themselves unless they've authorized an operator
  • Arrays must all have the same length
fn 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 migrate(
    env: soroban_sdk::Env,
    migration_data: MigrationData,
    operator: soroban_sdk::Address,
)
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)

Returns the current active Merkle tree

Returns

  • Option<MerkleTree> - The current tree with merkle root and IPFS hash, or None if not set
fn get_tree(env: soroban_sdk::Env) -> Option

Extends the TTL of the contract instance, code, and key persistent entries

Notes

  • Callable by anyone — keeping the contract alive is a public good
  • Extends instance storage (which includes all Instance entries and the contract code)
  • User-specific persistent entries have their TTL extended individually when accessed
fn extend_ttl(env: soroban_sdk::Env)

Returns the claim details for a specific user and token

Arguments

  • user - The user address to query
  • token - The token address to query

Returns

  • Option<Claim> - Claim details including amount, timestamp, and merkle root, or None if no claim exists
fn get_claimed(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> Option

Reverts to the previous Merkle tree immediately

Arguments

  • caller - Address calling the function (must be governor)

Notes

  • Only callable by governor
  • Cannot be called if there's an active dispute (must resolve dispute first)
fn revoke_tree(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Updates the active Merkle tree with new reward data

Arguments

  • caller - Address calling the function (must be trusted address or governor)
  • merkle_root - New Merkle root containing updated reward information
  • ipfs_hash - IPFS hash of the complete tree data

Notes

  • Can only be called by trusted addresses or governor
  • Trusted addresses cannot update during an active dispute period to prevent circumventing disputes
  • Saves the current tree to lastTree before updating
fn 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

Arguments

  • caller - Address creating the dispute
  • reason - Explanation for why the tree update is being disputed

Notes

  • Requires depositing dispute_amount of dispute_token as collateral
  • Can only be called within the dispute period after a tree update
  • Deposit is slashed if dispute is rejected, returned if valid
fn 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

Arguments

  • user - The user address to query
  • operator - The operator address to query (None = any operator)

Returns

  • bool - True if operator is authorized, false otherwise
fn get_operator(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    operator: Option,
) -> bool

Initializes the contract with access control manager

Arguments

  • access_control_manager - Address of the access control manager contract

Notes

  • Sets up the contract for reward distribution operations
fn __constructor(
    env: soroban_sdk::Env,
    access_control_manager: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Returns the previous Merkle tree (for rollback purposes)

Returns

  • Option<MerkleTree> - The last tree before the most recent update, or None if not set
fn get_last_tree(env: soroban_sdk::Env) -> Option

Recovers SEP-41 tokens accidentally sent to the contract

Arguments

  • caller - Address calling the function (must be governor)
  • token_address - Address of the token to recover
  • to - Address that will receive the recovered tokens
  • amount_to_recover - Amount of tokens to recover

Notes

  • Only callable by governor
fn 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

Arguments

  • address - The address to query

Returns

  • bool - True if address is trusted, false otherwise
fn get_is_trusted(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Toggles an address's authorization to update the Merkle tree

Arguments

  • caller - Address calling the function (must be governor)
  • trust_address - Address whose trusted status is being toggled

Notes

  • Only callable by governor
  • Trusted addresses can update trees
fn 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

Returns

  • BytesN<32> - The Merkle root that is currently valid for claims

Notes

  • Returns lastTree.merkle_root if within the dispute period or if there's an active dispute
  • Returns tree.merkle_root if dispute period has passed and there's no active dispute
fn get_merkle_root(
    env: soroban_sdk::Env,
) -> Result, soroban_sdk::Error>

Resolves an ongoing dispute

Arguments

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

Notes

  • Only callable by governor
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

Arguments

  • caller - Address toggling the authorization (must be user or governance)
  • user - User granting or revoking the authorization
  • operator - Operator address being authorized or deauthorized (None = any address)

Notes

  • If operator is None, allows any address to claim for the user
  • If operator is Some, authorizes that specific operator
  • Only the user themselves or governance can toggle operator status
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

Arguments

  • operator - The operator address to query
  • token - The token address to query (None = all tokens)

Returns

  • bool - True if operator is authorized as main operator, false otherwise
fn get_main_operator(
    env: soroban_sdk::Env,
    operator: soroban_sdk::Address,
    token: Option,
) -> bool

Updates the token required as collateral for disputes

Arguments

  • caller - Address calling the function (must be governor)
  • dispute_token - New dispute token address

Notes

  • Only callable by governor
  • Cannot be changed while there is an active dispute
fn 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

Returns

  • u32 - The current epoch duration in seconds

Notes

  • Returns custom epoch duration if set, otherwise returns default EPOCH_DURATION (3600 seconds)
fn get_epoch_duration(env: soroban_sdk::Env) -> u32

Returns any pending refund amount for a recipient-token pair

fn get_pending_refund(
    env: soroban_sdk::Env,
    recipient: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> i128

Updates the amount of tokens required to create a dispute

Arguments

  • caller - Address calling the function (must be governor)
  • dispute_amount - New dispute amount

Notes

  • Only callable by governor
  • Cannot be changed while there is an active dispute
fn set_dispute_amount(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    dispute_amount: i128,
) -> Result<(), soroban_sdk::Error>

Updates the dispute period duration

Arguments

  • caller - Address calling the function (must be governor)
  • dispute_period - Number of epochs to wait before a tree update becomes effective

Notes

  • Only callable by governor
fn 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

Arguments

  • caller - Address calling the function (must be governor)
  • epoch_duration - New epoch duration in seconds

Notes

  • Only callable by governor
fn 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

Arguments

  • user - The user address to query
  • token - The token address to query (None = default for all tokens)

Returns

  • Option<Address> - The recipient address, or None if no custom recipient is set
fn 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

Arguments

  • caller - User setting their claim recipient
  • recipient - Address that will receive claimed tokens (None = default to user)
  • token - Token for which to set the recipient (None = all tokens)

Notes

  • Users can override this recipient when calling claim_with_recipient
  • If token is None, sets the default recipient for all tokens
  • If token is Some, sets the recipient for that specific token
  • If recipient is None, removes the custom recipient setting
fn set_claim_recipient(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    recipient: Option,
    token: Option,
) -> Result<(), soroban_sdk::Error>

Claims a previously undeliverable dispute refund for the caller

Arguments

  • caller - Address claiming the pending refund
  • token - Token for which the pending refund was recorded

Notes

  • If token transfer still fails, pending refund remains claimable for a later retry
fn claim_pending_refund(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Claims rewards with custom recipient addresses and callback data

Arguments

  • caller - Address initiating the claim
  • users - Addresses claiming rewards (or being claimed for)
  • tokens - ERC20 tokens being claimed
  • amounts - Cumulative amounts earned (not incremental amounts)
  • proofs - Merkle proofs validating each claim
  • recipients - Custom recipient addresses for each claim (None = use default)
  • datas - Arbitrary data passed to recipient's onClaim callback (if recipient is a contract)

Notes

  • Only caller claiming for themselves can override the recipient address
  • Non-None recipient addresses override any previously set default recipients
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>,
    datas: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>

Permanently disables contract upgradeability

Arguments

  • caller - Address calling the function (must be governor)

Notes

  • Only callable by governor
  • This action is irreversible - use with extreme caution
fn revoke_upgradeability(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Returns the persisted storage schema version (0 if unversioned legacy state).

fn contract_schema_version(env: soroban_sdk::Env) -> u32

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

Returns

  • Address - The AccessControlManager contract address
fn get_access_control_manager(env: soroban_sdk::Env) -> soroban_sdk::Address

Points this contract at a new AccessControlManager (ACM).

Arguments

  • caller - Address calling the function (must be a governor in both ACMs)
  • new_access_control_manager - Address of the ACM to trust going forward

Notes

  • The caller must be governor according to the current ACM stored on this contract.
  • The caller must also be governor in new_access_control_manager.
  • Governor-set parity (all old ACM governors exist in the new ACM) is enforced on-chain.
  • Migration flow: call old ACM set_access_control_manager(...) first, then call this setter.
fn set_access_control_manager(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_access_control_manager: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Toggles a main operator's authorization to claim tokens on behalf of any user

Arguments

  • caller - Address calling the function (must be guardian or governor)
  • operator - Operator whose status is being toggled
  • token - Token for which authorization applies (None = all tokens)

Notes

  • Only callable by guardian for an individual token or governor if it's for all tokens
  • Main operators can claim for any user without individual user authorization
  • If token is None, the operator can claim any token for any user (requires governor)
  • If token is Some, the operator can claim that specific token (requires guardian)
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

Returns

  • bool - True if upgradeability is deactivated, false otherwise
fn get_upgradeability_deactivated(env: soroban_sdk::Env) -> bool

Imports

WebAssembly Text (WAT) ▶