ThorChain Lending: New Primitive DeFi

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 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 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 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 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 and the application of game theory introduced by Olympus DAO.

    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, Thena Finance, Ramses Exchange, Chronos, and many others.

    This allowed DEXes to create sticky liquidity and optimize the liquidity bootstrapping process for smaller projects.

  • 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.

And don't forget to subscribe on Mirror to stay tuned to all future articles.

Where can I use this new feature of THORChain?

Here is the direct link to ThorSwap, the 1st implementation of P2P Lending on THORChain. It currently integrates only native BTC and ETH assets.

ThorSwap's Lending UI
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, even if you’re just interested to understand how does it work.

https://www.lends.so
https://www.lends.so

Issue #1412 on GitLab: LinkTHORChain Lending Docs: LinkLends, Fixed-Rate P2P Lending Protocol, Powered by THORChain*: Link

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.

Subscribe to 0xOuterGod
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.