Contract 651c5f70fed3d115833e450b8fcfae65263353d203b6a04e67f5e053bfb788aa

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.96.0

Instances

  • CAPXQVGAD2TZNEDKZZDX3YKUBHQ2UI2XDI5AND6Z35D2YY2NZ7AJV6LM
  • CD66W4A3AIXRJNI2MYMSKRMAOVCF5AYZSYALQ56LE7HYGTCFQFNLLKXQ

Interface

Owner check-in. Resets the inactivity countdown. Owner-only.

fn ping(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
) -> Result

Add more of the vault's token. Does not alter unlock_timestamp. For a Vesting vault, the top-up amount also raises total_locked_amount so the extra funds vest on the same linear schedule as the original deposit.

fn deposit(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Withdraw the full vault balance. Behavior depends on kind:

  • TimeLock: blocked until unlock_timestamp.
  • CoolingOff: blocked until a withdrawal was initiate_withdrawal'd AND the cooling-off duration has elapsed since.
  • DeadManSwitch: the OWNER can always withdraw here (any time, subject only to the backup not having already claimed).
  • Vesting: NOT withdrawable via this method — use withdraw_vested instead (partial, schedule-gated amounts).
fn withdraw(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
) -> Result

Read-only — fetch a vault by id.

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

Read-only — list vault ids owned by owner.

fn list_owned(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> soroban_sdk::Vec

Push the unlock timestamp further into the future by additional_seconds. Reducing or zeroing the lock is impossible.

fn extend_lock(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
    additional_seconds: u64,
) -> Result

Create a standard time-lock vault holding initial_deposit of token, unlockable at unlock_timestamp.

fn create_vault(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
    name: soroban_sdk::String,
    initial_deposit: i128,
    unlock_timestamp: u64,
) -> Result

Backup-address claim. Only succeeds once the owner has missed the inactivity deadline. Only backup_address may call this.

fn backup_withdraw(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
) -> Result

Withdraw up to the currently-vested, not-yet-withdrawn amount. Reverts with AmountExceedsUnlocked if amount is more than that. Can be called any number of times as more vests.

fn withdraw_vested(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
    amount: i128,
) -> Result

Cancel a pending withdrawal. Owner-only.

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

Read-only — currently claimable amount (already vested, not yet withdrawn). Zero before vesting_start_timestamp; the full remaining balance once now >= vesting_end_timestamp.

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

Start the withdrawal countdown. Anyone with a signed transaction from the owner can call this — that's the whole point: if an attacker calls it, the REAL owner sees it pending and has the full cooling_off_duration_seconds window to cancel_withdrawal.

fn initiate_withdrawal(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vault_id: u64,
) -> Result

Create a linear-vesting vault. vesting_end_timestamp must be strictly after vesting_start_timestamp (which may be in the past — e.g. "start now").

fn create_vesting_vault(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
    name: soroban_sdk::String,
    initial_deposit: i128,
    vesting_start_timestamp: u64,
    vesting_end_timestamp: u64,
) -> Result

Create a Cooling-Off vault. There is no unlock_timestamp — the vault is "unlocked" from the start in the base sense; every withdrawal still has to go through initiate_withdrawal and wait out cooling_off_duration_seconds.

fn create_cooling_off_vault(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
    name: soroban_sdk::String,
    initial_deposit: i128,
    cooling_off_duration_seconds: u64,
) -> Result

Create a Dead Man's Switch vault. backup_address cannot equal owner (would defeat the entire point).

fn create_dead_man_switch_vault(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
    name: soroban_sdk::String,
    initial_deposit: i128,
    backup_address: soroban_sdk::Address,
    inactivity_period_seconds: u64,
) -> Result

Imports

WebAssembly Text (WAT) ▶