Welcome to the StakingDappYT project! This repository contains instructions for interacting with the smart contracts and deploying the DApp.
The StakingDappYT 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. Stakind Dapp Tutorial (Hindi)
-
Stake Token: This ERC20 token is used for staking within the DApp. Users need to approve this token for the staking contract before staking.
-
Reward Token: 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.
-
Generate Reward Tokens:
- Once the stake tokens are staked, the smart contract generates reward tokens per second based on the staked amount.
-
Accumulate Rewards:
- Users accumulate reward tokens over time as they keep their stake tokens staked within the DApp.
-
Claim Rewards:
- Users can claim their accumulated rewards by interacting with the smart contract using the
getReward()
function.
- Users can claim their accumulated rewards by interacting with the smart contract using the
-
Unstake Tokens:
- 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.
- Metamask: Install Metamask to access the DApp.
- Deploy the staking, stake token, and reward token smart contracts on Sepolia.
-
Copy and Paste ABI
- Copy the ABI (Application Binary Interface) of the staking contract and stake token contract.
- Paste the ABI files into the
src/ABI
folder.
-
Update Contract Addresses
- Update the contract addresses of the staking contract and stake token in the
utils/connectWallet.jsx
file.
- Update the contract addresses of the staking contract and stake token in the
-
Navigate to the Client Directory
cd client
-
Install Dependencies
npm install
-
Start the Development Server
npm run dev