# Scaling DeFi
### DeFi and demand spikes
Ethereum currently has severely limited transcation throughput. Demand for transaction volume is handled with a transaction fee market - you pay more to push your own transcactions through. During certain times, demand spikes can cause fees to spike 20x the even high fees during periods of steady demand. Simple token transfers go from $30 to $600 and depositing into money markets like Aave go from $100 to $2000. Borrowing stablecoins against ETH collateral is the bread and butter of earning safe DeFi yield. You may borrow $40k against $100k worth of ETH only for the ETH value to suddenly drop to be worth $50k and at risk of liquidation. Since everyone is now rushing to escape liquidation (exit their yield positions, pay back loan, etc) this becomes a very expensive environment in fee terms, exactly when you need to transact. To protect against this you would need to maintain a very high collateral ratio, which is capital inefficient (now you only have $25k to earn yield with, for example) or you bear the risk of paying $5k in fees.
### L2
The approach to solving the limited transacation throughput problem (and reducing fees) is multi-faceted and involves both base layer (L1, or Ethereum mainnet) improvements, as well as the use of secondary networks (L2) that tie back in to the base layer. Base layer improvements are technical upgrades, most importantly [sharding](https://vitalik.ca/general/2021/04/07/sharding.html). L2 refers to competing networks, with competing technology, that connect back in (transfer tokens back and forth) and also leverage the security of the base layer. While we have to wait for Ethereum mainnet upgrades the L2 networks are coming online now and users and DeFi infrastructure is being deployed on them. This is a dynamic and competitive environment, but important networks seem to be the current, live [Polygon/Matic](https://polygon.technology/) chain and the yet to be released [Optimism](https://optimism.io/) and [zkSync](https://zksync.io/) solutions (see more about [rollups](https://vitalik.ca/general/2021/01/05/rollup.html)).
### Polygon
Polygon has a taken an aggresive approach to gaining market share by incentivising projects to deploy and users to transact on it's network. Key [DeFi intrastructure](https://defiprime.com/polygon) like money markets ([aave](https://app.aave.com/markets)), stablecoin swaps ([curve](https://polygon.curve.fi/)), tokens swaps ([sushiswap](https://app.sushi.com/swap)), dex (swap) aggregators ([paraswap](https://paraswap.io/#/?network=polygon)), yield aggregators, [etc.](https://defiprime.com/polygon) have been deployed on Polygon. To use them we first need to [bridge our tokens](https://wallet.matic.network/bridge/) to the Polygon network. This will involve at least 1 mainnet transactions but after that transacting using these applications will be much cheaper.
### Aave + Curve on Polygon stablecoin LP yield farming
Aave and Curve are considered blue chip defi projects, among the best, and this is bread and butter stablecoin LP yield farming. Yield is a solid ~47% on the borrowed stablecoin + 4.2% on the deposited ETH. You would need to watch the the health factor in Aave, if ETH goes down and the health factor goes below 1, the position would be liquidated (with associated 5% penalty for ETH), your deposited ETH would be sold to cover the debts.
1. Go to the [Matic Wallet app](https://wallet.matic.network/)
2. Follow instructions to connect MetaMask (or possibly WalletConnect w/dharma will work?)
3. click `Move funds to Matic Mainnet`.
4. Select ETH (or other asset), set amount and complete transcation, following instructions. Wait 7-8min for transfer to complete.
5. At this point you'll need some MATIC to pay for transcations on Matic (Polygon). Let me know and I can send a few. Just a few $ worth is pretty much all you'll need.
6. Go to [Aave](https://app.aave.com/markets)
7. Change to the Aave Market Polygon (logo in top right)
8. You may need to switch Metamask to the "Matic Network". If you don't see it in the Metamask dropdown you can add it as an option [here](https://chainlist.org/), find Matic Mainnet, connect metamask and click add to metamask.
9. Deposit all WETH (ETH on Polygon uses "wrapped ETH", they are equivalent)
10. Borrow DAI, targeting health factor >1.5 (i used 1.5). Borrow less, less earning but higher safety buffer. Divide the current price of ETH by the health factor to get the price that ETH would need to drop to before liquidation would occur. So if health factor is 1.5 and ETH is $2500 then if ETH drops to $1667 you would be in danger of liquidation. You can easily prevent this by repaying some debt at any time, though, or boosting the ETH collateral.
11. Go to the [deposit page](https://polygon.curve.fi/aave/deposit) for Curve - Aave pool on Polygon
12. Select Max DAI and click `Deposit and stake in gauge`. I needed to sign about 4 transactions here.
13. Congrats you are now earning ~43% on the borrowed DAI in curve + 3.8% net (7.8-4) from Aave, as well as 4.2% on the deposited ETH. This yield will come mostly in the form of MATIC tokens. You can of course keep these or swap them, probably using [Sushiswap on Polygon](https://app.sushi.com/swap), to whatever you like (ETH).
If you get stuck or don't have enough MATIC to complete the transactions let me know I will send you some.
Don't get liquidated. If eth price drops you can easily just [withdraw](https://polygon.curve.fi/aave/withdraw) some dai from curve and pay back some debt to increse the health factor. That's why this is pretty low risk kind of yield farming, especially where tx costs are so low.