STAKING

DESCRIPTION

The staking contract implements a staking system where users can stake a specific token and earn rewards based on the staked amount and the duration of staking. The contract includes functions to stake tokens, withdraw staked tokens, and claim earned rewards. The rewards are calculated based on the reward rate and the time period for which the tokens have been staked. The contract maintains mappings for staked amounts, earned rewards, and rewards per token paid. The total supply of staked tokens is also tracked.

FUNCTIONS

  1. rewardPerToken: Calculates the amount of rewards per token staked at the current instance.

  2. earned: Calculates the earned rewards for a specific account based on their staked amount and previous rewards.

  3. stake: Allows users to stake a specified amount of tokens into the contract. It updates the staked amount and transfers the tokens from the user to the contract.

  4. withdraw: Allows users to withdraw a specified amount of their staked tokens from the contract. Updates the staked amount and transfers the tokens back to the user.

  5. getReward: Allows users to withdraw the earned rewards. Transfers the rewards tokens to the user and resets their rewards to zero.

  6. totalsupply()

  7. lastUpdatedTime()

  8. rewardPerTokenStored()

  9. rewardRate()

  10. rewards()

  11. rewardsToken()

  12. stakingToken()

  13. rewardsPerTokenPaid()

EXTRA PARAMETERS

Contract Level : Medium

Utility Tags: Staking, Rewards Distribution, Token Transfer

  1. stakingToken: Integer

  2. rewardsToken: Integer

  3. rewardRate: Integer

USES

  1. Staking Platforms: The contract can be utilized in staking platforms where users can stake their tokens and earn rewards over time.

  2. Yield Farming: The contract can serve as a component in yield farming protocols, allowing users to earn additional rewards by staking their tokens.

  3. Decentralized Finance (DeFi): The contract can be integrated into DeFi applications to provide staking and reward functionality for specific tokens.

  4. Incentive Mechanism: The contract can be used as an incentive mechanism to encourage token holders to lock their tokens for a certain period, thereby promoting token retention and community engagement.

Last updated