Frontrun

Share this post

Ethereum essentials: How to borrow, lend and measure risk

www.frontruncrypto.com

Ethereum essentials: How to borrow, lend and measure risk

Part 3 of the Ethereum essential series: Lend, borrow, and borrow again on AAVE and Arbitrum. We explore how to turn $100 of eth into $200 of exposure in a responsible YOLO-minimized guide

John Cook
Sep 18, 2022
1
Share this post

Ethereum essentials: How to borrow, lend and measure risk

www.frontruncrypto.com

Dear frontrunners,

Our journey to wealth in crypto is measured in knowledge (learning) and conviction (doing). Conviction without knowledge is arrogance (YOLO) and knowledge without conviction is insecurity: think of all the people who are smarter than you but have not realized their full potential. Is this you? Why does this happen?

Level up your crypto knowledge & master the future of decentralized finance.

In this guide, we’re going to go deep on borrow/lending and leverage in Ethereum. How it works, what it looks like at the transaction level, and how to do it, while analyzing the risks, outcomes, and impact of every trade. Specifically, we turn ~$100 USD or .07 eth into ~$200 USD or ~ .156 eth as outlined in image 1 below. $100 is enough money to force you to pay attention but not too much to keep you up at night. At the conclusion of this guide, you will have a fundamental understanding of how lending and leverage work, and clear insight into the mind of a degen.

Moreover, the amounts are small enough for you to follow along without getting rekted while also providing a deep understanding borrow/lending mechanics and associated fees.

Image 1 - entry-level DIY degen 2x leverage

We’ll be using Aave since its user-facing platform draws parallels to the traditional finance borrow/lending paradigm. DeFi-specific concepts like the liquidity pools, farms, safety modules, and balancer pools will be covered in a separate, but an equally important guide.

Remember, our goal as frontrunners is to have high knowledge and high conviction. We do this by rejecting participation inequality, we do this through hands-on experience in the defi ecosystem.

This guide is part 3 of the Frontrun Ethereum-essentials handbook:

  • Guide 1 - Gas fees, etherscan, and centralized exchanges

  • Guide 2 - layer 2 roll-ups and corresponding fees

  • Guide 3 - Leverage 101: Lend, borrow and borrow again 👈👈 you are here

📚 This guide will cover

  • How to lend ETH on Aave

  • How to borrow ETH against the collateralized ETH

  • How to lend back the borrowed ETH

  • How to repeat this process 4x for a 2x exposed position

  • A speed run on how debt and collateral tokens are minted and burned

🧰 Tools you will need

  • A spreadsheet - I use google sheets

  • Aave - A borrow/lending platform on Ethereum

  • Arbitrum - Our layer 2 of choice for this guide

  • Arbiscan - blockchain explorer to assess fees and contract interaction on Arbitrum

  • A web wallet like metamask

Share

✔️Checkpoint

By now, you’ve built foundational knowledge on transaction fees, decyphering etherscan, and how crypto moves between centralized exchanges (like coinbase) into lending platforms like Aave. We now have confidence in how to derive the gas fees paid per transaction and how our web wallets interact with smart contracts.

Moreover, we understand the benefits of transacting on layer-2s like Arbitrum: we spend less per transaction while benefiting from the security of Ethereum as the settlement layer. We also understand how lending platforms like Aave mint deposited collateral and issue debt via its “Aave wrapped Ethereum” and “Aave wrapped variable eth debt”.

🛑 STOP - Can you review transaction details on etherscan, assess the gas fees against your own calculations? Do you understand how Aave’s lending platform mints and burns its collatoralized tokens? If the answer is no, read guide 1 and guide 2 before proceeding. We’ll be here when you’re ready, promise!

Be warned.

We have also reviewed the risks of staked Ethereum as the basis for larger degen activities and wealth destruction experienced over the first six months of 20022. Across crypto-twitter and the interwebs at large, it’s the same story; under collateralization and over-leveraged trading positions as a catalyst for the 2022 crypto winter: 3AC, Celsius, blockFi, etc.

You’ve also read our analysis on the 2022 crypto winter titled ‘Welcome back to work diamond hands’, because you are grounded in the reality that we are doomed to repeat history if we do not learn from our mistakes.

You understand that retail traders are not the victims. The proliferation of superficial guides outlining ‘how to leverage eth’ more or less follows the theme below:

  • “goto the website, click deposit, click borrow, click deposit, click borrow” or

  • "goto the website, buy this token, the token will automagically create a liquidity pool pair, deposit it, borrow against it, and deposit it”

