Hi, I'm Pavel Dzidukh

0 %
Pavel Dzidukh
Product Manager
Web3 Developer
  • Country:
    Poland
  • City:
    Warsaw
Languages
  • Russian - Native
  • Belarusian - Native
  • English - B2
  • Spanish - B1

Crypto Lending & Borrowing

April 28, 2022

Terminologies:

L&B – Lending & Borrowing

Interest Rate – can be defined as the amount, that lender charges a borrower, ****mainly measured as a percentage of the loan amount.

C-Ratio (or CCR) – collateralization ratio, the percentage of a loan that’s secured by a discounted assets. The lower the ratio, the higher the risk for lenders; the higher the ratio, the lower the risk for lenders.

Interest bearing token – asset, that issued on the underlying and provide the proof of ownership of the loan, acting as a representation of claims on your deposit

Liquidation – in the crypto space, the term liquidation is mainly used to describe the forced closing of a trader’s position due to the partial or total loss of the trader’s initial margin. This happens when they cannot meet the margin requirements for their leveraged position — i.e., they have insufficient funds to keep the trade open. Margin requirements are often underfunded when there’s a sudden drop in the underlying asset’s price.

Health factor – a representation of the combined collateral ratios for the borrowed assets.

Crypto L&B Segmentation

Crypto margin lending

Margin trading is highly possible with the help of crypto lending. Lenders are willing to earn more in crypto, so they can provide loans and earn interest. Users offer the loans for the margin markets and for others the exchange itself will provide them.

Margin trading gives the trader the option to open a position that comes with leverage. For instance, we have opened a margin position that has 2x leverage. Then our base assets increased to 10%. As a result, our position yielded 20% due to the 2x leverage. The usual trades are traded in leverage of 1:1.

Mass adopted crypto lending for private borrowing of funds

Platforms like Nexo and Celsius offer crypto lending service for users to use their volatile assets as a collateral to receive credit line in stables or fiat currencies. For more convenient use of the credit line, they issue additional services, such as: credit cards, payment systems, merchants and mass-payout solutions for business clients.

Arbitrage using flash loans

Flash loans can be explained as borrowing funds without the need for collateral. Their name is due to the loan being given and repaid within a single block. If the loan amount cannot be returned plus interest, the transaction is canceled before it can be validated in a block. This essentially means that the loan never happened, as it was never confirmed and added to the chain. A smart contract controls the whole process, so no human interaction is needed.

To use a flash loan, you need to act fast. This requirement is where smart contracts come into play again. With smart contract logic, you can create a top-level transaction containing sub-transactions. If any sub-transactions fail, the top-level transaction will not go through.

As an example, imagine a token trading for $1 (USD) in liquidity pool A and $1.1 in liquidity pool B. However, you have no funds to purchase tokens from the first pool to sell in the second. So, you could try to use a flash loan to complete this arbitrage opportunity within one block. We can then break this down into smaller parts of the whole process.

  1. The borrowed funds are transferred to your wallet.
  2. You purchase $100 of crypto from liquidity pool A and receive 100 tokens.
  3. You sell the 100 tokens for $1.10, giving you $110.
  4. You transfer the loan plus borrowing fee into the flash loan smart contract.

If any of these transactions within the block cannot execute, the lender will cancel the loan before it takes place. Using this method, you can make profits with flash loans without any risk to yourself or collateral. Classic opportunities for flash loans include collateral swaps and price arbitrage. However, you can only use your flash loan on-chain, as moving funds to a different chain would break the one transaction rule.

NFT Lending

Mainly provided as the OTC service for the holders of top NFT collections (BAYC, CryptoPunks). C-ratio of the lended NFT is 20-30% of the NFT’s market price. YouHodler as an example.

L&B platforms on NEAR

Mainnet

OIN Finance

Overview

Current TVL: $4 337 049

A decentralized multi-chain (in future) stablecoin issuance protocol, enabling users of other public blockchains to stake their own native tokens as collateral to mint USD-pegged stablecoins. Also acts as a multi-chain stablecoin liquidity aggregator protocol, enhancing permissionless composability by allowing multi-chain stablecoins to be exchanged.

Features of the platform

There are 2 main options of OIN usage for users, let’s take a NEAR as an example:

  • First option is when long-term holders of NEAR need liquidity. Instead of selling it to the market, the holders can use the OIN protocol to lock up NEAR as collateral and borrow aUSD. The borrowers can then repay the loan at a future date. This process allows the holders to gain liquidity while still maintaining their exposures to the long-term growth of NEAR.
  • Second options is for borrowers to take leveraged positions on assets they hold bullish views on. Holders can first borrow against NEAR as collateral on OIN to receive aUSD, which can then be used to purchase additional NEAR. This process can be repeated several times until the users reach the Minimum Collateralization Ratio – the lowest C-Ratio a user must maintain in order to prevent a Liquidation Event from being triggered. Subsequently leveraging the holders’ NEAR positions to multiple times.

As a borrowing asset, OIN issues stablecoins on their own platform (e.g nUSDO). Interest rates also are paid in stablecoins

Below you can view an explanation of the OIN stable asset pegging to the US dollar.

1. Market-driven price parity

If the stablecoin price drops below $1, it makes it attractive for borrowers to burn and repay their debt. When there are more people repaying the debt than people borrowing in the market, it reduces the total stablecoin supply in the market, and gradually returns the stablecoin peg back to parity. Conversely, if the stablecoin price rises above $1, it becomes more attractive to borrow money as people believe that it will be cheaper to repay in the future when the price returns to equilibrium. As there are more borrowers than repayers in the market, the total stablecoin supply will increase, depreciating the stablecoin price back to its parity.

Overall, this soft-peg mechanism is built on people’s belief in the 1:1 peg. Short-term price deviations will create opportunities for them to take advantage of through borrowing and repayment, returning the underlying stablecoin price back to its long-term price equilibrium.

The arbitrage effect above is strengthened by the value that is represented by the stablecoin – the collateral. Since the stablecoins are over-collateralized, each $1 of stablecoin represents a minimum of $1.80 worth of collateral, with the liquidation mechanism ensuring that the overall system C-ratio stays above this value. In essence, if the value of collateral is threatening to fall below the value of the stablecoin, the system liquidates the risky troves to push its value back up. This provides a decentralized mechanism that provides a floor for the value of the stablecoin, and thus gives confidence to the arbitrageurs wanting to capitalize on undervalued opportunities.

2. Stability-Pool-driven price parity

A proportion of the stablecoins minted will be deposited into the Stability Pool, lowering the total amount of stablecoins in market circulation. While the main purpose of the Stability Pool is to support liquidation and enhance they system’s stability via a liquidity reserve, it also helps with maintaining the Dollar price peg for the stablecoins.

In a scenario where the price of the stablecoin rises above $1, the further it deviates, the more likely that Stability Providers will incur a loss when a Liquidation Event is triggered. As a result, some Stability Providers may decide to withdraw their deposits from the Stability Pool, increasing the amount of stablecoins circulating in the market and depreciating the stablecoin price back to parity.

While this process may result in a thin or an empty Stability Pool, the OIN system also has a Redistribution mechanism – a second liquidation defence line that is designed to kick in when the funds in the Stability Pool become insufficient.

3. Stability fee driven price parity

OIN also utilizes different stability rates to influence the amount of stablecoins circulating in the market. When there is too much funding being borrowed causing the stablecoins trading below $1, the DAO community may choose to increase the stability rate, incentivizing borrowers to repay the loans; when the stablecoins are trading above $1, the DAO community can choose to decrease the stability rate, making it more attractive for users to borrow money.

AstroFarming

A feature of the OIN, that allows users to:

  1. Farm with your collateral
  2. Automate a leveraged degen strategy (looping). The AstoFarm function allows users to lever these assets, bringing their rewards up by the multiples of their leverage. In doing so, they can maximize their capital efficiency beyond their starting point of a simple hodl position. In essence, if you’re staking in the stablecoin liquidity pools, you can multiply your earnings while partaking in the farms all in a few simple clicks.

Loop refers to one complete cycle of collateral -> deposit -> mint -> swap for colalteral

Example of the loop:

1: User initiates AstroFarm on the OIN with 2x loop, and $1000 of USDC-USDT TLP tokens from Trisolaris

2: AstroFarm takes a flash loan of 1700 aUSDO

3: 1700 aUSDO is swapped for 850 USDC and 850 USDT through Trisolaris

4: The USDC and USDT are staked into the USDC-USDT liquidity pool on Trisolaris

5: The resulting LP tokens from Step 4 are then staked into the Farms on Trisolaris

6: The user now has: Debt position: ~1700 aUSDO Staked: ~$2700 USDC-USDT TLP into the Trisolaris Farm Total collateral value: ~$2700 USDC-USDT TLP Total leverage: ~2.7x C-ratio: ~150%

Burrow

Overview

Current TVL: $424 264 039

A decentralized, non-custody platform with pool-based interest rates. Provides L&B solution for users and it runs only on NEAR now. The basic principles of use are similar to Aave, Compound, etc.

Features of the platform

Users can lend their assets to the protocol and immediately begin earning passive interest. The rates are variable and will fluctuate based on the utilization rate for the given asset.

Users can withdraw their supplied assets at any time, as long as the utilization rate for the asset will be less than 100% after the withdrawal. If the withdrawal will raise the utilization rate to 100%, the withdrawal will be temporarily unavailable (note: if this does occur, it will be a very expensive situation for borrowers, and lucrative for lenders). Assets that are defined by the user as collateral don’t accrue interest.

All positions for borrowing must be over-collateralized. If the value of a user’s collateral drops below the minimum collateral ratio, their collateral will be liquidated to pay off their debt.

Each asset has a unique minimum collateral ratio, as each asset carries unique risk. The collateral ratios of each asset can be found here.

The aggregate risk of an account can be understood through the Health Factor.

If the health factor is higher than 100%, it means the account is in a good state and can’t be liquidated. If the health factor is less than 100%, it means the account can be partially liquidated and can’t borrow more without repaying some amount of the existing assets or providing more collateral assets.

Example:

Account example.near lended to collateral 1000 wNEAR and borrowed 4000 nDAI.

the price of wNEAR is 10

the price of the nDAI is 1

the collateral_factor of wNEAR is 0.5

the collateral_factor of nDAI is 1

The health factor of example.near is the following:

adjusted_collateral_sum = sum(1000 * 10 * 0.5) = 5000

adjusted_borrowed_sum = sum(4000 * 1 / 1) = 4000

health_factor = 5000 / 4000 = 125%

Interest rate

Each asset defines interest rate configuration with the following values:

target_utilization – the utilization rate targeted by the model, e.g. 80% borrowed comparing to the total supplied.

target_utilization_r – the constant to use as a base for computing compounding APR at the target utilization.

max_utilization_r – the constant to use as a base for computing compounding APR at the 100% utilization.

reserve_ratio – the percentage of the acquired interest reserved for the platform.

Based on these values we define 3 points of utilization: 0%, target utilization and 100%. For each of these points we have the r constant: 1.0, target_utilization_r and max_utilization_r respectively.

To compute the APR, the following formula is using:

1 + APR = r ** MS_PER_YEAR, where MS_PER_YEAR is the number of milliseconds in a year equal to 31536000000.

Based on the current supplied, reserved and borrowed balances, the current utilization is defined using the following formula:

utilization = borrowed / (supplied + reserved)

To compute the current APR, we need to find the current r constant based on the linear interpolation between utilization points:

if utilization <= target_utilization, r = target_utilization_r * (utilization / target_utilization)

if utilization > target_utilization, r = target_utilization_r + (max_utilization_r - target_utilization_r) * (utilization - target_utilization) / (1 - target_utilization)

To calculate the amount of interest acquired for the duration of t milliseconds, we can use the following formula:

interest = (r ** t) * borrowed

The interest are distributed to reserved and supplied, based on reserve_ratio, so the new values are:

reserved_interest = interest * reserve_ratio new_reserved = reserved + reserved_interest new_supplied = supplied + (interest - reserved_interest) new_borrowed = borrowed + interest

Liquidation

A liquidation is triggered when an account’s Health Factor goes below 100%, due to its collateral value not being sufficient to cover the debt value. This might happen when the collateral decreases in value or the borrowed debt increases in value. Burrow’s liquidation mechanism is designed to make liquidators compete for the profit that they make during liquidations to minimize the loss taken by unhealthy accounts. This is achieved by introducing a variable discount with variable liquidation size, Instead of offering a fixed profit that is used in other protocols.

Example:

Account example.near supplied to collateral 1000 wNEAR and borrowed 4000 nDAI.

Let’s set the price of wNEAR is 10; the price of the nDAI is 1;

The collateral_factor of wNEAR is 0.5

The collateral_factor of nDAI is 1

The health factor of example.near is the following:

adjusted_collateral_sum = sum(1000 * 10 * 0.5) = 5000

adjusted_borrowed_sum = sum(4000 * 1 / 1) = 4000

health_factor = 5000 / 4000 = 125%

Let’s say the price of wNEARdrops to 8

adjusted_collateral_sum = sum(1000 * 8 * 0.5) = 4000

adjusted_borrowed_sum = sum(4000 * 1 / 1) = 4000

health_factor = 4000 / 4000 = 100%

The health factor is 100%, so the account still can’t be liquidated.

Let’s say the price of wNEAR drops to 7

adjusted_collateral_sum = sum(1000 * 7 * 0.5) = 3500

adjusted_borrowed_sum = sum(4000 * 1 / 1) = 4000

health_factor = 3500 / 4000 = 0.875 = 87.5%

The health factor is below 100%, so the account can be liquidated. The discount is the following:

discount = (1 - 0.875) / 2 = 0.0625 = 6.25%

It means anyone can repay some nDAI and take some wNEAR from example.near with 6.25% discount.

Account bob.near decides to liquidate example.near

bob.near wants to repay 1000 nDAI, we can compute the maximum sum of the collateral to take:

repaid_sum = sum(1000 * 1) = 1000

max_taken_sum = repaid_sum / (1 - discount) = 1000 / (1 - 0.0625) = 1066.666

And based on the wNEAR price, we can compute the maximum amount:

max_wnear_amount = max_taken_sum / wnear_price = 1066.666 / 7 = 152.38

But to avoid risk, bob.near takes 152 wNEAR – a bit less to avoid price fluctuation for the duration of the transaction.

Let’s compute the liquidation action:

taken_sum = sum(out_asset_i * price_i) = sum(152 * 7) = 1064

discounted_collateral_sum = taken_sum * (1 - discount) = 1064 * (1 - 0.0625) = 997.5

repaid_sum = sum(in_asset_i * price_i) = sum(1000 * 1) = 1000

new_adjusted_collateral_sum = sum((1000 - 152) * 7 * 0.5) = 2968

new_adjusted_borrowed_sum = sum((4000 - 1000) * 1 / 1) = 3000

new_health_factor = 2968 / 3000 = 0.9893 = 98.93%

Now checking the liquidation rules:

1. 87.5% < 100% 2. 997.5 <= 1000 3. 98.93% < 100%

All rules were satisfied, so the liquidation was successful.

Now, let’s compute the profit of bob.near (or the loss for example.near) for this liquidation:

profit = taken_sum - repaid_sum = 1064 - 1000 = 64

Notes:

During the time when the price of wNEAR was falling from 8 to 7, if someone liquidated example.near, they would have made less profit, by liquidating a smaller amount with a smaller collateral discount.

To fully realize the profit, bob.near has to make another transaction to swap received 152 wNEAR for nDAI, which may involve extra fees and transactional risks. That’s why liquidators may wait for higher discount.

Conclusion

At the moment, the largest L&B platform on NEAR that uses Aave-like lending system with issuance of interest bearing tokens on locked assets


Testnet / Dev stage

CrossFi (testnet)

Overview

A cross-chain liquidity sharing protocol characterized by multi-chain lending and synthetic assets. They trying to connect together isolated liquidity of many public chains.

Taker (testnet)

Overview

Taker realizes a collateral-free and risk-free NFT lending model that can be adopted by the games, guilds, and public chains. For lending, Taker creates a unique DAO-based model which ensures a more fair price finding process and provides instant loans for the borrowers.

Nearlend (dev)

Overview

A non-custodial lending and borrowing liquidity protocol on the NEAR blockchain. The team presented the initial solution of the decentralized non-custodial lending protocol with multi-collaterallized loans. The main ideas are:

  • Usage of all liquidity – no isolated pairs, the whole liquidity participates in the collaterisation.
  • Modularity – the protocol provides building blocks which can and should be included into DeFi strategies built upon opend markets.
  • Support customization at the higher level – allow custom markets creation and custom interest rate models and allow users to utilize this functionality.

The structure and evaluation of interest bearing tokens

When people depositing tokens on the decentralized lending platforms, they receiving interest bearing tokens. For example: cTokens in Compound and aTokens in Aave

aToken

Aave’s aToken uses a unit increase model, meaning a holder’s balance of aTokens will increment up as the asset pool grows from interest payments made by borrowers. For example, if you deposit 1 ETH in the Aave ETH pool you’ll be minted 1 aETH token. As the pool accumulates interest your aETH token balance will increment up so that your aETH token balance is greater than 1, reflecting your claim on a growing pool of assets. When an aETH token holder goes to redeem the underlying ETH their aETH will be redeemed 1:1 with the underlying ETH.

Suppose the above holder has held their aETH token for a year and they are looking to redeem their aETH balance for the underlying ETH. They notice that their aETH balance is now 1.05. This balance entitles them to 1.05 ETH of the existing ETH pool. If the aETH holder does redeem their aETH they will have earned .05 ETH in interest over that year, or 5% APY.

cToken

Compound’s cToken uses an exchange rate increase model, meaning the exchange rate between the interest bearing cToken and the underlying asset should increment up over time as interest payments accumulate in the pool.

Lenders in Compound are not issued more cTokens over time like aToken holders are. The amount of cTokens, for any given deposit, stays the same. Instead, the exchange rate of the cTokens will be algorithmically pushed up as the pool accumulates interest payments from borrowers. Even though the amount of cTokens won’t change, the price or value of the holder’s cTokens will increase over time.

Let’s use 1 ETH lender again for cToken example.

The user deposits 1 ETH in the ETH Compound pool and they receive 40 cETH in return, their exchange rate is 0.025 ETH/cETH at the time of deposit. As interest is accumulated over time the exchange rate of ETH/cETH will be pushed up by the Compound protocol, based on the interest payments being made to the ETH pool, giving the cETH holder the right to claim more ETH than they put in initially. The lender holds their 40 cETH for a year like the previous example and redeems their 40 cETH for 1.05 ETH a year later. This would mean the exchange rate or redemption price of cETH has risen from 0.025 ETH/cETH to 0.02625 ETH/cETH in a year. The holder’s interest rate on the year equates to about 5% APY minus any gas fees paid for the deposit and redemption transactions.

Interest rates in Aave and Compound are dynamic, always shifting with the flow of funds in and out of the protocol, so it’s impossible to know beforehand what your exact interest earned over a certain timeline will be. However, these applications do show you the current interest rate of any given asset pool and we can track historic interest rates of these pools to get an idea of what you can expect to earn.

On both Aave and Compound’s sites, they show the current interest rates for each market they serve and they both have thorough documentation that outlines not only how these rates are calculated but if you’d like to view all the info regarding their features, you can find it here: Compound Doc & Aave Doc.

Top-3 L&B platforms

Based on TVL according to DeFi Pulse

Maker (Oasis)

Oasis Borrow is the portal users will access to secure their collateral assets (ETH and BAT at MCD launch, as approved through a Maker Governance Executive Vote) in Vaults to generate Dai. Importantly, each collateral asset deposited will have its own Vault. So, users will be able to open multiple Vaults from the Borrow dashboard, and manage them quickly and easily. Borrowing asset is DAI – stablecoin of Maker.

Aave

Aave is an open source, non-custodial multi-chain money market protocol – it enables users to borrow and lend from liquidity pools in the absence of a centralized intermediary. Aimed at tackling the limitations of centralized finance players, Aave runs purely on smart contracts with all assets and systems managed by its network of nodes. Also it supports flash loans.

Compound

Compound is a decentralized, blockchain-based protocol that allows users to lend and borrow different kinds of assets. Also it’s one of the first L&B platforms, that implemented DAO and voting for proposals and new assets adding.

Conclusion

Depending on the project roadmap, we can implement the following features in terms of L&B:

  1. Users lend assets, don’t receive interest token and borrow existing stablecoins (e.g USN, USDT) In this case we don’t to issue interest token and users just lock their assets, receive and compound lending interest. The fastest solution in terms of implementation, but currently not competitive because DeFi platforms are mostly issuing for locked assets interest bearing tokens and users can further dispose of assets, increasing profits.
  2. Users lend assets, receive interest tokens (e.g NEAR —> spNEAR) and may borrow any asset, that listed on the platform. For example, user lend NEAR and borrow WBTC.
  3. Users lend assets, receive interest tokens and borrow stablecoins, that we’re also issuing and maintaining (e.g USDO on OIN). The most difficult option possible, since in addition to creating a lending platform, we’ll need to develop stability maintenance of the USD-pegged asset. In fact, creating our own stable, which is a separate project and will require additional resource costs. Such project is created, for example, by the OIN, but they initially position themselves as a standardized stablecoin issuance solution for multiple public blockchain networks.

Interest bearing tokens bringing much more opportunities to user incetivization, for example, Aave tokens can be traded as any other underlying asset on DEXes, gaining profit from lending and can be used on yield platforms. Subsequently, it’s possible to create staking pools, yield farms, etc. with interest bearing tokens, that will have better rates than the same with the underlying assets to incetivize users lend their assets in lending pools on our platform.

Posted in DeFi, Research