# Product Paper

## **Overview**

Ruler Protocol is a lending platform where users can borrow their preferred cryptocurrency with any other cryptocurrency as collateral.&#x20;

It aims to fill the gap by enabling the following:

* No liquidations as long as borrowers pay back on time
* Interest rates determined by supply and demand
* Fixed rate loans at the moment of borrow / lend
* Fungible loans, tradable anytime & anywhere

The heart of Ruler Protocol is its Ruler Pairs.

## **Ruler Pairs**

Ruler pairs are at the core of Ruler Protocol. Each pair consists of the following elements:

* **Collateral token** (ex. wBTC)
* **Paired token**, the token users have to payback (ex. Dai)
* **Expiry**, the time users have to pay back (ex. 12/31/2021)
* **Mint ratio**, the ratio of collateral to paired token. 10,000 mint ratio @ $30,000 collateral price = 300% collateralization ratio

Each Ruler pair issues two fungible tokens (rTokens). rTokens are minted for each staking event by a borrower. The Ruler capital token (rcToken) represents the right to collect the payments of the loan after expiry. The Ruler repayment token (rrToken) represents the obligation to pay back the loan and receive the collateral before expiry. If borrowers don't payback on time, the loan is considered defaulted, and collaterals are forfeited by the borrowers.

### **Two Fungible Tokens (rTokens - rcToken & rrToken)**

Two fungible tokens are minted when a user deposits collateral into Ruler for each Ruler Pair. Based on the collateral type, there will be a mint ratio between the rTokens and the collateral. For example, 1 wBTC deposited as collateral may mint 10000 rTokens (300% collateralization ratio @ 30000 wBTC price).

#### **1. Ruler Capital Token (rcToken)**

The rcToken represents the right to collect loan payments (in paired tokens) **after expiry**.

Borrowers can sell rcTokens for paired tokens to complete the cycle of borrowing (receive paired tokens in the end and deposit collateral to begin with). Each rcToken is eligible to collect 1 paired token when no defaults. \
\
\&#xNAN;***Ticker symbol***&#x20;

* `RC_{Collateral}_{Mint Ratio}_{Paired Token}_{Expiry}`

***For example, rcToken for (wBTC, Dai, 12/31/2021, 10000) pair (300% collateralization ratio @ $30,000 wBTC price) has the following symbol***

* `RC_wBTC_10000_Dai_12_31_2021`

1 `RC_wBTC_10000_Dai_12_31_2021` will be able to collect 1 Dai after 12/31/2021.

#### **2. Ruler Repayment Token (rrToken)**

The rrToken represents the obligation to pay paired tokens and get back collateral **before expiry**. Each rrToken is eligible to receive a portion of the collateral by paying back 1 paired token.&#x20;

***Ticker symbol***&#x20;

* `RR_{Collateral}_{Mint Ratio}_{Paired Token}_{Expiry}`

***For example, rrToken for (wBTC, Dai, 12/31/2021, 10000) pair (300% collateralization ratio @ $30,000 wBTC price)  has the following symbol***

* `RR_wBTC_10000_Dai_12_31_2021`

1 `RR_wBTC_10000_Dai_12_31_2021` will receive 1/10000 wBTC by paying back 1 Dai.

### **Interest Rate**

Notice that there was no discussion of an interest rate above. That is because the interest rate is **determined by the price at which the rcTokens are sold by the borrowers**. The difference between 1 paired token and the price received for an rcToken is then annualized using the expiry to calculate the effective interest rate that is paid. Of course, if the collateral drops in value sufficiently then the borrower will likely just forfeit the collateral in which case the effective interest rate would be lower.

### **Minimum Collateralization Ratio and Use of Oracles**

Ruler fixes the minting ratio for a given Ruler Pair for the life of the pair. That means that until the pair’s expiry, the same number of tokens will be minted per unit of the collateral (the minting ratio).  However, if the price of the collateral (as determined by an oracle) drops sufficiently such that:

&#x20;**`Collateral Price / Mint Ratio < Minimum Collateralization Ratio`**

