Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/masaun/forcedao-yield-farming-strategy-on-polygon

This is a smart contract that deal with a yield farming strategy which is using AAVE and Polycat.finance on Polygon.
https://github.com/masaun/forcedao-yield-farming-strategy-on-polygon

aave forcedao matic polycat polygon solidity truffle web3js

Last synced: 3 months ago
JSON representation

This is a smart contract that deal with a yield farming strategy which is using AAVE and Polycat.finance on Polygon.

Awesome Lists containing this project

README

        

# ForceDAO Yield Farming Strategy on Polygon
## 【Introduction of the ForceDAO Yield Farming Strategy on Polygon】
- This is a smart contract that deal with a yield farming strategy which use AAVE and Polycat.finance on Polygon.
- A user create a new Yield Farming Strategy contract via the Yield Farming Strategy Factory contract.
- A user can earn `double rewards` from the `AAVE Market` and `Polycat.finance` .
(In terms of the Polycat, this smart contract assume that use the single staking pool of the Polycat.finance in order to earn rewards. By the way, rewards token on Polycat.finance is the `Fish Token` : https://polycat.finance/pools )

 

***

## 【Workflow】
- Diagram of workflow:
![diagram_ForceDAO](https://user-images.githubusercontent.com/19357502/124762179-963de480-df6d-11eb-95fe-0e58fc46030f.jpg)

 

***

## 【Remarks】
- Versions
- Solidity (Solc): v0.6.12
- Truffle: v5.1.60
- web3.js: v1.2.9
- openzeppelin-solidity: v3.4.1
- ganache-cli: v6.9.1 (ganache-core: 2.10.2)

 

***

## 【Setup】
### ① Install modules
- Install npm modules in the root directory
```
npm install
```


### ② Compile & migrate contracts (on local)
```
npm run migrate:local
```


### 【Script for the DEMO of workflow】
- 1: Get API-key from Infura
https://infura.io/

- 2: Setup Add-on for Polygon Mumbai in Infura
- How to setup Add-on for Polygon Mumbai in Infura: https://blog.infura.io/polygon-now-available/


- 3: Add `.env` to the root directory.
- Please reference how to write from `.env.example` . (Please write 3 things below into `.env` )
- MNEMONIC (Mnemonic)
- INFURA_KEY (Infura key)
- DEPLOYER_ADDRESS (Deployer address)
https://github.com/masaun/forceDAO-yield-farming-strategy-on-polygon/blob/main/.env.example


- 4: In advance, Please check `MATIC token balance` of `executor's (user's) wallet address` .
- Idealy, MATIC tokens balance is more than `1 MATIC` .
- Matic fancet: https://faucet.matic.network/ (Please select Mumbai network)


- 5: Get DAI on Polygon mumbai testnet by using the Fancet on Pods.
(Please following this article. Especially, part of `"Getting Mumbai USDC, ETH and other faucet tokens"` in this article is explanation about the Fancet: https://blog.pods.finance/guide-connecting-mumbai-testnet-to-your-metamask-87978071aca8 )


- 6: Execute a script
```
npm run script:YieldFarmingStrategy
```


## 【Demo Video】
- This is a demo video of the script above ( https://github.com/masaun/forceDAO-yield-farming-strategy-on-polygon#-script-for-the-demo-of-workflow ).
https://youtu.be/iBJ70bOmuLc


## 【Unit test (on local)】
- 1: Start ganache-cli
```
$ ganache-cli -d --fork https://polygon-mainnet.infura.io/v3/{YOUR INFURA KEY}@{BLOCK_NUMBER}
```
(※ `-d` option is the option in order to be able to use same address on Ganache-CLI every time)
(※ Please stop and re-start if an error of `"Returned error: project ID does not have access to archive state"` is displayed)


- 2: Execute test of the smart-contracts
```
npm run test:YieldFarmingStrategy
```
( `truffle test ./test/test-local/YieldFarmingStrategy.test.js --network local` )


```
npm run test:MasterChef
```
( `truffle test ./test/test-local/polycat/MasterChef.test.js --network local` )


***

## 【References】
- ForceDAO
- Website: https://www.forcedao.com/
- GR10 Prize from ForceDAO: Build your own yield farming strategy on Polygon: https://gitcoin.co/issue/ForceDAO/bounties/4/100025917


- AAVE
- Deployed-addresses on Polygon Mumbai: https://docs.aave.com/developers/deployed-contracts/matic-polygon-market
- Liquidity Mining: https://docs.aave.com/developers/guides/liquidity-mining


- Polycat
- dApp (Single Token Staking Pool): https://polycat.finance/pools
- Smart contract (Github): https://github.com/polycatfi


- Infura
- How to setup Add-on for Polygon in Infura: https://blog.infura.io/polygon-now-available/
- Network address via Infura
- Polygon Mainnet: `"https://polygon-mainnet.infura.io/YOUR-PROJECT-ID"`
- Polygon Mumbai: `"https://polygon-mumbai.infura.io/YOUR-PROJECT-ID"`
https://infura.io/docs/ethereum#section/Choose-a-Network


- Fancet on Polygon Mumbai
- Getting Mumbai USDC, ETH and other faucet tokens on Pods
https://blog.pods.finance/guide-connecting-mumbai-testnet-to-your-metamask-87978071aca8