is everything you need to get started building decentralized applications powered by smart contracts
git clone https://github.com/austintgriffith/scaffold-eth.git
cd scaffold-eth
yarn install
yarn start
in a second terminal window:
cd scaffold-eth
yarn chain
in a third terminal window:
cd scaffold-eth
yarn deploy
You can interact with the initial version of the DeFi Facet which demonstrates 2x leverage through v1 Aave Uniswap Market.
A sample defi facet zap transaction on ropsten.
Basically it enables people to write contracts with virtually no size limit in a modular and gas-efficient way.
Diamonds can be upgraded on the fly without having to redeploy existing functionality.
Now in a real scenario a diamond has many faces known as facets so just like that facets here are contracts that you interact with, upgrade etc through the diamond contract.
Diamond Cut is a style guide used to shape diamonds just like that to add, remove, modify any facet. We have a Diamond Cut Facet used to do the same so you can upgrade facets without any hassle.
Before diving into the UI and contracts, I will recommend to go through the EIP to have a complete understanding of the same.
For demonstration purposes, the current Facet linked with the UI is a DeFi which uses Aave Uniswap Market to leverage 2x by just depositing ETH, and it can be upgraded by redeploying it again(go through deploy.js in detail) after changes and choosing the right upgrade action in UI.
The upgrades are done currently by directly calling the Diamond Cut Facet.
The leverage logic is as follows:
- swap half of eth to stable coin
- add liquidity to uniswap
- deposit a-uni tokens to aave
- safe borrow stable coin
- swap half of stable coin to eth
- add liquidity again to uniswap in same pool
- deposit a-uni token again to aave