Skip to content

0xBonanza/Solidity-erc20-staking

Repository files navigation

ERC20 Staking

General

This contract allows users to stake their ERC20 tokens to Aave and offer their benefits to the DAO contract. 

Lender.sol

The contract is used so the user can stake/withdraw ERC20 tokens to AAVE.

Any amount deposited by the user is the amount he'll be able to withdraw.

All staking benefits are kept by the DAO to be distributed to shelters (see main project).

Dependencies

This contract mostly depends on the IERC20.sol interface and Ownable.sol contract from OpenZeppelin.

It also relies on ILendingPoolAddressesProvider.sol and ILendingPool.sol from Aave V2. 

.env file

Make sure you have a .env file in your working directory containing:

  • export PRIVATE_KEY="YOUR_KEY"
  • export WEB3_INFURA_PROJECT_ID="YOUR_INFURA_ID"
  • export ETHERSCAN_TOKEN="YOUR_ETHERSCAN_TOKEN"

NB: the ETHERSCAN_TOKEN is only needed if you want your contract to be verified upon deployment. 

Deployment

The contract has been deployed successfully on Kovan test network at the following address: 0x81F73B077Ed4B38239B2dbd0724F408B5E806beA

REACT Front-end

This contract can be used by using the front-end of this repo (to be added ...)

How to use?

This contract has been created by using Python and Brownie. So you should consider using both these tools to reproduce the exact result.