Contract 04174fdc4edda8576bfed5aa52650288320e6a3533bf1ab60584be968bea8f70

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.89.0

Instances

  • CA2IMDY44DAEWZFJ7IFX7IRFFAZ45UUTSC7ATLPFH7CY2W7CIYCXOQAD

Interface

One-time setup. Records the admin and unpauses the contract.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Lock total_amount of token into a new envelope and return its id.

Auth: requires the sender's signature. The same authorization covers the inner SAC transfer(sender -> contract).

fn create_envelope(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
    token: soroban_sdk::Address,
    total_amount: i128,
    total_slots: u32,
    secret_hash: soroban_sdk::BytesN<32>,
    expiry: u64,
    split: SplitMode,
) -> Result

Claim one slot of an envelope by revealing the secret preimage. Returns the amount transferred to recipient (minor units).

Auth: requires the recipient's signature (binds the payout to them).

fn claim(
    env: soroban_sdk::Env,
    envelope_id: u64,
    recipient: soroban_sdk::Address,
    preimage: soroban_sdk::Bytes,
) -> Result

After expiry, the sender reclaims the unclaimed remainder.

fn refund(env: soroban_sdk::Env, envelope_id: u64) -> Result
fn get_envelope(
    env: soroban_sdk::Env,
    envelope_id: u64,
) -> Result
fn has_claimed(
    env: soroban_sdk::Env,
    envelope_id: u64,
    recipient: soroban_sdk::Address,
) -> bool
fn total_envelopes(env: soroban_sdk::Env) -> u64
fn is_paused(env: soroban_sdk::Env) -> bool
fn get_admin(env: soroban_sdk::Env) -> Result
fn pause(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
fn unpause(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
fn set_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Replace the contract's own code (admin-gated). Enables shipping fixes without migrating escrow state — important for a mainnet (L6) deploy.

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

Imports

WebAssembly Text (WAT) ▶