Risks in Crypto — a Lending Protocol Perspective

Euler’s risk framework and innovations in risk.
Topics discussed in this article:
- Things that can go wrong on a lending protocol
- Euler’s innovations to tackle them
- Why this is exciting
What could go wrong on a lending protocol?
While the short answer is: “Everything”, the focus will be on market-related risks that materialised on other lending protocols.
These projects pushed the boundaries of what’s possible in the space and have provided invaluable insights into DeFi lending:
Venus
From the Defiant article:
Binance Smart Chain’s most popular lending protocol, Venus, experienced a massive string of market liquidations totalling over $200M on May 18, and Venus, itself, has been left with $100M in bad debt because of it.
The liquidations were primarily caused by the massive price swing of Venus’ governance token, XVS. The token jumped 88% from $76 to $143 and then crashed 50% to $72, all over the course of six hours on May 18. The price of XVS has further spiralled since, hitting lows of $32 on May 19.
Here’s the daily candle chart:

It looks particularly violent on the lower time frame:

So what happened?
$XVS was allowed to be used a collateral asset, which means users were able to borrow assets like $BTC and $ETH by depositing $XVS into the protocol. The more $XVS went up in value, the more $BTC, $ETH and other assets users were allowed to borrow.
This meant that in theory a user could have pumped $XVS by 88%, borrowed a lot more $ETH and $BTC against it than a user normally would be able to, sold $XVS back and ran away with $ETH and $BTC.
While it isn’t clear who pumped $XVS, someone definitely took advantage of it:
Igamberdiev pointed to two traders who left the majority of the bad debt. One borrowed 4.2k BTC ($160M) for 1M XVS collateral ($50M at current value). The second borrowed 13.4k ETH ($35M) for 490k XVS collateral ($24.5M at current value).
Moral of the Story
Our takeaway is that manipulation-resistant price oracles are a must, otherwise Venus-like exploits will occur again.
Additionally, this incident taught the community that some assets just shouldn’t be listed as collateral. More on that later.
Cream — FTT
From the Defirate article:
Cream has come under fire after $75M worth of FTT, the native token of FTX, was used to borrow and short leading DeFi assets like YFI over the weekend.
Basically, Cream allowed $FTT to be used as collateral. Consequently, someone deposited a gazillion of $FTT to short-sell $YFI, $CRV, $UNI and other projects.
On top of that, it had very little onchain liquidity given the deposited size:
Over 40% of Cream's collateral is $78M of $FTT (25% of float)
— ChainLinkGod.eth 🌪 (@ChainLinkGod) October 8, 2020
What happens during a liquidation? Well considering $FTT only has a daily volume of $2M and a whole $6 of liquidity on Uniswap...
A downward price death spiral is created and that $78M will never be fully covered pic.twitter.com/nJnBksL1Pw
So imagine Alice borrowed $UNI tokens that shot up in price versus Collateral ($FTT), which made her subject to liquidation.
A liquidator would do the following:
- Take on Alice’s $UNI debt
- Buy $UNI to repay the debt
- Receive $FTT collateral equivalent to the $UNI repaid plus bonus $FTT for liquidating Alice
- Sell $FTT to repay whatever was borrowed for the procedure and reap the bonus.
Due to small $FTT float available in the market, (4) wouldn’t be viable and the liquidator couldn’t possibly liquidate Alice’s entire position. Consequently, $UNI lenders would lose their tokens and millions accrue in bad debt.
Moral of the Story
When a token has suboptimal liquidity and its ownership pie looks like this:

… one should be very careful about listing it as collateral.
Being a collateral asset should be a privilege contingent on, among other things, DeFi principles like decentralisation.
Euler’s Solutions
Unlike Aave and Compound, Euler allows permissionless listing, which means that anyone can create a lending market without governance approval.
While it’s very exciting, this feature introduces a myriad of risks.
In order to deal with these risks while maximising capital efficiency, a range of solutions have been developed in the spirit of DeFi.
Collateral and Borrow Factors
If I lend 100 USD worth of $ETH, how much can I borrow? That’s determined by the collateral factor.
Here are the collateral factors (they call it the Liquidation Threshold) listed on Aave:
According to this table, if a user lends out 100 USD worth of $ETH, they can borrow up to 82.5 USD worth of:
- $USDC
- $renDOGE
- $UNI
- Or any other token on Aave
An astute reader will notice an issue with this approach. Even though $UNI or $USDC are vastly safer than $renDOGE (although some would disagree), a user can borrow an equal amount of both versus your $ETH collateral.