In reality, traders and crypto enthusiasts in the most recent meltdown had no idea of what was actually happening under the hood. If this is you, now is your time to course-correct or you will get rekted in the next cycle.

Inside DeFi Yield Farming: A Beginner's Guide to the Latest Craze in DeFi
Image 3 - Ponzinomics 101

You’ve been warned.

🤔 Assumptions of the trade

We will turn ~$100 of Ethereum to produce ~$200 of Ethereum exposure as follows:

  • A $100 deposit to borrow $50

  • A $50 deposit to borrow $25

  • A $25 deposit to borrow $10

  • A $10 deposit to borrow $5

Each trade is limited to 50% of the deposit amount. Although you can borrow up to 82.5% of the collateralized amount (this is called a “liquidation threshold”), it creates a scenario where a 2% swing in the wrong direction will put you at risk of automatic liquidation.

Step 1 - Review your current wallet balance in Aave

  • Navigate to Aave

  • Switch the ‘market’ to version 3 - Arbitrum

  • Open Arbiscan

  • Open Etherscan

  • Open your spreadsheet

  • Confirm the eth balance in your web wallet matches the eth balance in the Aave dashboard and Arbiscan account summary

We are confident that the current balance in our web wallet is .0904405, and we’ve cross-checked in both Aave and Arbiscan. Details here for those who need a recap.

Image 4 - Reviewing Aave’s arbitrum market dashboard to cross-check our assets to supply - source: aave.com

Step 2 - Supply .07 eth

  • Click the ‘supply’ button under the “assets to supply” section for the “ETH” asset type

We can see at a price per coin of ~$1577.88, .07 eth will yield ~$111.89 Ethereum, which we will use as leverage.

Image 5 - Impact to eth supply after clicking the ‘supply eth’ button: ‘assets to supply amount goes down by .07 and ‘supplied eth’ amount goes up by .07 - source aave.com

🤙 Note: that the annual percentage yield (APY) is AAVEs’s “borrow interest rate” and is based off ethereum’s utilization rate (the amount of ethereum borrowed / the amount of ethereum pledged as collateral). The higher the utilization rate, the higher APY. This “interest rate algorithm” is a mechanism of the platform to discentivize borrowing and avoid cascading liquidations.

Want to learn more? Read this.

Let’s pause for a moment to review what happened to the '.07 eth” when we clicked the ‘supply button’. An easy way to perform this review is to use a spreadsheet compare your wallet balance before and after the transaction.

Before supplying .07 eth:

  1. Our eth wallet balance was .090440533 eth

  2. Our ‘aave arbitrum wrapped eth’ (aArbWETH) balance is .000565525

After supplying .07 eth:

  1. Our eth wallet balance decreases to .02039882325 eth

    original eth amount - eth supplied to aave - gas fee  = .090440533 -  .07 - 0.0000417093 
  2. Our aArbWETH increases to .070565559

    original aArbWETH amount + eth supplied to aave = 0.000565525 + .07 = 0.07056555401

Calculating the flow of money across the impacted tokens using a table like the one below is useful in quantifying fees:

Image 6 - Impact to aArbWETH and ETH balance after supplying .07 eth

🛑 STOP - Do you understand what aave does when you supply eth to the platform? Are you able to assess the change in your wallet balance across ETH, aArbWETH when taking into account the transaction amount and gas fees? Do not proceed until you’ve documented this in your spreadsheet.

Share

Recall that “aArbWETH” is the token the Aave smart contract mints when you click the “supply eth button”. You are giving AAVE eth and getting an IOU in return called aArbWETH. When we explore arbiscan, we can see an ERC-20 token called "AAVE Arbitrum wrapped eth” has been added to our token balance, while our eth balance has decreased by the supplied amount (.07 eth).

Image 7 - Review the impact to our wallet after the deposit and see our eth balance has decreased but our AAVE Arbitrum wrapped ETH balance has increased - source arbiscan

Step 3 - Borrow .035 eth

  • Click the ‘borrow’ under the ‘assets to borrow’ corresponding to the asset type ‘ETH’

How much Ethereum is available to borrow? The answer is the sum of the aArbAWETH token or approximately .070565559 eth. The lending platform only considers supplied tokens as part of the total collateralized amount. This is derived via the AAVE-prefixed eth tokens like “aArbAWETH” and not “ETH”. Ethereum in our wallet that has not been supplied is not included.

