Created using OpenZeppelin ERC20 Smart Contract and ERC20Burnable extension.
Inspired by Patrick Collins' DeFi-minimal Staking.sol.
- Deposit the ERC20 Token and gain a fixed APR calculated hourly.
- Compound your rewards.
- Claim your rewards.
- Withdraw a part of deposit.
- Withdraw all(your deposit + rewards).
- Set a fixed APR.
- Set a minimum stake amount.
- Set compounding frequency limit.
- Python
- Brownie
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# restart terminal
pipx install eth-brownie
- A free Infura Project Id key for Rinkeby Network
Clone this repo:
git clone https://github.com/andreitoma8/ERC20-Staking
cd ERC20-Staking
-
Add a
.env
file with the same contents of.env.example
, but replaced with your variables. -
Run the command:
brownie run scripts/deploy.py --network rinkeby
The script will deploy the token, mint 1.000.000 for yourself and verify the Smart Contract on .rinkeby.etherscan.io
0xA4Ad17ef801Fa4bD44b758E5Ae8B2169f59B666F
npm install -g ganache-cli
or, if you are using Yarn
yarn global add ganache-cli
- NodeJS. To verify NodeJS installation run
node --version
- Run the command:
brownie test testes/test.py
The test will assert the following:
- Contract deployment
- Initial staking transaction
- Rewards calculation in 100 H
- Compound rewards transaction
- Withdraw rewards transaction
- Withdraw all transaction