Down the Rabbithole: AAVE Polygon
===
###### tags: rabbithole
[TOC]
# The Quest
![](https://i.imgur.com/7KhdytY.png)
You can check it out [here](https://app.rabbithole.gg/quests/aave-v2-polygon)
>Total time taken: 1h
Total gas cost: 0.0129ETH, ~40USD
And you get 0.05AAVE which is currently 20USD :(
You'll learn
1. Using Polygon with [Zapper](https://zapper.fi/dashboard/)
2. Using AAVE
* [For Lending](https://rabbithole.mirror.xyz/mZCDlb_eBIqefr2l2J4cQ68HPf3mtbF0ghlNJ5LNpQ8)
* [For Borrowing](https://rabbithole.mirror.xyz/DFOiXdxdNQmY-NlopQCVvU9MM7XJzPmrdqPzZ896zQ0)
For each item its really a four step process (more or less) so this task didn't take too long.
# What is [AAVE Polygon?](https://app.aave.com/markets)
> Aave is a decentralized finance (DeFi) protocol that lets people lend and borrow cryptocurrency without having to go through a centralized intermediary. When they lend, they earn interest; when they borrow, they pay interest. ([Decrypt](https://decrypt.co/resources/what-is-aave-inside-the-defi-lending-protocol))
So really, its like a bank account. You deposit assets and straight away its being used to lend out. You can also borrow assets from the pool/bank.
## Lending?
So you lend by depositing into AAVE. I sorted by Deposit APY.
[APY vs APR?](https://www.investopedia.com/personal-finance/apr-apy-bank-hopes-cant-tell-difference/)
$APR=\text{Periodic Rate}*\text{Number of Periods in a Year}$
$APY=(1+\text{Periodic Rate}^{\text{Number of Periods}})-1$
Basically, $APY$ takes into account the effects of compounding therefore it is slightly higher.
![](https://i.imgur.com/dRuMffo.png)
[How much will I earn?](https://docs.aave.com/faq/depositing-and-earning#how-much-will-i-earn)
aTokens holders receive continuous earnings that evolve with market conditions based on:
- The interest rate payment on loans - depositors share the interests paid by borrowers corresponding to the average borrow rate times the utilisation rate. The higher the utilisation of a reserve the higher the yield for depositors. Check this spreadsheet to see the borrow interest rate model in action.
- Flash Loan fees - depositors receive a share of the Flash Loan fees corresponding to .09% of the Flash Loan volume.
**Interesting that they mentioned the possibility of [gas costs](https://docs.aave.com/faq/depositing-and-earning#is-there-a-minimum-or-maximum-amount-to-deposit) and I suppose this is one of the learning objectives here about Polygon having lower gas fees than Ethereum thus making it easier to use these Dapps.**
## Borrowing?
[How much I can borrow?](https://docs.aave.com/faq/borrowing#how-much-i-can-borrow)
The maximum amount you can borrow depends on the value you have **deposited and the available liquidity.** For example, you can’t borrow an asset if there is not enough liquidity or if your health factor doesn’t allow you to. You can find every collateral available and its specific parameters for borrowing in the risk parameters section.
**This is really smart because this makes for great capital efficiency. What you deposit is lent out and acts as collateral for you**
[What asset do I need to repay?](https://docs.aave.com/faq/borrowing#what-asset-do-i-need-to-repay)
You repay your loan in the same asset you borrowed. For example, if you borrow 1 ETH you will pay back 1 ETH + interest accrued. You can also use your collateral to repay in the new version 2 of Aave Protocol. If you want to pay back the loan based on USD price you can borrow any of the available stable coins as USDC, DAI, USDT, etc.
**Okay makes sense too because this isn't a swaps/DEX protocol**
**So for this quest, I'm not sure how long I have to borrow this for and if i'll be paying off the interest of it. My plan here is to get the yield from lending and pay off this loan asap...I'm mentally prepared to lose some money borrowing.**
# Pre-Task: Bridging Eth and Polygon
1. Using [Zapperfi bridge](http://zapper.fi/bridge) from Eth to Polygon
2. I bridge 230 DAI because I thought I would be using 130 DAI for depositing and borrowing off the 100 DAI. *This assumption would turn out to be wrong later!*
3. Now I made a mistake here by now bridging MATIC. You need MATIC to pay for gas costs even though it might be very low. So don't make that mistake! I briged about 60USD in MATIC... I've a feeling rabbithole might have more quests on Polygon.
# Task 1: Lending Assets on AAVE
1. Go to [Deposit](https://app.aave.com/deposit) on AAVE
2. Ah mistakes made, I was looking at the wrong market! Luckily the borrowing rates were somewhat similar for DAI. In fact, it was much higher. My guess is because it's harder to find DAI on polygon so some people would rather use DAI for things here.
![](https://i.imgur.com/WufWBia.png)
3. So here's where I realise I messed up. Remember I said I bridged DAI? I forgot to bridge MATIC. So I had to go back to my pre-task and do this first.
4. Approve AAVE
![](https://i.imgur.com/EMonkTr.png)
5. If you try and deposit right after approval, you're gonna fail the transaction so go back and do it again. It will work!
![](https://i.imgur.com/s4YpnFY.png)
# Task 2: Borrowing Assets on AAVE
1. Since I've no real use for MATIC now I just thought to borrow a token some and try it out
![](https://i.imgur.com/yPQ7tsg.png)
2. I don't have much of a choice for interest rate so I took the variable rate. I note that the interest I earn off my DAI would easily pay off the MATIC interest accrued
![](https://i.imgur.com/GQlsyxc.png)
3. ERROR. So apparently I faced an error... not sure what happened but when I went back to the dashboard it was alright!
![](https://i.imgur.com/EtFdAHD.png)
4. However then you check it, you've actually borrowed MATIC already
![](https://i.imgur.com/B6Q0ixs.png)
# Roundup
Now all you have to do is go back and redeem the tasks, the quests, and check if your address is on it! That's all for today's quest. It was incredible that almost all the NFTs were redeemed in <6h. Great job to the Rabbithole team once again.
1. When the sun lights up, this means you're done! It took about 3 minutes for it to show up
![](https://i.imgur.com/dO1GDX4.png)
2. Remember to click Redeem on each individual task
![](https://i.imgur.com/qqdyplk.png)
3. AND on the quest itself!
![](https://i.imgur.com/0OUl2jU.png)
4. Now just because I'm paranoid, I check that my address is actually on the redeemer list... and realise i'm number 1700+ This quest has only been up for less than a day (about 4 hours)!
![](https://i.imgur.com/zG5zTbY.png)
Some additional notes. I remember during EthCC there was quite a conversation about the "Log in with Ethereum" concept and I saw it in action with Zapper today. Zapper had all my transaction logs and I could just straight away start using it. This decentralisation/control over your own account is quite powerful.