Image 8 - Impact to eth after borrowing .035 eth - borrowed amount goes up but eth assets available to supply also goes up! - aave.com

What happens to our token balance when we initiate a ‘borrow eth’ transaction? What tokens are impacted?

After borrowing .035 eth:

  1. The “Aave Arbitrum WETH” balance remains unchanged at 0.070565559

  2. Our ETH balance increases to 0.05534026395

    new eth balance = original eth balance + amount of eth borrowed - transaction fees = 0.02039882325 + .035 - 0.0000585593 = 0.05534026395 eth
  3. Our Aave Arbitrum Variable Debt WETH increases to 0.06501191864

    original debt balance + new debt balance = 0.0300117328 + .035 =  0.06501191864 eth
Image 9 - impact to aArbWETB, ETH variableDebtArbWETH tokens after borrowing .035 eth

🚩 At the end of this step, our eth exposure has increased by 50%. We now have 1.5x leverage on our eth: the .07 aArbWETH plus the .035 eth borrowed.

🛑 CALL OUT - We’ve introduced a new AAVE token called “variableDebtArbWETH” which represents the amount of eth borrowed. This new token was minted to offset the increase in eth. Once accounting for transactions fee, the amount of the variableDebtArbWETH token is greater than the newly deposited eth.

Step 4 - Supply back .035 eth

  • Click the ‘supply’ button under the “assets to supply” section for the “ETH” asset type

Image 10 - Impact to eth after lending back .035 eth: supplied amount goes up and assets to supply goes down source - aave.com

At this point, we call out that our health factor (an indicator Aave uses to quantify default probability) increased from 1.58 to 2.03, because we are increasing our supply pool of eth. But aren’t we increasing it with the debt we just borrowed? 🤣

Setting aside Aave’s lending and safety algorithm for another day, what is the impact on the token balance in our wallet?

After supplying .035 eth:

  1. Our eth wallet balance decreases to .02039882325 eth

    eth balance - amount eth supplied - gas fees = 0.05534026395 - 0.035000 - 0.0000437  = 0.02029655335 
  2. Our aArbWETH increases to 0.105565572 eth

    current aArbWETH balance = original balance + newly supplied amount = 0.070565564 + .035 = 0.105565572
  3. Our variableDebtArbWETH remains unchanged

Image 11 - impact to aArbWETB and eth after lending back .035 eth

🚩 At the end of this step, our eth exposure has not increased. We are still at 1.5x leverage but improved our health factor by depositing back the borrowed eth as collateral.

Step 5 - Borrow .0175 eth

  • Click the ‘borrow’ under the ‘assets to borrow’ corresponding to the asset type ‘ETH’

We are going to borrow .0175 eth from the deposited .035 eth. But if you’re following along, the .035 eth we just deposited is actually a debt from the .07 eth we used as collateral to initiate this lending sequence, leverage baby!

Image 12 - Impact on assets after borrowing .0175 eth: borrowed amount increases but assets to supply also increases! source - aave.com

After borrowing .0175 eth:

  1. Our eth wallet balance increases to 0.03773762355

    original eth balance + borrowed eth - gas fees = 0.02029655335 + .0175 - 0.0000589 = 0.0174411
  2. Our Aave Arbitrum Variable Debt WETH increases to 0.08251200328

    original variableDebtArbWETH balance + new amount borrowed = 0.06501191864 + .0175 = 0.08251200328 eth
  3. The amount of aArbWETH is unchanged

Image 13 - impact to variableDebtArbWETH and eth after borrowing .0175 eth

🚩 At the end of this step, our eth exposure has increased by 75%. We are now 1.75x leveraged on our position. We started by supplying .07 eth → we borrowed .035 eth → we supplied back the .035 eth as new collateral → we borrowed .0175 eth against the supplied .035 eth

The deposit of the .035 eth decreased our loan to value which increased our health score. It enabled us to withdraw more eth on the backdrop of the new deposit. In our case, we chose 50% or .0175 Eth but could have gone as high as 82.5%.

Share

Step 6 - Supply back the .0175 eth

  • Click the ‘supply’ button under the “assets to supply” section for the “ETH” asset type

Here we are going to supply back the .0175 eth we just borrowed. This will decrease our overall loan to value, improve our health factor, and enable us to borrow more eth!

Image 14 - Impact on assets supplying .0175 eth - assets to supply decreases but supplied eth increases - aave.com

