Contract d08e89bbf387bf2cd1ce59ab26b4f5972501f82248d8db58bd8284df22605948

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.97.0

Instances

  • CD4BLMXAB3JYJWBDTBOPSDKK4G3HDV3N5CFNL3TMIBTK32WRUCCZ2F6Q

Interface

Stake tokens with a lock period and optional auto-compound

fn stake(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amount: i128,
    lock_days: u32,
    auto_compound: CompoundFreq,
) -> Result<(), StakeError>

Unstake tokens after lock period expires

fn unstake(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amount: i128,
) -> Result<(), StakeError>

Compound: reinvest accrued rewards into principal stake

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

Transfer admin role

fn set_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), StakeError>

Initialize the staking pool with admin, token contract, and reward rate

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token_contract: soroban_sdk::Address,
    reward_per_ledger: i128,
) -> Result<(), StakeError>

Pause/unpause the staking pool (admin only)

fn set_paused(env: soroban_sdk::Env, paused: bool) -> Result<(), StakeError>

Update reward rate per ledger (admin only)

fn set_rewards(
    env: soroban_sdk::Env,
    reward_per_ledger: i128,
) -> Result<(), StakeError>

Deposit reward tokens into the staking contract from the admin account. The admin must have approved the staking contract to spend amount beforehand.

fn fund_rewards(env: soroban_sdk::Env, amount: i128) -> Result<(), StakeError>

Get user's full stake position

fn get_position(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> Option

Claim accrued rewards (withdraw without touching principal)

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

Get pool-wide info (TVL, staker count, reward rate)

fn get_pool_info(env: soroban_sdk::Env) -> PoolInfo

Get pending (unclaimed) rewards

fn pending_rewards(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Imports

WebAssembly Text (WAT) ▶