Mintable ERC20 token with properties of withdrawalFee and rewardRate for an Staking contract.
- Mintable.
- Withdrawal fee modifiable and can be enabled/disabled.
- RewardRate modifiable. Can also be disabled setting to 0.
Staking contract which receives and rewards with the same tokens.
- In deployment can set the startBlock.
- User can deposit multiple times.
- Withdraw send all the staked tokens and reward to the user.
Contracts deployed to https://testnet.bscscan.com/
- RewardToken deployed to: 0xe3ee3acce613E5fab3a9225619A792b796aA9A37
- Staker deployed to: 0x28bcB704BB6D70562c1D61B48A858C46a1c9a204
- Start block: 20156079
- Hardhat
- ethers.js
- @openzeppelin/contracts
- hardhat-gas-reporter
- Clone repo:
git clone https://github.com/leanonchain/solidity-challenge.git
- Install dependencies:
yarn
- Compile:
npx hardhat compile
- Test:
npx hardhat test
- Create .env file with:
BSC_TESTNET_RPC = ""
BSC_TESTNET_API_KEY = ""
PRIVATE_KEY = ""
npx hardhat run --network bsc_testnet scripts/deploy.js
- Testing refactor with typescript and remove redundant code.
- Harvest function and partial withdraw. This could be easily implemented but as I understood the requirements was for a withdraw function of all the staked tokens.