# ThorChain Lending: New Primitive DeFi

By [0xOuterGod](https://paragraph.com/@0xoutergod) · 2023-08-30

---

Innovation in DeFi exists, it’s real, and has the power to fundamentally change the way crypto is securely managed through **_non-custodial and trustless tools_**.

*   [**_Uniswap_**](https://uniswap.org) through _xy=k pools_ enabled the emergence of **DEX** (decentralized exchanges) as we know them today. To date Uniswap has come to develop the _concentrated liquidity model_ (Uniswap v3) and now version 4 is in development.
    
*   Following the success of Uniswap, [**_Balancer_**](https://balancer.fi) has devised _Liquidity Bootstrapping Pools_, i.e., pools that dynamically change the weight of tokens. No longer 50/50 pools, but even different distributions, allowing teams to _start_ _even with lower capital_.
    
*   [**_MakerDAO_**](https://makerdao.com/en/) through the stablecoin $DAI allows for the _creation of collateralized debt positions_ (**_CDP_**) by locking ETH into a smart contract. This tool has made it possible to build strategies that go to optimize capital efficiency.
    
*   [**_GMX_**](https://app.gmx.io/#/v2) is another DEX, introducing the ability to _trade perpetual contracts_, which are derivative products that simulate the price movements of an underlying asset without an expiration date.
    
    The revolution lies in the fact that the traders' counterpart is not a centralized exchange, but retail users who deposit their cryptos into a _basket of assets_ named **GLP**; this basket will then go on to represent an index, which collects over time the _protocol fees_ in addition to the _margin of the traders_ who are liquidated.
    
*   The **_ve(3,3) model_** is a complex concept that arose _from the combination of the vote-escrowed tokens_ introduced by [**Curve Finance**](https://curve.fi) _and the application of game theory_ introduced by [**Olympus DAO**](https://www.olympusdao.finance).
    
    The model of a reserve currency did not work, but this model applied to DEXs allowed the emergence of the _current leading DEXes in the crypto world_: the first ever was **Solidly** by Andre Cronje, later optimized by the various forks, such as [**_Velodrome_**](https://velodrome.finance/), [**_Thena Finance_**](https://thena.fi/), **_Ramses Exchange_**, [**_Chronos_**](https://chronos.exchange/), and many others.
    
    This allowed DEXes to create _sticky liquidity_ and _optimize the liquidity bootstrapping process for smaller projects_.
    
*   [**_Y2K Finance_**](https://www.y2k.finance/) has introduced _options_, an advanced derivative instrument that allows to open _hedging positions on stablecoin pegs and soft-pegged assets_ (such as stETH vs ETH)
    
    This protocol is still not much liquid, but it has managed to prove fully functional during the various depegs of this bear market: _USDC with the SVB failure_; _MIM, MAI, and FRAX_ with the Curve Finance hack case.
    

The time has come to introduce a new primitive: **_ThorChain Lending_**.

What is Thorchain Lending?
--------------------------

**_ThorChain Lending_** is a new feature introduced by the team of ThorChain. It is a new way of understanding lending in the crypto world. No more money market, but more like _perpetual options_.

The loan has **no interest rate**, **no liquidation risk**, and **no time limit**. It sounds great on paper, but once you open the position, you _cannot increase the debt_ even if the collateral were to increase in value, let alone decrease the collateral of the position.

Solving the design problems of a trustless non-overcollateralized lending system
--------------------------------------------------------------------------------

### Debt Denomination

THORChain allows **_swapping between different L1 native assets_** (e.g., BTC, ETH, BCH, ATOM etc.), but to carry a lending system it needs to have scalable security: the collateral must always be secure.

The two components of a loan are **_collateral_** and **_debt_**, but there is a problem to be solved: how to issue the debt. In fact, if the collateral is a Layer-1 asset, we must decide _what denomination to use for the debt_.

*   **Debt can be denominated in RUNE**. Relatively simple to develop, but this would create _selling pressure on RUNE_ and would not attract capitals from the outside into the system. It would also add the risk that the RUNE token would be subject to speculative shorts in order to weaken the credit market on THORChain.
    
*   **Debt can be denominated in fiat currencies**. The USD is the largest market that can be addressed; at this point we can say that all other denominations can be excluded.
    

To issue USD-denominated debt, it is necessary to _create a stablecoin_, which can belong to one of the following categories.

*   **_Wrapped Asset_**. However, this is _incompatible with the security model_ adopted by THORChain, which in fact allows the use of only native assets, not wrapped assets.
    
*   **_Synthetic Asset_**, using liquidity pools. It could work, but it would _compete for the same security space_ as other vital features such as Savings and LP, and this space has a limit. Added to this risk is the _impermanent loss risk_ on the RUNE-syntheticASSET pool.
    
*   **_Derived Asset_**, using _RUNE as equity_. This model is easily scalable, attracts new capital into the system while also creating buying pressure on RUNE and increases network security.
    

There are several stablecoin models in circulation, and their mere existence is extremely complex to manage. The creation of a new THORChain stablecoin would result in the creation of significant dependencies and risks, including _issuer centralization_, _single-point-of-failure risk_, _speculative manipulation on the_ stablecoin's _peg_ etc.

This led the THORChain team to develop **TOR**, an **_indicator of the median price of a basket of stablecoins resistant to manipulation_**. TOR thus becomes an algorithmic unit of account, rather than an actual asset. In fact, it is **_not transferable_** and has the mere **_function of a unit of account_**. Its market cap will always remain **$0**.

### Liquidation of overcollateralized positions

In this system, the **price of the collateral is irrelevant**: in fact, if it fell below the value of the debt, this would pose no risk to the protocol. In fact, the _collateral_ corresponds to the _liability_, which is _denominated in the form of equity_ (in RUNE).

The addition of _per-loan liquidation risk based on the price of a 3rd asset_ (RUNE) increases the complexity of the system and _leads to cascading liquidation risks_, which can cause manipulation on the price of the asset itself.

Therefore, **instead of liquidations**, a _cap_ was _imposed_ _on the opening of new loans_. Specifically, the lending protocol tolerates a **~3% increase in RUNE supply** before permanently closing this feature; _reserves_ would instead _cover the repayment of_ collateral of _already open positions_.

This "forced liquidation" system would avoid causing death spirals, as happened to LUNA/UST during the failure of the Terra LUNA protocol in May 2022.

Loan Opening
------------

Let us then consider the intermediate processes that lead us to opening a loan. Conditions to loan opening:

*   1 BTC = $20’000
    
*   1 RUNE = $2
    
*   Slippage Fee = 1%
    

The user **deposits an L1 asset as collateral** - 1 BTC - which is _immediately swapped for RUNE_ and _burned_:

`1 btc.BTC --→ 9’900 RUNE --→ burnt`

(`0.01 btc.BTC` as fees to LPs)

Debt is accounted for through **derived assets**, specifically:

`debt = (collateral - swapFees) / collateralRatio`

e.g `debt = (1 btc.BTC - 0.01 btc.BTC) / 200% = 0.495 thor.BTC = 9’900 TOR`

At this point **enough RUNE are mint** to generate the loan:

`mintedDebt = (TOR)debt / priceRUNE`

e.g. `mintedDebt = 9’900 / 2 = 4950 RUNE`

The _loan_ at this point is _swapped for the L1 asset requested to be borrowed_ by the user, in this case it is **USDC**:

`4950 RUNE --→ 9801 USDC`

(`49.5 RUNE` as fees to LPs)

Loan Closure
------------

We consider the same prices as the loan opening and the same slippage for loan closing as well.

The user begins the procedure by _depositing the amount of USDC_ borrowed - minus the swap fees. To close the position then the **USDC is swapped for RUNE**:

`10’101.01 USDC --→ 5’000 RUNE`

(`101.01 USDC` as fees to LPs)

The **RUNE** obtained from the swap **are burned** in order to mint enough TOR to repay the loan:

`debtRepayment = (RUNE)repayAmount * priceRUNE`

e.g. `debtRepayment = 5’000 RUNE * $2 = 10’000 TOR`

The _loan therefore is repaid_ and the **1 BTC collateral** can be **unlocked**. In order to unlock it, the **_RUNE needed to buy it at market price_** on the RUNE-BTC pool of THORChain's DEX **_are minted_**.

`mintRUNE = (collateral + (collateral * swapFees)) * priceBTC / priceRUNE`

e.g. `mintRUNE = (1 BTC + 0.01 BTC) * $20’000 / $2 = 10’000 RUNE`

(`100 RUNE` as fees to LPs)

After all these steps it becomes clear that **the opening and closing of a loan does not lead to an increase or decrease in the supply of RUNE**. In fact, this remains unchanged as long as asset prices do not change.

_Despite the attempt to make the calculations as accurate as possible, this is still a simulation, which also takes into account the derivative assets minted and burned during lending transactions._

_I encourage you to read the official documentation regarding THORChain Lending and the various protocols that will natively integrate this new feature._

![](https://storage.googleapis.com/papyrus_images/1af5c765ebd00af01a5de161a0fce9f6d6db7ccb7f29bc9811ae65f5d89e0518.png)

> _And don't forget to_ **_subscribe on Mirror_** _to stay tuned to all future articles._

[Subscribe](null)

Where can I use this new feature of THORChain?
----------------------------------------------

Here is the [direct link to **_ThorSwap_**](https://app.thorswap.finance/lending), the _1st implementation of P2P Lending on THORChain_. It currently integrates _only_ native _BTC_ and _ETH_ assets.

![ThorSwap's Lending UI](https://storage.googleapis.com/papyrus_images/78a8d50767b227c14e01d9469c93d81b81880bab7cf6845e3a194c1de608346d.png)

ThorSwap's Lending UI

However, another P2P Lending is on the way, _deployed natively on the Arbitrum network_, i.e., an Ethereum Layer-2, which greatly lowers transaction costs. Its name is Lends and it’s currently at alpha stage.

I recommend to all interested users [to sign up for the waitlist](https://www.lends.so/waitlist), even if you’re just interested to understand how does it work.

![https://www.lends.so](https://storage.googleapis.com/papyrus_images/141269ef52f7a9ef2b4641497c2736927091b2290de36ef4ab176ef765a8fca0.png)

https://www.lends.so

**_Issue #1412_** on GitLab: [Link](https://gitlab.com/thorchain/thornode/-/issues/1412)_THORChain Lending Docs_: [Link](https://docs.thorchain.org/thorchain-finance/lending)**_Lends_**, Fixed-Rate P2P Lending Protocol, Powered by THORChain\*: [Link](https://www.lends.so/)

_The protocols given are for educational purposes. I take no responsibility for your use of the contents of this article. If you like my work, I suggest you to subscribe._

---

*Originally published on [0xOuterGod](https://paragraph.com/@0xoutergod/thorchain-lending-new-primitive-defi)*
