Contract 136bcb7e17df5cd35d65cf09875f858f970f8c56a61aef4c717cb08cef38fe9a

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.92.0

Instances

  • CD6G3UTDV4XPDMVNYTPQ6UCL7FWSYG5LXYAZXBDDSKY5YOQ6HLDBPYRY

Interface

Claim tokens from a distribution by providing a Merkle proof.

The claimant must authorize the call. The Merkle leaf is computed as keccak256(claimant || amount) and verified against the stored root.

Protocol fees are deducted from the claimed amount.

Arguments

  • claimant — The address claiming tokens (must authorize).
  • distribution_id — ID of the distribution to claim from.
  • amount — The amount the claimant is entitled to (per the Merkle tree).
  • proof — The Merkle proof (list of sibling hashes).
fn claim(
    env: soroban_sdk::Env,
    claimant: soroban_sdk::Address,
    distribution_id: u32,
    amount: i128,
    proof: soroban_sdk::Vec>,
)

Emergency upgrade — bypasses timelock. Use only in critical situations.

Admin-only.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Direct admin transfer (legacy, kept for backwards compatibility).

Admin-only. Prefer propose_admin + accept_admin for safety.

fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Initialize the contract with an admin address.

Must be called exactly once before any other function. The intended admin must authorize the initialization to prevent first-caller takeover attacks.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    protocol_fee_address: soroban_sdk::Address,
)

Check if a user has already claimed from a distribution.

fn has_claimed(
    env: soroban_sdk::Env,
    distribution_id: u32,
    claimant: soroban_sdk::Address,
) -> bool

Accept an admin transfer (two-step transfer, step 2).

Must be called by the address that was proposed via propose_admin().

fn accept_admin(env: soroban_sdk::Env)

Propose a new admin (two-step transfer, step 1).

Admin-only.

fn propose_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Execute a previously proposed upgrade after the timelock has expired.

Admin-only.

fn execute_upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Propose a timelocked upgrade. The upgrade can be executed after UPGRADE_TIMELOCK_LEDGERS have passed.

Admin-only.

fn propose_upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Get the full distribution record.

fn get_distribution(env: soroban_sdk::Env, distribution_id: u32) -> DistributionRecord

Cancel a distribution and reclaim remaining (unclaimed) tokens.

The distribution creator (or contract admin) can cancel. Prevents further claims.

fn cancel_distribution(env: soroban_sdk::Env, distribution_id: u32)

Create a new Merkle distribution.

Transfers total_amount of token from the caller into this contract. The merkle_root represents the tree of (claimant, amount) leaves. An optional deadline (unix timestamp) can be set — after which no more claims are accepted (0 = no deadline).

Arguments

  • admin — The admin creating the distribution (must authorize).
  • token — Token contract address to distribute.
  • merkle_root — Root hash of the Merkle tree.
  • total_amount — Total tokens to deposit into the distribution.
  • deadline — Unix timestamp deadline (0 = no deadline).
  • unique_ref — A unique reference identifier for this distribution.

Returns

The newly assigned distribution ID.

fn create_distribution(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    merkle_root: soroban_sdk::BytesN<32>,
    total_amount: i128,
    deadline: u64,
    unique_ref: soroban_sdk::Bytes,
) -> u32

Get the protocol fee address.

fn get_protocol_fee_address(env: soroban_sdk::Env) -> soroban_sdk::Address

Get the protocol fee percentage (basis points).

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

Set the protocol fee collection address.

Admin-only.

fn set_protocol_fee_address(
    env: soroban_sdk::Env,
    new_fee_address: soroban_sdk::Address,
)

Set the protocol fee percentage (in basis points, max 10000).

Admin-only.

fn set_protocol_fee_percent(env: soroban_sdk::Env, new_fee_percent: u32)

Imports

WebAssembly Text (WAT) ▶