https://m-brantheim.github.io/blockchain-developer-bootcamp-final-project/
- Node.js Active LTS or later is recommended, so >= v16
- Yarn
- Run
yarn install
in project root to install Hardhat, Ethers, React, Chai, Waffle etc - Make sure your .env file contains a PRIVATE_KEY variable with a string value, might not need to be a real private key since the hardhat deploy is on a fork of mainnet but some value is needed or hardhat will throw errors
- Run a mainnet fork in order to test using the mainnet deployed versions of Uniswap + USDC
npx hardhat node
<- This forks mainnet using my alchemy API key, Alchemy support archive nodes which is needed for forking mainnet.npx hardhat test --network localhost
<- This tests using the localhost mainnet fork blockchain
yarn install
yarn start
- Open
http://localhost:3000
The app will check which network you are on and display a warning if you are not connected to the site on Rinkeby. If you switch network then refresh the app manually as it does not detect changes.
https://www.loom.com/share/c276772bcd5a447cb43daff69ed872d4
0x8cA0c27a7a868A4069967709B5592995A69aE006
A simple farm using Uniswap V2. In the farm app the user can swap ETH -> USDC, provide liquidity for the ETH-USDC pair and also remove that liquidity when added. The app in it's current state does not offer any advantage compared to directly using Uniswap, however it serves as the foundation to build more advanced functionality such as added yield from custom farm token emission or possible yield optimization features such as switching LPs based on estimated returns.
- In swap tab enter USDC amount and press swap, ETH will be deducted and USDC added to your wallet
- In the add liquidity tab press approve button to allow spending of USDC
- In the add liquidity tab enter USDC amount to provide LP, the ETH amount will be calculated, press Add Liquidity button and confirm. LP token will be held by the contract but the UI will update and display LP amount.
- In the remove liquidity tab enter LP amount to remove and press Remove Liquidity button and the corresponding amount will be removed and USDC+ETH added back to wallet.
src
: React frontend.public
: Regular web app folder for ex favicon, index.html etcscripts
: Holds the deploy scriptcontracts
: Smart contracts that are deployed on the Rinkeby testnet.library
: Smart contract libraries from OpenZeppelin like ERC20, SafeMath, Address. They could perhaps have been stored in node_modules but I had some bug so it only worked if I included the contracts directly here. I take no credit for this code.abi
: Holds the ERC20.abi Used for the USDC contracttest
: Contains the chai Smart Contract tests
PRIVATE_KEY = "Your private key here"
This variable must be on the process.env variable. I use a .env file which is added to Gitignore to keep the key private.
-Display of estimated daily, weekly, yearly yield
-A custom farm token with emission as a boosted reward
-Zap feature that takes one token, for example ETH, swaps into equal halves required for LP token and conversion to LP token all in one step for the user
-Extra farm info like TVL, your share of farm etc
-https://app.beefy.finance/#/fantom
-https://spookyswap.finance/farms
-https://app.spiritswap.finance/#/farms