Contract 15804043e253f3dfd11bd15fd861a3b70e6b9b82109db37b3f5cd2cf211a8424

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.89.0

Instances

  • CDACSIOTAVYJ523ZGZLG52IE73Y2IRI2SVWNNLWPGFU2TPMYQLOYUH3D

Interface

One-time setup. Records the admin (the deployer) and the default token (the XLM Stellar Asset Contract), and unpauses the contract.

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

Deposit amount of token toward the (saver, goal_id) goal, locking it in the contract. Creates the goal on first deposit (binding its target and token); accumulates on subsequent deposits. Returns the new balance.

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

fn deposit(
    env: soroban_sdk::Env,
    saver: soroban_sdk::Address,
    goal_id: soroban_sdk::BytesN<32>,
    token: soroban_sdk::Address,
    target: i128,
    amount: i128,
) -> Result

Withdraw the full held balance of (saver, goal_id) back to the saver and close the goal. Allowed at any time by the goal's owner. Returns the amount paid out. Pausing the contract never blocks this — funds can't be trapped.

Auth: requires the saver's signature.

fn withdraw(
    env: soroban_sdk::Env,
    saver: soroban_sdk::Address,
    goal_id: soroban_sdk::BytesN<32>,
) -> Result
fn get_goal(
    env: soroban_sdk::Env,
    saver: soroban_sdk::Address,
    goal_id: soroban_sdk::BytesN<32>,
) -> Result
fn balance(
    env: soroban_sdk::Env,
    saver: soroban_sdk::Address,
    goal_id: soroban_sdk::BytesN<32>,
) -> i128
fn total_saved(env: soroban_sdk::Env) -> i128
fn is_paused(env: soroban_sdk::Env) -> bool
fn get_token(env: soroban_sdk::Env) -> Result
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 saver balances.

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

Imports

WebAssembly Text (WAT) ▶