The Old Tide Protocol

Note: This is old Tide Protocol

The old protocol is a stablecoin ( borrowing) protocol.
the new protocol at here

Team and Background

Tide is a team that focuses on blockchain and deep learning. Our members have about three years of blockchain development experience and have developed our team’s own Consortium Blockchain and some Dapp.

Project and Justification

The Nervos ecosystem is still in the early stages of development and a lot of infrastructure needs to be developed.
Looking back over the years of the rapid development of blockchain technology, it’s easy to see that the token economy has played a major role in the development of the blockchain. Since last year, Defi has started attracting a lot of attention and the Nervos community has been looking at the Defi area, and it’s not hard to find some discussion about Defi in the community. Defi is an area that can help a public blockchain build a great ecosystem, but due to the imperfect infrastructure of Nervos, no interesting Defi applications have been created yet, so our team thought we should develop a Defi infrastructure for Nervos: stablecoin protocol.

MakerDAO, while an excellent stablecoin solution, introduces unpredictable human factors into the design of its cleaners and auctions(This led to MakerDAO’s Black Thursday). Unlike MakerDAO, Tide is a Liquidity protocol on Nervos that will result in fewer human factors, better borrowing, and stablecoin design, and lower collateral ratio!

The Tide protocol, with good liquidity and low collateral ratio, will be the cornerstone of Nervos Defi, and the stable price will be the breeding ground for other more interesting Defi protocols. Tide allows users who have never known Nervos before to experience ckb swap with UDT and get a better impression of the Nervos Defi.

Nervos CKB’s unique Cell model enables the development of complex applications, we will continue to pay attention to proposals related to the Nervos ckb programming model and UDT, and modify this proposal in the future.

Read this article for a better understanding of the Tide protocol

Nouns

flow: stablecoin in tide

vault: Units where users store collateral CKB

drip: Units where users store flow and collateral CKB

Tide Protocol core mechanism

Borrowing

  1. Get the price of ckb/usd from oracle.
  2. the price of 1 flow is alaways $1.
  3. the minimum collateral ratio is 110% and the borrowed flow can’t be less than $20.

Retrieve CKB

  1. if borrower’s vault is not liquidated, you can retrieve the all CKB from vault.
  2. if borrower’s vault was liquidated, you can only retrieve the remaining CKB from vault.

Redemption

When the vault is liquidated and the borrower wants to retrieve the collateral of corresponding value

  1. Get the price of ckb/usd from oracle.
  2. the price of 1 flow is alaways $1.
  3. borrower uses the flow to repay the vaults(s) with the lowest collateral ratio.

Liquidation

When the collateral ratio of a vault in the system is less than 110%, the liquidation mechanism is triggered

  1. when the flow in stability pool is sufficient, destroy the flow to repay the debt and transfer CKB from the vault to the stability pool.
  2. when the flow in stability pool is insufficient, distribute vault’s debt and CKB to vault with the collateral ratio higher than 150% in the system. The higher the collateral ratio, the more debt is allocated, the more CKB is obtained, and the more profit.
  3. Global liquidation is triggered when the total collateral ratio of tide system is less than 150%. In global liquidation, the vaults(s) with the lowest collateral ratio will be liquidated until the total collateral ratio large than 150%(digest debt only with the stability pool).

Technical Specification and Implementation

Transactions

1. Create vault to swap flow:

Create a cell to store CKB, and send flow to borrower

2. Create vault metas:

Create a cell to store a list of collateral ratio, CKB counts for vaults in the tide system.

3. Retrieve CKB from vault:

Can’t retrieve CKB if the value of CKB is less than $20

4. Redemption:

Obtain CKB from the vault(s) with the lowest collateral ratio.

5. Create stability pool:

Create a cell to store information about drips.

6. Create drip cell (Units of the stability pool):

Create a cell for locking the flow and possible CKB to be obtained, and add drip information to stability pool.

7. Remove drip from stability pool:

After retrieve CKB/flow from drip, remove this drip information from stability pool.

8. Destroy the flow from stability pool:

