- Here I have created three smart contracts:
-
StakeToken.sol: simple ERC20 tokens
-
RewardToken.sol: simple ERC20 tokens
-
Staking.sol: This smart contract consists of approve, withdraw, get a reward, and stake functions.
-
It uses the staking algorithm which calculates the reward/sec.
`Reward token =(amount staked by user/total staked amount)*reward rate` `reward token=(S/T)*R`