After supplying back .0175 eth:

  1. The amount of aArbWETH increased to 0.123065589

    original 0.123065589 balance + newly supplied amount = 0.105565572 + .0175 = 0.123065589 eth
  2. The amount of eth decreased to 0.02019558315

    original eth amount - amount supplied - gas fees = 0.03773762355 - .0175 - 0.0000420 = 0.02019558315 
  3. The amount of variableDebtArbWETH remains unchanged

Image 15 - impact to aArbWETH and eth after borrowing .0175 eth

🚩 At the end of this step, our eth exposure has not increased. We are still at 1.75x leverage but improved our health factor by depositing back the borrowed eth as collateral.

Step 7 - Borrow .00875 eth

  • Click the ‘borrow’ under the ‘assets to borrow’ corresponding to the asset type ‘ETH’

We are going to borrow .00875 eth from the .0175 eth we just deposited. Remember, the .0175 eth we deposited is collateralized by a .035 eth loan. But the .035 eth loan is collateralized by the .07 eth we deposited. Technically the only real ‘asset’ is the .07 eth which is collateralizing this entire trade.

Image 16 - Impact on assets after borrowing .00875 eth: borrowed amount increases but assets to supply also increases! source - aave.com

After borrowing .00875 eth:

Can you guess what happens?

  1. variableDebtArbWETH amount increases to 0.09126209128

    original variableDebtArbWETH amount + borrowed eth = 0.08251200328 + .00875 = 0.09126209128 
  2. ETH amount increases to 0.02888706035

    original eth amount + borrowed eth - gas fees = 0.02019558315 + .00875 - 0.0000586 = 0.02888706035 eth
  3. aArbWETH remains unchanged

Image 17 - impact to variableDebtArbWETH and eth after borrowing .0175 eth

🚩 At the end of this step, our eth exposure has increased by 87.5%. We are now 1.875x leveraged on our position. We started by supplying .07 eth → we borrowed .035 eth → we supplied back the .035 eth as new collateral → we borrowed .0175 eth against the supplied .035 eth → we supplied back .0175 eth → we borrowed .00875 eth.

Step 8 - Supply back .008 eth

  • Click the ‘supply’ button under the “assets to supply” section for the “ETH” asset type

Here we are going to supply back the .008 eth we just borrowed. This will decrease our overall loan to value, improve our health factor, and enable us to borrow more eth but we are approaching the home stretch.

Image 18 - Impact on assets after supplying .008 eth:assets to supply goes down but supplied eth goes up - aave.com

After supplying back .008 eth:

  1. The amount of aArbWETH increased to 0.131065596

original aArbWETH balance + newly supplied amount = 0.123065589 + .008 = 0.131065596
  1. The amount of eth decreased to 0.02019558315

original eth amount - amount supplied - gas fees = 0.02888706035 + .008 - 0.0000401 = 0.02084699845
  1. THE variableDebtArbWETH amount remains unchanged

Image 19 - impact to aArbWETH and eth after lending back .008 eth

🚩 At the end of this step, our eth exposure has not increased. We are still at 1.875x leverage but improved our health factor by depositing back the borrowed eth as collateral.

Share

Step 9 - Borrow .004 eth

  • Click the ‘borrow’ under the ‘assets to borrow’ corresponding to the asset type ‘ETH’

We are going to borrow .004 eth from the .008 eth we just deposited. But the .008 eth is as actually a loan collateralized by .0175 eth, which is a loan collateralized by .035 eth, which is collateralized by .07 eth (our original amount).

Image 20 - Impact on assets after borrowing .004 eth: borrowed amount increases but assets to supply also increases! source - aave.com

After borrowing .004 eth:

  1. variableDebtArbWETH amount increases to 0.09526212865

original variableDebtArbWETH amount + borrowed eth = 0.09126210407 + 0.0040000 + 0.09526212865
  1. ETH amount increases to 0.02888706035

original eth amount + borrowed eth - gas fees = 0.02084699845 + .004 + 0.0000565 = 0.0039435 
  1. aArbWETH remains unchanged

Image 21 - impact to variableDebtArbWETH and eth after borrowing .004 eth

🚩 At the end of this step, our eth exposure has increased by 93.2%. We are now 1.93x leveraged on our position. We started by supplying .07 eth → we borrowed .035 eth → we supplied back the .035 eth as new collateral → we borrowed .0175 eth against the supplied .035 eth → we supplied back .0175 eth → we borrowed .00875 → supplied back .008 eth → borrowed .004 eth.

