NexisDAO will solve the problem of poor liquidity of CKB on Nervos DAO. Nervos DAO, as a system contract of Nervos, is one of the important highlights of the CKB economic model. Holders can deposit their CKB into Nervos DAO at any time to obtain income. However, Nervos DAO is a kind of fixed deposit, and there is a shortest deposit period, resulting in poor liquidity of CKB.
dCKB is a token implemented by NexisDAO for Nervos DAO. users deposit CKB into Nervos DAO, they can cast the same amount of dCKB at the same time. In this way, there are both the fixed income of Nervos DAO and the liquidity of dCKB, and dCKB can be traded freely. Of course, if you want to withdraw money from Nervos DAO, you need to destroy the corresponding dCKB.
These functions are implemented based on smart contracts. default Nervos DAO, when depositing, the owner of the deposit slip is the user himself; and the owner of the dCKB deposit slip is the smart contract, and the smart contract will issue another deposit slip to the user.
At the same time, based on xUDT, a batch of dCKB (amount equal to the number of CKB on the deposit slip) is minted. If the user wants to withdraw the stored CKB from Nervos DAO, he needs to destroy the dCKB and the deposit slip.
Deposit process
Ordinary Nervos DAO transaction:
Input1: Cell: {
capacity: 10000
lock: User
type: null
data: null
}
Output1: Cell: {
capacity: 10000
lock: User
type: Nervos DAO
data: 0x0000000000000000
}
dCKB transactions:
Input: Cell: {
capacity: 10300
lock: User
type: null
data: null
}
Output1: Cell: {
capacity: 10000
lock: //特殊的lock
type: Nervos DAO
data: 0x0000000000000000
}
Output2: Cell: {
capacity: 150
lock: User
type: DAO Info
data: 10000
}
Output3: Cell: {
capacity: 150
lock: User
type: dCKB(xUDT)
data: 10000
}
It can be seen from the above transaction that when Nervos DAO deposits, 2 cells are added, and the lock of Nervos DAO is replaced with a special lock .
- DAO Info: User's deposit receipt information, used for casting/destroying dCKB, and processing the deposit and withdrawal process. Its owner is the user, so only the user can withdraw money.
- Special lock: When unlocking is required, there is a smart contract of DAO Info.
- dCKB: tokens minted by smart contracts, users can dispose of them at will, such as transfer, trading, etc.
The verification logic of the smart contract:
- DAO Info requires the lock of output1 to be a special lock
- DAO Info requires the type of output1 to be Nervos DAO
- DAO Info requires the number of dCKB to be minted to be stored in the data
- DAO Info requires that the increased amount of dCKB is equal to the locked amount of CKB
- DAO Info requires Nervos DAO to be in the deposit process
- dCKB is xUDT, and its args is DAO Info
Nervos DAO: Verify the corresponding deposit process
Withdrawal
The user can send a transaction at any time to withdraw the stored CKByte from the Nervos DAO (but here will involve a lock-up period to determine when the token can be withdrawn). The interest earned by a Nervos DAO Cell will only be issued during the withdrawal phase, which means that for a Nervos DAO withdrawal transaction, the sum of the Capacity of all Onput Cells may exceed the sum of the Capacity of all Input Cells.
is different from the deposit process, withdrawing from Nervos DAO requires two steps:
In the first stage, the first transaction is to convert the Nervos DAO deposit slip to the Nervos DAO withdrawal slip.
In the second stage, the second transaction is to withdraw tokens from the Nervos DAO withdrawal slip.
Withdrawal stage 1
The default Nervos DAO process:
Input1: Cell: {
capacity: 10000
lock: User
type: Nervos DAO
data: 0x0000000000000000
}
Output1: Cell: {
capacity: 10000
lock: User
type: Nervos DAO
data: 0x0012300000000000
}
dCKB's withdrawal process:
Input1: Cell: {
capacity: 10000
lock: //特殊的lock
type: Nervos DAO
data: 0x0000000000000000
}
Input2: Cell: {
capacity: 150
lock: User
type: DAO Info
data: 10000
}
Input3: Cell: {
capacity: 150
lock: User
type: dCKB(UDT)
data: 10000
}
Output1: Cell: {
capacity: 10000
lock: User
type: Nervos DAO
data: 0x0012300000000000
}
Output2: Cell: {
capacity: 300
lock: User
type: null
data: null
}
Through the above transaction comparison, it can be found that dCKB requires users to provide both the "DAO Info" certificate of deposit and dCKB.
By destroying the deposit receipt and dCKB, the Nervos DAO phase 1 withdrawal is realized, the corresponding cell is handed over to the user, and the subsequent formal withdrawal is the same as the default process.
The verification logic of the smart contract:
- Special lock: Determine the existence of DAO Info in the input
- DAO Info: Judge input1 as Nervos DAO
- DAO Info: Determine that the tx_hash of input1 and input2 are consistent
- DAO Info: Determine that the Nervos DAO process is in "Withdrawal Phase 1"
- DAO Info: Determine that the amount of dCKB burned is equal to the amount of CKB deposit
Nervos DAO: verify the corresponding withdrawal process
Withdrawal stage 2
The stage 2 transaction is to withdraw the deposited tokens and interest from the Nervos DAO. Note that, unlike the first-stage transaction, users can send the first-stage transaction at any time, but in the second-stage transaction, Nervos DAO requires that the deposit period is up before they can actually withdraw CKB. current cycle of 1611dec684763a is about 1 month. If you execute "Withdrawal Phase 1" within half a month, you need to wait another half a month before you can execute "Withdrawal Phase 2".
The process is completely in accordance with the logic of the Nervos DAO contract, and there is no modification on the dCKB side.
Regarding NexisDAO, welcome to Nervos Talk and join the following link to participate in the discussion:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。