Contract 080aa8e16f18dd61a0258279638c0f2cacc645117e511f8194ac98532197def7

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.91.1

Instances

  • CAGYBFLVBHFXDG6Q7HNFECR6SP5YDPYREC3A6YAEZUZN7NTWRTTKKM2Z

Interface

Emergency exit (forfeit rewards)

fn exit(env: soroban_sdk::Env, user: soroban_sdk::Address, id: u32) -> Result

Initialize contract

fn init(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    min_stake: i128,
    max_per_user: i128,
) -> Result<(), E>

Get available treasury

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

Claim mature stake with rewards (allowed even when paused - user protection)

fn claim(env: soroban_sdk::Env, user: soroban_sdk::Address, id: u32) -> Result

Pause/unpause

fn pause(env: soroban_sdk::Env, p: bool) -> Result<(), E>

Stake tokens

fn stake(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amt: i128,
    period: u64,
) -> Result

Get state

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

Get config

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

Get all active stakes for user (returns Vec of (id, stake))

fn stakes(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> soroban_sdk::Vec<(u32, Stake)>

Get periods

fn periods(env: soroban_sdk::Env) -> (u64, u64, u64)

Preview reward

fn preview(env: soroban_sdk::Env, amt: i128, period: u64) -> Result

Withdraw available treasury

fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amt: i128,
) -> Result<(), E>

Claim multiple mature stakes at once (gas efficient, allowed when paused)

fn claim_all(env: soroban_sdk::Env, user: soroban_sdk::Address) -> Result

Get stake

fn get_stake(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    id: u32,
) -> Result

Check if stake is mature

fn is_mature(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    id: u32,
) -> Result

Change admin

fn set_admin(env: soroban_sdk::Env, new: soroban_sdk::Address) -> Result<(), E>

Update rates (max 100% APR = 10000 bps)

fn set_rates(env: soroban_sdk::Env, r7: u32, r14: u32, r30: u32) -> Result<(), E>

Get time remaining

fn time_left(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    id: u32,
) -> Result

Get user info

fn user_info(env: soroban_sdk::Env, user: soroban_sdk::Address) -> UserMeta

Update limits

fn set_limits(env: soroban_sdk::Env, min: i128, max: i128) -> Result<(), E>

Count mature stakes

fn mature_count(env: soroban_sdk::Env, user: soroban_sdk::Address) -> u32

Imports

WebAssembly Text (WAT) ▶