😕What did we just do?

Conceptually, we performed 9 steps to increase our eth exposure from .07 to .135 (before fees).

Image 22 - 9 unique steps to increase eth exposure to 2x leverage

When we explore the blockchain using arbiscan and assess the underlying impact on the aArbWETH, ETH, and variableDebtArbWETH tokens:

Image 23 - Impact to underlying tokens as a result of the 9 transactions

We see:

  • aArbWETH has increased to .13107 eth

  • ETH has increased .02479 eth

  • variableDebtArbWETH has increased to .09526 eth

This analysis paints a more accurate picture of our exposure because it takes into account the ‘variableDebtArbWETH’ eth. Most guides on the interwebs explore leverage as a mechanism to increase eth exposure but don’t take into account the underlying debt which needs to be repaid. Although our aggregate ETH exposure (inclusive of an existing balance) has increased to $248.56 USD, our variable ETH debt has also increased to $151.92 USD.

Share

🏁 At eth’s current price per coin of $1594.78, we’ve turned ~ $100 of eth collateral into ~$200 of eth exposure.

Image 24 - The end result - 2x leverage → eth exposure increase from.07 eth to .13525 eth

Is there an easier way?

Yes. There is a gauntlet of derivative token providers like:

  • ETH Flexible Leverage Index (ETH2x-FLI)

  • ETH Max Yield Index

..that provide 1x-3x leveraged exposure to Ethereum and staked Ethereum in the form of an ERC20 token. These “collateralized debt tokens” perform the aforementioned steps on your behalf in exchange for a ~2% aggregate transaction fee. More exotic solutions like Alchemix offer auto-magic “repaying loans” by minting an Ethereum derivate debt tokens that “repays the debt on your behalf”. It sounds nice but the token tracks the price of the underlying asset (this means your principal goes down AND up).

It’s complete insanity because the 1% who pitch this product focus on how alechemix’s yield strategies are used to ‘repay the loan for you’ but completely gloss over the fact that your principal is variable and can go up.

🚫 Can you imagine buying a car where the principal amount you owe goes up or down every month? This month you owe $10,000, next month you owe $15,000, the month after you $5,000, then Ethereum has a bull run and your principal balance increase to $30,000? No thanks. The only ones making money in this scenario is the platform provider.

There’s an emerging narrative of ultra degens using tools like Alchemix to buy ‘self-repaying homes’, ‘self-repaying cars’, or self-repaying boats….if you love money, you will stay away from this product.

Image 25 - Want to ignore the details and previous crypto winters? This will be your destiny.

...then there’s the gauntlet of ‘advanced trading platforms like DeFi Saver which deploy automated investing strategies on your behalf like:

  • Open a 3x steth-eth leveraged position

  • Create a makerDAO vault → swap half of DAI for ETH → supply ETH/DAI to uniswap LP pool..etc

  • Identify “smart savings accounts” that aggregate yields across tokens to return the best APY based on the account’s investment strategy

If this is your 1st season of crypto, stay away from these collateralized debt tokens, yield automation platforms, and self-repaying loans. Execute borrow/lend/leverage positions manually. Our goal is to create a foundation of knowledge that leads to conviction. Without knowledge your conviction becomes arrogance, and you will get rekted in the trade.

Final thought

Take a moment and reflect on the ponzinomics and crypto-shills of summer 2022 (LUNSA, Celsisus, 3AC) with the following warning:

“If you don’t know the source of the yield, you are the yield”:

Reddit
Image 26 - “you are the yield”

🔔 Action for frontrunners:

  • Lend $100 of ETH on on Aave (arbitrum or optimism)

  • Borrow at most 50% of the collateralized eth

  • Lend back the 50% of the collateralized eth

  • Borrow at most 50% of the collateralized eth

  • Calculate the transaction fees and reconcile it against what you see in arbiscan

  • Review the transaction details and assess what smart contacts were called and what tokens were minted

You are the master of your destiny,

John Cook
September 18th, 2022
San Francisco, CA
www.frontruncrypto.com

Level up your crypto knowledge & master the future of decentralized finance.

Supporting content:

  • Arbiscan wallet address used to perform this transaction

  • Google sheets used to perform the calculations in this guide


pic of the week - “these criminals obviously don’t understand how bitcoin works”


Share this post

Ethereum essentials: How to borrow, lend and measure risk

www.frontruncrypto.com
Previous
Next
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Frontrun
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing