TEMPLATES

STAKING POOL

Token staking contract with time-based rewards distribution.

OVERVIEW

The staking pool allows users to lock their tokens and earn rewards over time. Rewards are distributed proportionally based on stake amount and duration.

TEMPLATE FEATURES

Proportional Rewards

Rewards based on share of total staked

Flexible Staking

Stake and unstake at any time

Reward Claiming

Claim accumulated rewards anytime

Reentrancy Protection

Secure against reentrancy attacks

HOW IT WORKS

  1. 1

    Deposit Rewards

    Owner deposits reward tokens and sets reward rate.

  2. 2

    Users Stake

    Users approve and stake their tokens.

  3. 3

    Rewards Accrue

    Rewards accumulate based on time and stake share.

  4. 4

    Claim or Unstake

    Users can claim rewards or withdraw their stake.

KEY FUNCTIONS

FunctionDescription
stake(amount)Deposit tokens to stake
withdraw(amount)Withdraw staked tokens
claimReward()Claim accumulated rewards
earned(account)Check pending rewards
balanceOf(account)Get staked balance

NEXT STEPS