Contract 0fb3760c222c362975089dc1d0fd09b47d114793f22b1aa70c02e9da7671e284

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.97.1

Instances

  • CDPWT5VY4YFBUKUTZ7LKQNQ3FVJE5VSKJJD4LFBLUY4VSYYSHKAUTRCH

Interface

Recipient claims locked XLM by revealing a preimage whose SHA-256 matches the vault hash. Must be called strictly before deadline.

fn claim(
    env: soroban_sdk::Env,
    vault_id: u64,
    preimage: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

Lock amount stroops of XLM into a new HTLC vault.

  • sender must authorize the transfer into this contract
  • hash is SHA-256 of the secret preimage (32 bytes)
  • deadline is a unix timestamp; refunds are allowed strictly after it
fn create(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
    recipient: soroban_sdk::Address,
    hash: soroban_sdk::BytesN<32>,
    deadline: u64,
    amount: i128,
) -> Result

Sender refunds locked XLM after the deadline if the vault is unsettled.

fn refund(env: soroban_sdk::Env, vault_id: u64) -> Result<(), soroban_sdk::Error>

Wrapped-native XLM SAC address configured at initialize (read-only).

fn get_token(env: soroban_sdk::Env) -> Result

Read full vault state.

fn get_vault(
    env: soroban_sdk::Env,
    vault_id: u64,
) -> Result

One-time setup: bind the wrapped-native XLM SAC this contract will use.

Mainnet SAC: CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA

Not an admin/control plane — there is no further privileged entrypoint after this call. Required so the same WASM can target testnet or mainnet.

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

All vault IDs created by sender (oldest → newest).

fn list_sender_vaults(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
) -> soroban_sdk::Vec

All vault IDs where recipient can claim (oldest → newest).

fn list_recipient_vaults(
    env: soroban_sdk::Env,
    recipient: soroban_sdk::Address,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