All Collections
Learning Hub
Get DeFit: With Trainer Joe
Trainer Joe: Get DeFit — Lending Part 2
Trainer Joe: Get DeFit — Lending Part 2

Learn the basics of DeFi to bulk out your knowledge

Trader Joe avatar
Written by Trader Joe
Updated over a week ago

Welcome to DeFit Bootcamp, with Trainer Joe

🏃‍♂️Session 2

Today’s session will help you strengthen your knowledge of DeFi Lending protocols, specifically understanding how Lending Protocols operate to manage & mitigate risk, as well as understanding some of the risks posed to you when engaging in Lending activities.

As a disclaimer, this is not a comprehensive overview of every risk posed to a DeFi user, this is an article covering some of the consideration factors when engaging in Lending activities on DeFi platforms.

Sets for the session

  1. Risk Management

  2. Risks to the Protocol

  3. Liquidation

🏃‍♂️Risk Management

Token Risk

Parameterization refers to the configuration of Banker Joe’s reserve and collateral factors for each token market. These configurations help Banker Joe to manage the underlying risk that each token may carry when integrated to a Lending Protocol. Riskier assets will typically have a lower Collateral factor as this reduces the % of collateral that can be used to borrow against the supplied token.

🏋️‍♂️Rep 1: Parameterization: Configuration of risk parameters for the Lending Market

🏋️‍♂️Rep 2: Collateral Factor: % of $ value you can use for borrowing

Price Oracles

The integration of a reliable price oracle helps ensure the efficient management of the liquidity pool by making sure listed prices are up-to-date and synced. For Banker Joe, Chainlink Oracle has been integrated into the protocol. Price Oracles aggregate pricing data from both on-chain DEXs and traditional CEXs, providing a robust data feed that helps secure the protocol from such events as a Flash Loan Attack.

Flash Loan attacks are a type of smart contract exploit, where attackers can manipulate price data, such as artificially creating arbitrage opportunities to essentially drain tokens from a protocol by tricking it.

🏋️‍♂️Rep 3: Price oracles aggregate data feeds from the market to provide a robust and decentralized token price

🏋️‍♂️Rep 4: Flash Loan Attacks can happen when a user manipulates data to create an advantageous arbitrage position


The comptroller is a smart contract device that validates collateral and liquidity before a user may interact with the token market. The Comptroller helps the Banker Joe protocol manage risk by determining how much collateral a user is required to maintain, and the likelihood of liquidation. This is achieved by correlating the user’s balance to the price oracle feed and collateral factor.

🏋️‍♂️Rep 5: Comptroller: Introduced by the compound protocol, the comptroller is a smart contract device that manages token markets available for lending and borrowing

🏃‍♂️Risks to the Protocol

Shortfall Events

Shortfalls occur when liquidity providers to the protocol are in a state of ‘deficit’. This puts the users of the protocol at risk of suffering a loss. The risk to the Protocol is that a large shortfall event can effectively ‘bankrupt’ the protocol while trying to cover borrowers defaulting on payments. The result is users still active in Lending positions, may not be able to retrieve funds.

🏋️‍♂️Rep 6: Shortfall events happen when a protocol is in a net negative position

Reserve Funds

Protocols mitigate the risk of a shortfall event, using a Reserve Fund. This is essentially a pool of capital to be called upon in the need to pay off bad debt positions, returning equilibrium to the protocol. Reserve Funds are accrued and set by using a Reserve factor. The Reserve Factor is a percentage of all interest accrued by the Lending Protocol, that is paid by Borrowers. Reserve Factors are specific to each token, based on the individual risk of that token. EG Stablecoins will have a lower Reserve factor due to the lower levels of risk lending these tokens out. Over time, interest accrued is built up to provide a substantial amount of Reserves.

To calculate the reserve factor’s value, a set percentage is taken off interest payments:

  • Reserve Factor: 20%

  • Calculation: 20% of $100

  • Reserve Value: $20

  • Total after reserve value deductions: $80

In addition to the Reserve Factor, Banker Joe also collects 2.8% of all liquidated collateral to further boost the accrual of a sufficient Reserve Fund.

🏋️‍♂️Rep 7: Reserve Funds are pooled by the Lending Protocol to pay off ‘bad debt’

🏋️‍♂️Rep 8: Reserve Factors are the % of interest payments accrued by the Protocol


What is a Liquidation?

When a borrower’s position becomes ‘underwater’, a liquidation can occur. This is the process in which an owed balance to the Lender, is paid by a Liquidator, on behalf of the Borrower.

Liquidators perform an essential role for Lending Protocols, by saving Lenders from bad debt as well as keeping the Lending Market solvent.

Why would a liquidator pay off somebody else’s debt? Well, on Banker Joe, liquidators take an 8% cut of your seized collateral, called the Liquidation Discount. Once they’ve taken that fee, they’ll return the rest to you, wiping your ‘debt’ clean.

The below case study demonstrates this in action.

Discount Value: Collateral Value * Liquidation Discount %

  • Liquidation Discount: 8%

  • Collateral Value: $50/AVAX

  • Discount Value: $46.30/AVAX

  • Liquidator Receives: $2.5K / $46.50 = 54 AVAX

The extra 4 AVAX ($200) represents the liquidator's profit from the event. This amount is deducted from the collateral balance NOT the $2.5K, which is returned to the account.

🏋️‍♂️Rep 9: Liquidation is when a liquidator seizes collateral after a defaulted loan payment

🏋️‍♂️Rep 10: Debunking Liquidations: You do not lose the entirety of your collateral that is seized

Borrow Limit

To help manage the position of your risk when engaging in borrowing, the ‘Health factor’ or as known on Banker Joe the ‘Borrow Limit’ is a measure of your collateral health. The borrow limit moves up from 0% to 100% and the % represents the balance ($) of your borrowing relative to your collateral limit. If the borrow limit hits 100%, that means your borrowing balance is maxed to the collateral value you have deposited.

Borrow Limit % Scale

Over 80% is considered very high and caution should be taken through appropriate risk management, such as deleveraging your portfolio or topping up your Lending position.

The below highlights how the Borrow limit is calculated.

Borrow Limit Used: (Borrow Amount / (Collateral * Collateral Factor )) * 100

  • Token: AVAX

  • Borrow Amount: $5K

  • Borrow Limit: $5.25K

  • Borrow Limit Used: 95%

In this instance, using 95% of the borrow limit puts the account at risk of liquidation, as a change in the collateral’s value may exceed the repayment threshold. Token volatility can impact positively or negatively on the borrow limit. If the price of AVAX fell, the borrow limit would decrease, resulting in a shortfall.

  • AVAX Original Collateral Value: $60/AVAX = $6K

  • AVAX Updated Collateral Value: $50/AVAX = $5K

  • Total Collateral: $5K AVAX + $1K USDT.e = $6K

  • Original Borrow Balance: $5K

  • Updated Borrow Limit: $6K * 75% = $4.5K

  • Shortfall: $5K — $4.5K = $500

🏋️‍♂️Rep 11: Borrowing Limit indicates the ‘health’ of your borrowed collateral. Reaching 100% will mean your position is liquidated

Congratulations — Session Complete 🥇

Need further assistance?

Come visit us in our Discord server to get dedicated one-on-one support.

Did this answer your question?