FEATURE: Fixed-interest Collaterised Lending

Overview

Users can lock Liquidity Units or Synths into Collaterised Debt Positions (CDPs), and draw out debt from any pool in THORChain, using the purchasing power of RUNE. Since liquidity units are yield-generating, the yield (measured via redemption values - #794 (closed)) can be used to pay back the debt automatically.

Fixed Interest is charged against the Debt Amount and paid into the Debt Pool to drive yield for LPs in that pool. The interest rate is fixed per lender at the time of drawing debt, and is based on the debt loading of the target pool.

Users can manage their collateral (adding/removing), or manage their debt (drawing more or paying back). The state machine will fully liquidate a position if the collateral liquidation point drops below the debt value.

Implementation

Servicing

The state machine will track a member's collateral, debt and interest rate. Every block, it will choose a random member, evaluate the collateralisation ratio (CR) for liquidation, charge the interest and service the debt (if the member locks liquidity units). A parameter last_serviced_height tracks the last time the member's position was serviced. Interest Rates are measured block-by-block.

Drawing Debt

The member deposits collateral, with memo:

DRAW:COLLATERAL-ASSET:DEBT-ASSET:CR:DESTINATION-ADDRESS

CR: inverse of collaterilisation ratio in basis points, eg, 6667 = 66.67% debt to collateral amount, ie, $1000 of collateral can draw out $667 in debt.

The maximum a member can draw out is 10000, eg, 100% debt to collateral, but unless the price immediately changes in their favour, they will likely get liquidated the next time they are serviced. Most members will choose 66.67% or less, but more risky members can go higher in highly liquid pools to leverage up.

This instructs the state machine to evaluate and store:

// Evaluate Collateralised Value
if(isLiquidityUnits(collateralAsset)){
   collateralValueInRune = getAsymmetricShare(collateralAmount, collateralAsset)
} else {
   collateralValueInRune = getSwapOutputInRune(collateralAmount, collateralAsset)
}
let collateralisedValue = (collateralValueInRune * CR) / 10000
pool.runeDepth += collateralisedValue
runeTotalSupply += collateralisedValue

// Evaluate debt value
let debtValueInAsset = getSwapOutputInAsset(collateralisedValue, debtAsset) 

// Evaluate Interest Rate
let debtAmountForPool = getDebtAmount(debtAsset)
let interestRatePerAnnum = debtAmountForPool / assetDepth 

THORChain immediately mints collateralisedValue and swaps it into the debt asset, where the member will receive debtValueInAsset at their address. They can choose L1 or synths as the asset.

Managing the Position

Drawing more debt, member can send the tx again, with or without more collateral asset added.

THORChain will target the CR specified, if it exceeds the CR existing, it will swap and send more debt to the member (increase CR).

If it does not exceed, then the collateral is just added to the position reducing the CR (safer).

DRAW:COLLATERAL-ASSET:DEBT-ASSET:CR:DESTINATION-ADDRESS

The interest rate for the member is updated to be the aggregate between the existing interest rate and the new one (based on debt loading when drawing more debt).

Paying back debt

Member can pay back debt by swapping in their debt asset, with memo:

PAY:COLLATERAL-ASSET

THORChain swaps to RUNE, burns that, reduces the amount of debt:

pool.assetDepth += debtAmountPaidBack
member.debtValue -= debtAmountPaidBack
let collateralValueInRune = getSwapOutputInRune(debtAmountPaidBack, debtAsset)
pool.runeDepth -= collateralValueInRune
runeTotalSupply -= collateralValueInRune

Closing Position

The CR is evaluated against the entire collateral held, so it is always "locked" and used. Thus if there is any debt outstanding (even a tiny amount), the collateral is still locked, although the CR is extremely small. To unlock the collateral, the user must have 0 member.debtValue. Then they can send:

CLOSE:COLLATERAL-ASSET:POINTS

Which closes the CDP and returns the collateral asset (or unlocks liquidity units) to the Basis Points specified.

Paying Interest Rate

Every servicing schedule, the interest amount is charged against the debt value for the member, but deducted from the collateral amount and withdrawn to RUNE. This RUNE is credited to the debt asset pool as income for those LPs.

Eg, Member locks BTC/BTC, but draws ETH.USDT. Thus their interest rate is evaluated in terms of their ETH.USDT position, but deducted from their BTC/BTC collateral

If the IR payments cause the CDP to become unsafe, then the position can be liquidated.

Automatic Debt Payments

If the member chooses liquidity units as collateral, then each servicing schedule the redemptionValue is evaluated against the depositValue. If it exceeds it, then the excess amount is deducted to RUNE, and that RUNE burnt, and the debtValue is deducted. This pays off the debt when the LP borrower is making yield.

Liquidations

Each servicing schedule, the CDP is checked for liquidation against its liquidation point, the point at which, if sold, the collateral can only purchase an amount that is less than the debt, evaluated with double-slip.

x = collateralValueInRune
X = debtAsset.runeDepth
Y = debtAsset.assetDepth
liquidationPoint = (x X Y (2 x + X))/(x + X)^3
if(liquidationPoint < debtValue) {
   return true
} else {
   return false
}

This means the liquidation will ALWAYS result in the favour of the system, and not liquidate too late. There will be a small excess amount, which can be credited back to the member, the reserve, or ignored, in which case RUNE will become deflationary with large liquidations.

If liquidated, the collateral is withdrawn to RUNE, that RUNE deleted, and the debt wiped out for the member. The member would be left with no collateral and no debt.

Economic Theory

This system works:

  • The Borrower provides collateral, and borrows RUNE from the protocol
  • This RUNE is sold into the pools into the Debt Asset
  • Arb agents restore the pool balances because of the newly-added pool capital, in effect buying up more of the debt asset, making the pools deeper.
  • The Borrower only needs to pay back their Debt, denominated in the Debt Asset, and not in RUNE.
  • If the value of RUNE increases against the Debt Asset during the debt period, then ultimately less RUNE will be paid back, causing RUNE to be slightly inflationary under periods of heavy lending and positive price action.
  • The reverse is true, since more RUNE will be bought back when paying back debt if RUNE value goes down, RUNE will become slightly deflationary if it drops in value against the debt assets.
  • The throttle against minting infinite amounts of RUNE to create infinite amounts of Debt is the Borrower's resistance to paying interest rates. The Aggregate Interest Rate will be 10% if 10% of all of THORChain's pools are debt-loaded. It will be 100% if 100% of pool depths are debt-loaded. For Chaosnet, this is the equivalent of 8m extra RUNE being minted and sold into $40m into debt asset.
  • Theoretically if this were to happen, then all pools are earning 100% APY as a minimum, and over the course of the year, all collateral would be liquidated into RUNE and deleted.
Edited by THORChain