Skip to content

andreitoma8/ERC20-Staking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ERC20Stakeable Smart Contract.

The goal is to create a ERC20 Stakeable library easy to implement for any token.

This Smart Contract is not Audited!

Created using OpenZeppelin ERC20 Smart Contract and ERC20Burnable extension.

Inspired by Patrick Collins' DeFi-minimal Staking.sol.

Features for users:

  1. Deposit the ERC20 Token and gain a fixed APR calculated hourly.
  2. Compound your rewards.
  3. Claim your rewards.
  4. Withdraw a part of deposit.
  5. Withdraw all(your deposit + rewards).

Features for owner:

  1. Set a fixed APR.
  2. Set a minimum stake amount.
  3. Set compounding frequency limit.

How to use?

Prerequisites:

Rinkeby deployment
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

Installation

Clone this repo:

git clone https://github.com/andreitoma8/ERC20-Staking
cd ERC20-Staking

Deploy to Rinkeby

  • 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

Any feedback is much apreciated!
If this was helpful please consider donating:

0xA4Ad17ef801Fa4bD44b758E5Ae8B2169f59B666F

Run test locally on Ganache

For unning local tests you also need:
npm install -g ganache-cli

or, if you are using Yarn

yarn global add ganache-cli
  • NodeJS. To verify NodeJS installation run
node --version
Test scripts
  • Run the command:
brownie test testes/test.py

The test will assert the following:

  1. Contract deployment
  2. Initial staking transaction
  3. Rewards calculation in 100 H
  4. Compound rewards transaction
  5. Withdraw rewards transaction
  6. Withdraw all transaction

Happy hacking!

About

ERC20 Library with Staking functionality

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published