Euler’s innovation: borrow factors
This is why borrow factors were introduced. While collateral factors encapsulate the risks of a collateral asset like $ETH, $USDC or $DAI, borrow factors encapsulate the specific risks of a borrowed asset.
Example
For eg, if 100 USD worth of $ETH is lent out and the collateral factor is 0.90, then the risk-adjusted collateral value is 90 USD (100 USD x 0.90).
To borrow an asset, the risk-adjusted collateral value is multiplied by the respective borrow factor (BF). For eg:
- $USDC BF = 0.90, meaning 81 USD (100 USD x 0.90 x 0.90) worth of $USDC can be borrowed vs 100 USD worth of $ETH
- $renDOGE BF = 0.28, meaning 25.2 USD (100 USD x 0.90 x 0.285) worth of $renDOGE can be borrowed vs 100 USD worth of $ETH
This way, listings of assets are permissionless as each borrowed asset will be assigned a borrow factor matching its risk profile.
Only allow highest quality assets as Collateral
As seen in the Venus and FTT examples, a protocol is only as strong as its weakest collateral.
With this understanding, here are the parameters used to assess assets for collateral eligibility:
Smart Contract Risk
It is arguably the biggest tail risk, as a badly written smart contract can result in hacks and stolen money, leading to a catastrophic collapse in price.
So if $XYZ collateral asset goes from 100 USD to 0 USD in a minute, two things happen:
- Lenders of $XYZ asset are left with nothing.
- Users that borrowed other assets like $ABC vs $XYZ will not be liquidated, as no liquidator is willing to receive the collapsing collateral as a bonus for liquidation. Consequently, borrowers run away with $ABC and lenders of $ABC lose their tokens.
While the first scenario sucks, second is actually systemic as it creates bad debt.
Centralisation
It measures whether a small number of holders have undue influence over the token. For example, a founder with 70% ownership of the tokenomics pie and flexible vesting period can oversupply the protocol with tokens and borrow anything against it without risk of liquidation (FTT case).
This is a reason $BUSD isn’t listed as collateral:

Alternatively, a whale holding a large chunk of tokens can easily pass deleterious changes through governance.
This criterion nicely aligns DeFi goals with Euler protocol as all assets that aim to become collateral should be decentralised.
Liquidity
An asset with 100 mio USD daily turnover is easier to buy and sell versus an asset with only 1 mio USD turnover, all other things being equal.
This is important for two reasons:
- A user can pump an illiquid collateral (like in the case of Venus), borrow against it and run away with the money.
- If a liquidator is receiving an illiquid collateral that is collapsing in price with crazy slippage, he may have no incentive to liquidate in the first place. Hence, borrowers may run away with borrowed assets.
Both of these scenarios are systemic and create bad debts, which is why high liquidity is crucial.
Note: a quick and dirty way to assess liquidity is estimating slippage on Uniswap:


Volatility
All other things equal, an asset with 100% realised volatility is more likely to cause a liquidation than an asset with a 10% realised volatility. Hence, less volatile assets should have more favourable borrow factors.
For more on Euler’s risk framework, check out the risk docs.
Give higher Borrow Factors to more liquid assets
While a collateral asset can create systemic risk by being easy to manipulate up or down, a borrowed asset going down in price doesn’t pose much harm to Euler.
When it comes to borrowing, it’s the ability to easily pump a borrowed asset that presents risks to the protocol. This is why there’s a higher weighting on the latter two parameters:
- Liquidity
- Volatility
Since volatility is self-explanatory, understanding liquidity is crucial.
Using the $XVS token as an example again:

