Contract c5ad8d9c07b6e153939c1f53612b10afe34b27181cc00e7b259a6a44ea4d4399

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.96.0

Instances

  • CBKOYL6BHVCHB4DJFVNHLGJKLCIFVRRRDVN2NRWX6TKRHQJQZQHPCACV

Interface

Add more of the vault's token. Does not alter unlock_timestamp. The token address is looked up from the vault — callers cannot pass in a different asset than the vault was created with.

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

Withdraw the full vault balance in the vault's own token to the owner. Reverts with StillLocked if env.ledger().timestamp() < unlock_timestamp.

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 — there is no set_unlock.

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

Create a vault holding initial_deposit of token. The caller must have pre-approved the vault contract to spend at least initial_deposit of the token, OR the token must accept require_auth from owner (the standard Stellar Asset Contract path).

unlock_timestamp is recorded immutably; it can only ever be PUSHED FORWARD via extend_lock.

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

Imports

WebAssembly Text (WAT) ▶