The StakingDApp is a decentralized application that enables users to stake ERC20 tokens into the platform and earn rewards. The staking process generates reward tokens per second, rewarding users based on their staked amount and duration.
Open http://localhost:3000 with your browser to see the result.
- This ERC20 token is used for staking within the DApp. Users need to approve this token for the staking contract before staking.
- Another ERC20 token generated by the staking process per second. Users earn these tokens as rewards for staking their stake tokens.
- Stake Tokens: Users approve a certain amount of stake tokens to be staked within the DApp by interacting with the staking smart contract.
- Once the stake tokens are staked, the smart contract generates reward tokens per second based on the staked amount.
- Users accumulate reward tokens over time as they keep their stake tokens staked within the DApp.
- Users can claim their accumulated rewards by interacting with the smart contract using the getReward() function.
- After a staking period or at any point, users can unstake their tokens using the appropriate function in the DApp to retrieve their staked tokens along with the accumulated rewards.
- Before using the stake() function, ensure that you approve the stake token to the staking contract.
- Before using the getReward() function, transfer the reward token to the staking contract.
- Install Metamask to access the DApp.
- Deploy the staking, stake token, and reward token smart contracts on Sepolia.
- Copy the ABI (Application Binary Interface) of the staking contract and stake token contract.
- Paste the ABI files into the src/ABI folder.
- Update the contract addresses of the staking contract and stake token in the utils/connectWallet.jsx file.
- cd client
- npm install
- npm run dev