However, imagine that in this case $ETH was lent and $XVS was borrowed.
Assuming the CF of $ETH is 0.90 and BF of $XVS is 0.80, the final factor is 0.72 (0.90 x 0.80). Hence, if a user lends out 100 USD worth of $ETH, they can borrow up to 72 USD worth of $XVS. Because this user is an utter degen, they decide to borrow exactly 71.99 USD worth of Venus, just below the threshold.
Imagine that the next second, someone pumps $XVS to 150 USD while the collateral is still worth just 100 USD. The user is subject to liquidation, but do they repay their $XVS debt? Obviously no, as the value of the borrowed asset is higher than the collateral. It’s more advantageous for the user to run with their $XVS and never recover the $ETH.
Due to the illiquidity of $XVS, the lender of $XVS loses his asset and bad debt accrues.
Use Uniswap v3 TWAP
No matter how good and liquid an asset is, someone will most likely try to manipulate its pricing.
For eg, if a user tried to swap 35mio USD worth of $ETH (which a well-capitalised fund could easily do with some leverage), $UNI moves by 20%:

Due to the nature of how liquidity pools work, an alternative to Uniswap spot prices has to be used. It must also be decentralised to enable pricing for any asset listed on Euler permissionlessly.
Euler’s solution is a TWAP based on Uniswap v3. Since a TWAP is a moving average, it would take an enormous amount of money of $ETH to manipulate $UNI prices.
As an extreme example, see PIVX vs BTC spot (candles) vs TWAP (orange line):

While spot rallied dramatically and ultimately mean-reverted, it would take an even more dramatic and persistent upside for the TWAP to really catch up.
Check out Doug’s longer posts on TWAPs here and here.
But YOU CAN’T USE A MOVING AVERAGE FOR PRICING
First, yes it’s possible.
Second, it does introduce certain complications.
Imagine the following scenario:
A user lends 100 USD worth of $USDC to borrow $SHIB.
Since $USDC CF = 0.90, $SHIB BF = 0.28, they can borrow up to 25.2 USD worth of $SHIB. Let’s say they borrow 25 USD worth at 15:11 on the 11 Oct 2021. Next thing, a huge rally is experienced:

Notice the difference between the TWAP (orange line) and the spot price of 5.43% in a matter of 7 minutes.
Whether one uses TWAP (which is effectively the price at which a user borrows on Euler) or spot, the user is in liquidation territory. However, the spot — TWAP discrepancy influences a liquidator’s profitability.
Recall that a liquidator would:
- Take on the $SHIB debt priced in TWAP terms
- Buy $SHIB on the market at spot price to repay the TWAP-priced debt
- Receive $USDC collateral equivalent to the $SHIB debt repaid plus bonus $SHIB priced in TWAP terms again
- Sell $USDC on the market at spot rate to repay whatever was borrowed for the procedure and reap the bonus
There is an issue here: the liquidator receives collateral equivalent to $SHIB debt priced in TWAP terms, which is at a worse price than the spot rate at which the liquidator buys $SHIB to repay the debt in the first place.
Essentially, the liquidator buys high and sells low (so does the user but who cares).

Dutch Auctions for liquidator bonuses
In order to compensate the liquidator for his work, a borrower will pay him additional collateral.
For eg, if the debt to be repaid is worth 20 USD and the liquidator bonus is 10%, the liquidator will receive 22 USD worth of collateral from the borrower (20 USD x 1.1). The 2 USD is essentially the profit for the liquidator excluding the gas costs.
The issue
10% liquidator bonus sounds like a good deal, but what if the TWAP — spot discrepancy is very large, say, 20%? This means that to repay the borrower’s debt, a liquidator would have to buy 24 USD (20 USD * 1.2) worth of debt asset on the market to receive 22 USD worth of collateral, which amounts to a -2 USD loss.

The solution
We make the liquidator bonus subject to a Dutch auction. For eg, if someone is willing to conduct a liquidation at a measly 1% bonus, he can do it. If not, the Dutch auction of the bonus will go up to 2%, 3%… 10%… 21% until a liquidator agrees to do the liquidation as it’s in profit territory.
Effectively, as long as TWAP * (1+Liquidator_Bonus_%) > Spot, a liquidator is profitable (excluding gas costs, slippage etc).
This is also neat as borrowers on average will not be forced to pay a fixed rate of 5 or 10% on every single liquidation. The bonus will likely be lower most of the time apart from very volatile times when TWAP — spot basis widens and there is lots of slippage.
Debt Tokens
Say a user is a liquidator that received 4.5 million USD worth of $UNI as collateral in return for repaying someone’s debt. If they sell that $UNI for $DAI in the market, the slippage is huge:

