Introduction

Learn about the core concepts of decentralized borrowing and lending on marginfi. On this page, we will cover key topics that you should be aware of as a marginfi user. Let's dive in!


Lending and Borrowing

The marginfi protocol allows you to do two things with your Solana crypto tokens: lend them and borrow them. You lend your tokens to earn yield on them, and borrow tokens using the tokens you've lent as collateral. This feature suite is packaged into a user-friendly application called mrgnlend.

Remember: In order to borrow tokens through marginfi, you must first supply tokens to any of marginfi's supported asset pools. This is because marginfi is an overcollateralized borrowing-lending protocol, meaning that you need to provide collateral worth more than the amount you intend to borrow.

This ensures the security and stability of the protocol by mitigating the risk of default. When you supply tokens, you are effectively contributing to the liquidity pool, making it possible for others to borrow and for you to earn yield on your supplied assets.


Fees and Yield

Spead Fees

marginfi takes a 12.5% interest rate spread fee on $USDC, $USDT and $SOL, and a 13.5% interest rate spread fee for every other asset.

An interest rate spread fee is the difference between the borrowing and lending rates that the protocol charges. Meaning if you were borrowing $USDC at 10% APY and lenders are receiving 8% APY, marginfi would take 12.5% of that 2% spread as the fee.

Lending Yield

marginfi allows users to deposit supported tokens into the protocol and earn yield on them. This is made possible by lenders on the platform who borrow these tokens and pay interest on them.

The deposit yield on marginfi is typically expressed in terms of APY (Annual Percentage Yield). Yield farming has become increasingly popular in DeFi, and marginfi is one of the lending protocols that allows users to earn yield on their deposited assets.

The APYs for lending each asset are typically exposed in marginfi web interfaces, and can be found in protocol configuration.

Liquidity Incentive Program (LIP) deposits

Deposits into marginfi's LIP program may be locked up depending on the LIP campaign they're deposited to, which is available to users in each LIP campaign configuration and can only be set when a campaign is initially created.

LIP lockup timelines cannot be adjusted after campaigns are created by anyone, including campaign creators.

It's important to note that LIP deposits cannot be used as collateral for borrowing.

Borrow Fees

Borrowing on marginfi incurs a fee. Fees are denominated in each asset that marginfi supports, and usually expressed in terms of APY (Annual Percentage Yield).

The rate is dictated by bank-specific parameters, and partially variable according to the bank's utilization rate. Parameters can be found in protocol configuration accounts (banks), and live rates are exposed through the marginfi web app.

Liquidation Fees

When borrowed trader positions fall below configured margin requirements, they are exposed to liquidation. Liquidations on marginfi are automatic and permissionless.

Liquidations are executed by third-party liquidators who provide this service for a return, and marginfi awards a fee for successful liquidations.

When borrowed positions fall below requirements and are liquidated, liquidated borrowers (a.k.a. liquidatees) are penalized through a liquidation fee. This fee amounts to 5% of the liquidated assets, and is equally distributed among:

  • the liquidator
  • the insurance fund of the bank for the liquidated token

Account Health

Every account's health is represented as a health factor. Your account health factor is a single value that encapsulates how well-collateralized your portfolio is - or, how healthy it is.

Account health is calculated with the following formula:

Assets And Liabilities

Account health is typically between 0% and 100%, but can technically go as low as -∞. When your account health reaches 0% or below, you are exposed to liquidation.

Assets as Collateral

When you lend an asset on marginfi, there are a few values to keep in mind when pricing the value of your collateral:

  • Every asset has a market USD price, as determined by its oracle.
  • Every asset has a confidence band-adjusted market USD price, as determined by the bottom limit of the price oracle's 95% confidence band.
  • Every asset has a weighted price, which is the confidence band-adjusted market USD price multiplied by the asset's deposit weight.

Here's an example:

  • Let's say a price oracle supplies a market USD price for SOL of $25.
  • The price oracle's 95% confidence band is +/- $1, i.e. $24-26. The bottom limit of this confidence band is $24, so the confidence band-adjusted market USD price is $24.
  • Let's say the SOL asset weight on marginfi is 90%. We multiply the confidence band-adjusted market USD price by the asset weight, or $24 * 90%.
  • After all adjustments, SOL is priced at $21.60 as collateral.

Liabilities as Borrows

Similarly to assets, liabilities on marginfi are adjusted:

  • Every liability has a market USD price, as determined by its oracle. This market USD price is the same market USD price as a given token would have when being lent.
  • Every liability has a confidence band-adjusted market USD price, as determined by the top limit of the price oracle's 95% confidence band.
  • Every liability has a weighted price, which is the confidence band-adjusted market USD price multiplied by the liability's borrow weight.

Here's an example:

  • Let's say a price oracle supplies a market USD price for SOL of $25.
  • The price oracle's 95% confidence band is +/- $1, i.e. $24-26. The top limit of this confidence band is $26, so the confidence band-adjusted market USD price is $26.
  • Let's say the SOL LTV on marginfi is 80%. We multiply the confidence band-adjusted market USD price by 1/LTV1/LTV. In this case, 1/0.80=1.251/0.80 = 1.25.

Was this page helpful?