then depositing will be disallowed (either manually or through an Oracle price check) until the price rises to bring the collateralization ratio back above the minimum. This mechanism prevents minting when the price of the collateral is close to or below the value of the repayment of the Ruler Repayment Tokens. If minting were allowed with the price below expected repayment value, then risk of free mints would be possible whenever there are prepayments.

For example, imagine the minting ratio is 10000 and a user deposits 1wBTC to mint 10000 rcTokens and rrTokens. The user then sells the rcTokens and holds rrTokens. Before expiration, the user prepays 10000 DAI along with 10000 rrTokens and receives the 1 wBTC back. However, still before expiration, the price of wBTC drops to $9000. There is now a risk free mint to deposit 1 wBTC and mint 10000 rcTokens and rrTokens and then default on the repayment. The 10000 rcTokens would then receive the pro-rata share (50%) of both the 10000 DAI already prepaid into the capital pool and the 1 wBTC forfeited. This 5000 DAI + 0.5 wBTC would be worth $9500 for a risk free profit of $500. By eliminating minting below a certain threshold this situation is avoided.\
\
Disclaimer: Oracle is ignored if the collateral does not have an onchain price feed.

## Examples

### A borrower has 1 wBTC and wants to borrow Da&#x69;**,**

In this example, 1 wBTC is worth 30000 DAI and the collateralizataion ratio is 300%, so the mint ratio is 1000&#x30;**.**

* Deposit wBTC as collateral and mint 10000 rcTokens `(RC_wBTC_10000_Dai_12_31_2021)` and 10000 rrTokens`(RR_wBTC_10000_Dai_12_31_2021`.&#x20;
* The Borrower then goes and sells `RC_wBTC_10000_Dai_12_31_2021` through a DEX pool for whatever currency they prefer. The amount of the sale would be the actual loan amount.&#x20;
* The Borrower needs to make the payment by the expiration, if not, the borrower will forfeit the collateral.
* Before the expiration, the borrower deposits 10000 Dai and 10000 repayment tokens`(RR_wBTC_10000_Dai_12_31_2021)` into the contract and receives the 1 wBTC collateral in return.

#### Borrower

Bob deposits 1 wBTC into Ruler Protocol, Bob gets 10k rrTokens and 10k rcTokens.

He then sells 10k rcTokens for 9.5k Dai to Alice.

Bob uses the 9.5k Dai to do whatever he wishes with no risk of liquidation.

Before expiry, Bob pays 10k Dai + 10k rrTokens to Ruler and gets back 1 wBTC.

#### Lender

Alice buys 10k rcTokens from Bob for 9.5k Dai.

After expiry, Alice collect 10k Dai by transferring the 10k rcTokens to Ruler.

**In the above example, Bob paid 500 Dai for the loan of 9500 Dai and Alice received 500 Dai interest for the loan she provided.**

## FAQ

### **When and who can mint rTokens?**

rTokens can be minted at any time by anyone before the expiry of the Ruler Pair.  Naturally, **closer to the due date the rcTokens should be worth more (but < 1 paired token)** because the rcToken holders will be paid back sooner. However, the value of the collateral is also a factor. **As the value of the collateral goes down, rcTokens will also go down in value** as the risk of the collateral not being sufficient to cover the obligations increases.&#x20;

### **What happens if the borrower does not pay on time?**

If the borrower misses the payment deadline (expiry of the Ruler Pair), the collateral will be forfeited. The forfeited collateral will be split pro-rata among the rcToken holders of that Ruler Pair.

***Taking Ruler Pair (wBTC, Dai, 12/31/2021, 10000) as an example.***

* 1 wBTC deposited for the pair, 10000 rTokens minted
* At expiry, only half (5000) of the `RR_wBTC_10000_Dai_12_31_2021` are paid back (a default rate of 50%)
* The pair now has 0.5 wBTC + 5000 Dai in the contract.
* Each rcToken will be eligible to receive  (0.5 wBTC + 5000 Dai) \* (1 / 10000)&#x20;

## &#x20;
