The entire system is composed of multiple contracts, and contracts are connected through configuration groups.
The configuration group includes serial number contracts and configuration item contracts. The configuration group is equivalent to realizing a readable and writable storage space on Nervos.
All the data uses little-endian mode.
Serial Number Contract
It is similar to the self-incrementing ID of the database. Each time a new configuration item is created, the ID is automatically incremented by 1. And it is unique.
Its existence in Nervos is a special cell. Its data represents the current ID value.
The function of the contract is that when an update is required, the ID indicated by the data value must be +1 The corresponding code is: https://github.com/NexisDao/NexisDao-core/tree/main/contracts/index
Configuration Item Contract
A configuration item corresponds to a cell, the first 4 bytes of cell data represent the serial number, and the others are configuration values.
When the cell of the serial number contract is updated, a configuration item corresponding to the ID is created.
The configuration item can modify the configuration, but its serial number cannot be changed.
In order to retain the update capability, under normal circumstances, there will be 2 cells for configuration items with the same serial number. This can prevent other related transactions from failing during the update.
For example, there will be two cells for asset price information. If there is only one cell, when the price is updated, the pledge transaction will fail because it has not yet been chained.
Existing Configuration Items
- 1.IncentiveParam Incentive parameters: Staking incentive: f32+ Repayment incentive: f32.
- 2.BurnLock Destruction lock: When some assets are to be destroyed and cannot be directly destroyed, this lock will be used to lock the asset.
- 3.CDPLock CDP contract lock: when used for staking, lock user's assets and the corresponding stake sheet.
- 4.The address of the CDPType staking contract.
- 5.The address of the TAIType stablecoin contract.
- 6.ManagerTokenType: The address of the management currency contract, not currently available.
- 7.CommunityLock: Community Lock, used to store fees paid by users.
- 8.Contracts for temporary liabilities caused by DebtType liquidation.
- 9.AuctionType auction contract.
- 10.DebtSysType system debt contract.
- 11.ProposalType: Proposal contract, not currently available.
- 13.NervosDAOLock is used to lock Nervos DAO.
- 14.NervosDAOType: NervosDAO contract address.
- 15.DAOInfoType locks NervosDAO and casts dCKB contract.
- 16.dCKBType: dCKB token contract address.
- 17.DebtLock: temporary debt lock
- 20.dCKB staking information: dCKB contract address: byte32 + annualized interest: f32 + pledge rate: f32
- 21.dCKB price information: price: f32 + time: u64