Send collateral CKB to drip from liquidated vault, destroy flow in this drip, update information for drip in stability pool and vault meates.

9. Redistribution of debt:

Distribute vault’s debt and CKB to vaults with the collateral ratio higher than 150%, update liquidated vault and update vault metas

Transactions detail

1. Create vault to swap flow:

There are two input and three outputs

Inputs: Outputs:
Cell used to provide CKB Cell to locked CKB
Cell with pricing information(oracle cell) Cell to store the swapped out flow
Cell with remaining CKB

2. Create vault metas

There are one input and two output

Input Outputs
Cell used to provide CKB Cell to store vaults’ information
Cell with remaining CKB

3. Retrieve CKB from vault

There are four inputs, six outputs

Inputs Outputs
Cell used to provide CKB Cell to store vaults information
Vault metas cell Updated vault metas cell
Cell with the flow to repay Updated vault cell
Cell preparing to take out CKB Cell with remaining flow
Cell with collateral CKB
Cell with remaining CKB

4. Redemption

There are at least three inputs and four inputs

Inputs Outputs
Cell used to provide CKB Cell with remaining CKB
Vault(s) Cell with the lowest collateral ratio. Updated vault metas cell
Vault metas cell Cell with redeemed CKB
Vault cell(s) of transferred collateral ckb

5. Create stability pool

There are one input and two outputs

Inputs Outputs
Cell used to provide CKB Cell to store drips’ information( stability pool )
Cell with remaining CKB

6. Create drip

There are two input and three outputs

Inputs Outputs
Cell used to provide CKB Cell to locked flow (drip)
Stability pool cell Updated stability pool cell
Cell with remaining CKB

7. Remove drip from stability pool

Three inputs and at least three outputs

Inputs Outputs
Cell used to provide CKB Cell with remaining CKB
Cell to locked flow/CKB (drip) Cell with remaining CKB or flow
Cell to store drips’ informalitie(stability pool) Updated stability pool cell

8. Destroy the flow from stability pool

There are at least six inputs, at least five outputs

Inputs Outputs
Cell used to provide CKB Cell with remaining CKB
The vault cell to be liquidated Updated vault cell
Drip cell(s) with flow Updated drip cell(s)
Vault metas cell Update vault metas cell
Cell to store drips’ information(stability pool) Update stability pool cell
Cell to store vaults’ information(vault metas)

9. Redistribution of debt

There are at least four inputs and at least four outputs

Inputs Outputs
Cell used to provide CKB Cell with remaining CKB
The vault cell to be liquidated Updated vault metas cell
The vault cell(s) with higher collateral ratio Updated vault cell(s)
Vault metas cell

Oracle

We hope to use oracle from community or use oracle from coinbase/chainlink

Milestone

It will take about 6.5 months to get things done

Milestone 1 (1.5 Month)

Vault:

  • Lock ckb
  • Borrow flow
  • Retrieve ckb

Drip:

  • Lock flow
  • Retrieve flow

Vault metas:

  • Store vault information
  • Update vault information
  • Remove vault information
  • Caculate system total collateral ratio

Stability pool:

  • Store drip information
  • Update drip information
  • Remove vault information

Milestone 2 (1 Month)

Lock Script:

  • A lock script to check vault permissions
  • A lock script to check drip permissions

Vault :

  • redemption from the lowest collateral ratio vault(s)
  • Transfer debt and CKB to other vault
  • Offset debt from other vault
  • Transfer debt and flow to drip

Drip:

  • Can receive ckb from vault
  • Destory flow
  • retrieve ckb
  • Liquidation mechanism

Milestone 3 (1 Month)

Tests:

  • Test borrow flow
  • Test retrieve CKB
  • Test liquidation
  • Test lock flow to pool
  • Test retrieve ckb from drip
  • Test retrieve flow from drip

Milestone 4 (2 Month)

  • MVP Frontend for Tide with pw-sdk
  • User-friendly documentation for beginners

Milestone 5 (1 Month)

  • Full version of Tide Protocol
  • Full version of Tide frontend

Special thanks to @stwith and @zhixian for their help in preparing this proposal!