Giter Club home page Giter Club logo

erc20-staking's Introduction

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!

erc20-staking's People

Contributors

andreitoma8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

erc20-staking's Issues

Compiler error

I'm getting this error when I compile.

Unable to compile OpenZeppelin/[email protected] due to a CompilerError - you may still be able to import sources from the package, but will be unable to load the package directly.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.