Restake: withdraw completed stake and immediately re-stake it
fn restake(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> Result
Get card configuration for a tier
fn get_config(env: soroban_sdk::Env, tier: CardTier) -> Option
Get all stakes for a user on a given card tier
fn get_stakes(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
tier: CardTier,
) -> UserCardStakes
Initialize the card staking system
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token_contract: soroban_sdk::Address,
) -> Result<(), CardError>
Get sponsor for a user
fn get_sponsor(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
) -> Option
Get total staked across all users for a card tier
fn total_staked(env: soroban_sdk::Env, tier: CardTier) -> i128
Claim rewards from an active stake without withdrawing principal
fn claim_rewards(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> Result
Activate a new stake on a card tier
fn activate_stake(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
amount: i128,
) -> Result
Reinvest every complete compound interval. Anyone may process it because funds remain locked to the authenticated stake owner's position.
fn compound_stake(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> Result
Withdraw a completed stake (lock period must be over) Note: 2FA verification is handled off-chain before calling
fn withdraw_stake(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> Result
Get pending rewards for a specific stake
fn pending_rewards(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> i128
Configure a card tier (admin only) commission_bps: 8-element vector for generation commissions e.g., [1000, 500, 250, 125, 100, 75, 50, 25] → 10%, 5%, 2.5%, ...
fn set_card_config(
env: soroban_sdk::Env,
tier: CardTier,
min_stake: i128,
lock_days: u32,
apy_bps: u32,
max_stakes: u32,
commission_bps: soroban_sdk::Vec,
) -> Result<(), CardError>
Register a sponsor/referrer for a user
fn register_sponsor(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
sponsor: soroban_sdk::Address,
) -> Result<(), CardError>
Get active stake count for a user on a given card tier
fn active_stake_count(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
tier: CardTier,
) -> u32
fn activate_stake_custom(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
amount: i128,
lock_days: u32,
compound_freq: CardCompoundFreq,
) -> Result
fn get_compound_frequency(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
tier: CardTier,
stake_index: u32,
) -> CardCompoundFreq
fn activate_stake_compound(
env: soroban_sdk::Env,
staker: soroban_sdk::Address,
tier: CardTier,
amount: i128,
compound_freq: CardCompoundFreq,
) -> Result