In fact, it could be a lot worse if UNI/DAI pair were aggressively selling, which is when a good deal of liquidations get triggered.
But what if they could keep that $UNI and sell it… later, once prices and slippage stabilise?
This is where the dTokens come in.
dTokens on Euler represent a borrower’s debt, whilst eTokens represent a borrower’s collateral. If the borrower is in liquidation territory, a liquidator can take on the borrower’s dTokens (debt) and eTokens (collateral), repay the debt and receive the collateral + bonus underlying the eToken.
However, unlike on other protocols, the liquidator isn’t constrained to repay that debt straightaway. If he has enough collateral in his account, he may hold the dTokens on his balance sheet along with the eTokens, and repay that debt later to sell the collateral at a better price.
This basically enables liquidators to take on market risk if they choose to, which wasn’t possible before on lending protocols. Instead of everyone liquidating everything at once, more trading floor dynamics can be seen where liquidators act as market makers of sort, ie taking on market risk to achieve better returns.
Why this is exciting?
While creating a permissionless lending market is a monumental task from a risk perspective, it is extremely exciting for the possibilities that open up as a consequence.
Short-selling anything
Everyone talks about accountability in the space. Well, now users will be able to short-sell any ERC20 token, creating an exciting space for investigative and activist trading in the crypto space.
More on that in a previous article.
Margin trading on anything
Thanks to the swap module, Euler enables users to put on one-click leveraged long and short positions on any collateral vs collateral asset pairs and one-click leveraged short positions on any collateral vs non-collateral pairs.
Earn interest on anything
Have a DPI index or that tiny DAO token sit idle on a balance sheet? Big or small, Euler enables interest accumulation on any ERC20 token.
Liquidity Farm anything
Deposit eligible collateral and borrow anything that will result in liquidity mining rewards. By creating a lending market for everything, anyone can tap into farming without selling their high quality assets.
And the list goes on.
Thanks for reading, feel free to connect in the community Discord.
About Euler
Euler is a capital-efficient permissionless lending protocol that helps users to earn interest on their crypto assets or hedge against volatile markets without the need for a trusted third-party. Euler features a number of innovations not seen before in DeFi, including permissionless lending markets, reactive interest rates, protected collateral, MEV-resistant liquidations, multi-collateral stability pools, sub-accounts, risk-adjusted loans and much more. For more information, visit euler.finance.
Join the Community
Follow us on Twitter. Join our Discord. Keep in touch on Telegram (community, announcements). Check out our website.
This content is brought to you by Euler Labs, which wants you to know a few important things.
This content is provided by Euler Labs, Ltd., for informational purposes only and should not be interpreted as investment, tax, legal, insurance, or business advice. Euler Labs, Ltd, is an independent software development company.
Neither Euler Labs, Ltd. nor any of its owners, members, directors, officers, employees, agents, independent contractors or affiliates are registered as an investment advisor, broker-dealer, futures commission merchant or commodity trading advisor or are members of any self-regulatory organization.
The information provided herein is not intended to be, and should not be construed in any manner whatsoever, as personalized advice or advice tailored to the needs of any specific person. Nothing on the Website should be construed as an offer to sell, a solicitation of an offer to buy, or a recommendation for any asset or transaction.
Euler Labs Ltd, does not represent or speak for on or behalf of Euler Finance or the users of Euler Finance. The commentary and opinions provided by Euler Labs Ltd., are for general informational purposes only, are provided “AS IS,” and without any warranty of any kind. To the best of our knowledge and belief, all information contained herein is accurate and reliable, and has been obtained from public sources we believe to be accurate and reliable at the time of publication.
All content provided is presented only as of the date published or indicated, and may be superseded by subsequent events or for other reasons. As events markets change continuously, previously published information and data may not be current and should not be relied upon.
Euler Blog