In the topic Break the liquidity limitation of NervosDAO, I describe a solution to utilize the NervosDAO CKB. The basic idea is to create a derivation token DCKB from NervosDAO and keep tracking the NervosDAO interest in the real-time, so the DCKB user can stake DCKB to Layer2 or Defi projects and still get the NervosDAO reward.
But the solution is not practical due to the difficulty of tracking the NervosDAO interest. To keep tracking the interest, we need to recalculate the number of derived tokens each time we trade them, and it is more complex to calculate destroyed DCKB and get the corresponded amount of CKB back. It is also impractical for DCKB to get support from crypto wallets.
Now I propose a restricted but simpler solution that gains some advantages and lost some abilities compared to the old one.
In the new solution, instead of using extended sUDT format, we using standard sUDT, so any protocol or tool support sUDT will be easily utilizing our new dCKB token. Compare with the old protocol, we give up the ability to interchange the token derived from different NervodDAO cells.
- sUDT - simple user-defined token RFC: Simple UDT Draft Spec.
- Meta cell - a cell that holds some derivation metadata.
- dCKB - the new token we proposed, derived from NervosDAO, dCKB itself is an sUDT.
- Custodian cell - a cell that holds CKB withdrawaled from NervosDAO.
We describe CKB txs as
inputs + [deps] => outputs.
Deposit to NervosDAO:
cells => DAO + Meta cell
In the initial, we deposit CKB into NervosDAO and create a meta cell in the same transaction. The Meta cell’s data is a uint64 number I represent how many dCKB we issued. The initiation value of I is 0.
Meta cell + [DAO] => Meta cell + dCKB
To mint dCKB we use Meta cell as input and generate dCKB as an sUDT cell, the admin lock of sUDT is Meta cell’s lock.
The type script of Meta cell ensures that the amount of token we issued must be less than the amount of CKB in the NervosDAO cell. For example, a NervosDAO cell contains X CKB plus Y interest, and we already issued I dCKB(I is Meta cell’s data, which is 0 if we never issued dCKB), then we can issue N dCKB which satisfied
N + I <= X + Y, the Meta cell’s data is updated to
I' = N + I.
Mint dCKB can be performed multi times, and we can mint new dCKB if we gain enough CKB from the NervosDAO interest.
Notice a dCKB is just an sUDT, so if a wallet already supports sUDT, the wallet also supports dCKB. But since the owner lock of dCKB is Meta cell’s lock, which is unique each time we create a NervosDAO cell, Alice deposited dCKB’A can’t mix with Bob deposited dCKB’B. This is the ability that we give up to simplify the protocol. Thus, the only usage of dCKB is to staking into layer2 or Defi projects.
Since our dCKB is just sUDT, we follow the same rule of sUDT to transfer token, except we can’t mix up dCKB tokens from different NervosDAO cells we mentioned above.
A Defi or layer2 project can treat dCKB as it has the same value as CKB to incentivize people staking with NervosDAO assets, and dCKB users can freely relocate staking to different projects to pursue more rewards.
Withdraw NervosDAO cell:
dCKB + DAO + Meta cell => dCKB + Custodian cell + CKB
This operation converts the NervosDAO cell into Custodian cell, and sends the Meta cell back to the depositor. Custodian cell is a temporal cell that contains the CKB from the NervosDAO cell.
Custodian cell + dCKB => Custodian cell + CKB
The holder of dCKB can burn dCKB and get CKB from corresponded Custodian cell.
Destroy custodian cell:
Custodian cell => cell
After burnt all the dCKB tokens, the Custodian cell is converted into normal cells and sent to the original NervosDAO depositor.
By leverage the sUDT protocol, we provide a method to easily integrate dCKB into Layer2/Defi projects & tools that already support the sUDT. We also simplify the protocol by removing the interchangeability of the old DCKB and focus on the stake feature.
- compatible with sUDT
- Users can reallocate staking between different projects.
- Users can continually derive dCKB tokens from the interest of NervosDAO.
- Easy to integrate, a Defi or layer2 project should have minimal effort to support dCKB.
- We lose the ability to interchange tokens derived from different NervosDAO cells.