Contract 14072ffd95562e1630bf4d547d408899d8c48c09c7fcf50a14e3e9acee134468

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.89.0

Instances

  • CC2YE47R37WXUUO3SZEDV6ZOANRMVXWAVRERH6WYGAVJQWWQLVFMPSJX

Interface

One-time setup. Records the admin and the escrow token (a SAC address, e.g. the native XLM contract). Zeroes the lock counter.

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

Escrow amount of the token until unlock_ledger. The owner's signature authorizes both this call and the inner SAC transfer(owner -> contract). Returns the new lock's id.

fn create_lock(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    amount: i128,
    unlock_ledger: u32,
) -> Result

Reclaim a lock's funds to its owner. Fails TooEarly before the unlock ledger, AlreadyClaimed if the funds were already returned, and NotOwner if the caller is not the lock's owner.

fn claim(
    env: soroban_sdk::Env,
    lock_id: u64,
    caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Every lock an owner holds, as (id, amount, unlock_ledger, claimed).

fn locks_for(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> soroban_sdk::Vec<(u64, i128, u32, bool)>
fn get_lock(env: soroban_sdk::Env, lock_id: u64) -> Option
fn lock_count(env: soroban_sdk::Env) -> u64
fn get_admin(env: soroban_sdk::Env) -> Result
fn get_token(env: soroban_sdk::Env) -> Result

Imports

WebAssembly Text (WAT) ▶