1. Interfaces: The IERC20 interface is used to interact with ERC-20 tokens for staking and rewards. Staking Logic:
  2. stake(uint256 _amount): Users can stake a specified amount of tokens.
  3. withdraw(uint256 _amount): Users can withdraw their staked tokens.
  4. exit(): Users can withdraw all their staked tokens and claim their rewards. Reward Logic:
  5. rewardPerToken(): Calculates the reward per token based on the time since the last update. earned(address account): Calculates the total rewards earned by a user.
  6. getReward(): Allows users to claim their earned rewards.
  7. Modifiers: updateReward(address account): Updates the reward calculation for a user.

Built With

Share this project:

Updates