Discover more from Frontrun
How to model an overcollateralized loan and avoid liquidation with Aave | part 1
We explore a model of assessing risk vs return and outline how lending platforms like Aave perform automatic liquidation
In this 2 part series, we dive into lending platforms by reviewing:
Collateralization & associated borrowing limits
How on-chain debt is tokenized
A model for assessing risk and reward
Part 1 (this post) will focus on overcollateralized debt positions. Part 2 is focused on undercollateralized debt. We will use Aave as our lending platform for part 1 since it is the number 1 lending platform on Ethereum by total value locked, borrowing volume, fees, revenue, daily active users, and a whole lot more.
Moreover, since Aave is the stalwart of the open-source non-custodial lending protocol ecosystem, all newer entrants leverage a similar risk parameters framework (loan-to-value, liquidation thresholds, health factor, liquidation penalties) within their solution.
Why this topic?
I suspect there’s been a re-emergence of interest in leverage and debt within the retail investor crypto ecosystem. It’s almost as if we forgot the $68 billion of wealth destruction we experienced last summer, caused in part by underwater positions & leveraged derivatives!
It is my hope that all frontrunners who wish to express their interest in defi by acquiring debt, exercise this type of analysis before entering a trade. If you want to follow along, here are the tools you will need:
🧰 Tools you will need
If transacting with amounts < $1,000 USD, use a Layer 2 like Arbitrum
A block explorer like Arbiscan
Excel or google spreadsheets
Up to 1 ETH in this example
These are terms to know should you choose to express your enthusiasm for Ethereum with debt:
Collateralized debt positions = Loans that use newly created tokens (e.g. Maker depositors deposit ETH and mint Dai)
Collateralized debt markets = Loans that use existing tokens and match borrowers to lenders (e.g Aave lenders deposit ETH & receive USDC)
Within collateralized debt markets, there are two broad subcategories of lending:
Peer-to-peer lending = Matching the person who is providing liquidity (the lender) to the borrower
Lenders earn interest only once there is a match
but it is advantageous because both parties agree on a time period with fixed interest rates
Pooled lending = The funds of all borrowers are aggregated into a single smart contract-based lending pool
Lenders earn interest immediately
Lender interest earned and borrower interest paid is a function of supply and demand called utilization rate
Low demand, high liquidity, low lending rate = low utilization rate
High demand, low liquidity, high lending rate = high utilization rate
Aave is a pooled lending platform
Below is an example of a “high utilization rate” environment with lenders receiving a 71% variable APY on ETH with borrower financing costs at a fixed rate of 191%. This meant borrowers were willing to pay 1.91 ETH for every 1 ETH borrowed when annualized. Yikes.
Opportunistic investors were lending ETH to borrow more ETH & take advantage of the Ethereum-PoW fork, which rewarded ETH token holders with an equivalent amount of “ETHPoW” tokens. Aave’s DAO eventually passed a governance proposal to pause ETH borrowing & withdrawals, and as you can see from the aforementioned picture, post-merge lending & borrowing rates dropped to one and six percent.
Loan to value (LTV) = (loan balance / market value of asset securing loan)
“Market value of asset securing the loan” is also called collateral
“Loan balance” = debt
The maximum you can borrow is called the Max LTV
Max LTV varies by asset
USDC = 80% ETH = 80% WBTC = 70%
Liquidation threshold (LT) = The threshold at which your loan is considered undercollateralized
Liquidation thresholds vary by asset
USDC = 85%, ETH = 82.50%, WBTC = 75%
The difference in value between LTV and LT is intentional and was implemented by Aave’s DAO to avoid automatic liquidation immediately after the loan distribution
A 2.5% spread is marginal at best given that over the past 365 days the daily % change of the ETH spot price has been > 2.5% forty-six percent of the time.
Health factor (Hf) = (Collateral * liquidation threshold) / Debt
When this value is < 1, 50% of your collateral will be liquidated to pay down the debt
When this value is < 1 and your collateral is liquidated, you will also pay a liquidation penalty
Liquidation penalty = Fee you pay to Aave’s ecosystem treasury & liquidators for violating its risk parameters framework
It is 5% of the liquidated amount.
1. Model of expected return
Before we execute a trade, we can model the potential return against associated financing costs. Maybe I believe ETH is in the early stage of a bull run that will culminate with an EOY 2023 ETH spot price of $3000 USD. Today ETH is $1,400. I wish to express this belief by:
Supply 1 ETH of collateral to the lending pool
Borrow 700 USDC
Buy .5 ETH for $700 at a spot price of $1,400
Sell .5 ETH for $1500 when the spot price reaches $3,000
Payback 700 USDC loan
How much profit will this trade make? The math is below.
This scenario plays out such that:
If ETH reaches ~$3,000
this trade yields an additional $805 for pre-tax profit for a total $3,830 vs $3,025.
but If ETH drops 50% to ~$700
I lose an extra ~$350 because I borrowed 700 USDC to buy .5 ETH when ETH was at $1,400
and now have to sell .5 ETH for $350
which means the difference is paid by the collateral
Is risking an additional $350 worth the $800 upside? One approach is to frame a required return against the prevailing risk-free rate plus the borrow costs associated with the asset multiplied by a return multiple commensurate with my perception of the risk.
I am expecting a minimum 50% return on any ETH I deploy as collateral. It is based on:
A 5% risk-free rate of return via US treasuries plus
A 5% annualized fixed borrowing rate
A 5x return multiple on a crypto investment sounds conservative, we are here to invest in grand slams, but it is a representation of Ethereum’s maturity in the ecosystem.
The 170x-400x returns we saw as ETH appreciated from $10 to $1,000 and $4,000…
…represent a growth phase that has passed.
A 400x appreciation means ETH would have to increase from its current spot price of $1400 to $562,000 per token would imply a market cap of $68 trillion. As a frame of reference, the market cap of the S&P500: the 500 largest companies in the world (Apple, Microsoft, Berkshire Hathaway) is $30 trillion.
I do think there are 100x-1000x baggers in the crypto ecosystem, but ETH is not one of one, and we frame our expected return to reflect that reality.
2. Automatic liquidation
With our expected return defined, we now quantify the levers of automatic liquidation. After reviewing Aave’s reserve status and configuration for USDC and ETH we see:
The borrowing rate is 5.35% fixed
Max LTV = 80%
LT = 85%
The lending rate is .068% variable
Max LTV = 80%
LT = 82.5%
The LT of the collateral is used to determine automatic liquidation.
Turning on “efficiency mode” can juice your max LTV on stablecoins to 97%. We are going to keep off because based on our research we now know that there is a 50/50 chance ETH (our collateral) will experience a price swing > 3% in a 24-hour period.
When we execute our initial trade:
Lend 1 ETH
Borrow $700 USDC
The LTV, LT and Hf are depicted below. I’ve noticed it’s a mental hurdle for some people to think about collateral and debt in ETH-denominated & not USD terms, so I’ve included a table for both ETH and USD. Keep in mind lending platforms calculate risk parameters in their native base layer token, so it is advantageous for you to do the same.
When we perform this trade in Aave’s UI, we are presented with the same results as our excel.
The number that matters is the “health factor”. Again it is:
Health factor = (Collateral * liquidation threshold) / Debt
= ( 1 ETH * .825) / .5 ETH = 1.65
In plain speak, it says: when your collateral is 82.5% of your debt we will liquidate your collateral.
We borrowed 700 USDC which is 82.5% of 848.
When the value of our collateral (1 ETH) drops to $848
Aave considers our loan undercollateralized because we owe $700 USDC against an asset worth $848
This is measured by a Hf of < 1
Results depicted below:
3. Liquidation Penalty
When your Hf is <1:
Lending platforms like Aave will liquidate 50% of your collateral to pay down your debt position
Impose a 5% penalty
Following our example of lending 1 ETH at $1,400 and then borrowing 700 USDC only to have ETH drop to ~$848, Aave will impose the liquidation penalty depicted below:
50% of the debt is liquidated = .41 ETH or $350 USDC
$700 USDC = ~.825 ETH at a spot of $848/ETH
50% * [debt] = (50% * .825 ETH) = ~.41 ETH
The debt position is reduced from ~.825 ETH to .41 ETH
A liquidation penalty of .02 ETH is imposed
5% * [liquidated amount] = (5% * .41) = .02 ETH
The collateral is reduced from 1 ETH to .57 ETH
1 ETH - [liquidated amount] - [liquidation penalty] = (1 - .41 - .02) = .57 ETH
This will bring the Hf above 1, and let us live to fight another day.
4. On-chain debt
So far we have covered very little of the Aave UI. This is intentional, Aave is just the platform we use to express our trade, our belief in Ethereum or the underlying asset we wish to buy. When we’re ready to execute our trade on Aave, the following actions are performed:
Supply Aave with 1 ETH: Will deploy 1 ETH to Aave’s lending pool smart contract and mint 1 aToken called “aArbWETH”
Note: When we withdraw the 1 ETH from Aave, the aArabWETH will be burned and we will receive 1 ETH token + the corresponding amount of ETH interest earned over the time period
Borrow $700 USDC: Will mint two different aTokens. 700 “stableDebtArbUSDC” and 700 USDC.
The 700 stableDebtArbUSDC is what will need to be paid back and burned by the Aave smart contract before we’re able to withdraw our 1 ETH. This is what we mean when we say code is law!
The stableDebtArbUSDC balance will increase by 5.35% on an annualized basis.
The 700 USDC is free to spend. It is not controlled by or locked in a smart contract.
We now see three revisions in Aave’s marketplace dashboard:
ETH-supplied collateral has increased by 1
USDC borrow has increased by 700
USDC assets to supply have increased by 700
…which is also what we see in our blockscan explorer:
The path to mastery in defi is by doing, not pontificating on the art of the possible or developing elaborate worksheets that model risk and reward. Ultimately your goal is to be in the UI, interacting with the platform, and reviewing the results on a blockchain explorer.
If you’re in the exploration phase of a new defi app, this is great, but when it is time to execute a trade that reflects your prediction of the market, take time to model out the risks, fees, upside, and downside in excel before you hit the “buy” button in the UI.
Moreover, be judicious with fees. Current base-layer transaction fees on Ethereum are between ~16 to 30 gwei which is around ~$3 to $6. This increases if you have to interact with a smart contract. At transaction amounts of less than $1,000 it is impractical to use Ethereum’s base layer, consider an L2 or sidechain.
Ready for part 2? Click here.
To knowledge and wisdom,
January 12th, 2023
San Francisco, CA
Frontrun predicts the future of money and technology
Article cover generated by DALL-E: “An expressive oil painting of Nicolaus Copernicus calculating default risk of an on-chain loan using an abacus”