Registry DAO is a decentralized key-value storage of arbitrary data.
It's parameterized by two types: k (for key) and v (for value).
In the bundled in RegistryDAO, these k and v parameters are set as strings.
Extra storage data:
big_map k vis the actual key-value storage.big_map k proposalIdfor eachkstores IDs of the proposal that affectedklast time.set addressis the set of successful-proposal receiver contract addresses.
We store these two big_maps separately because we want to include proposalId for deleted keys as well.
Alternatively, we can merge them and store option v values.
It should be treated as an implementation detail.
There is additional data to implement configuration callbacks, it's an implementation detail as well.
Proposals can be of different type and include (proposal_metadata) different data:
- Proposals to update the parameters specified below taking
- 5
option natvalues:max_proposal_sizefrozen_scale_valuefrozen_extra_valueslash_scale_valueslash_division_value
- 2
option tezvaluesmin_xtz_amountmax_xtz_amount
- 5
- Proposal to update the set of successful-proposal receiver contract addresses. This proposal takes a parameter that has two constructors. The proposal can add to, or remove from the set of addresses.
- Transfer proposals, that can transfer XTZ or tokens (FA2 as well as FA1.2) as well as update the
registry. This includes:
- a list of
updateitems parameterized bykandvtypes. Eachupdateitem contains a key of the typekand a new value of the typeoption v. - a list of transfer instructions. Each item in this list can be either of an Xtz transfer, an FA2 token transfer or an FA1.2 token transfer. These alternatives are represented by the type,
(or (pair %xtz_transfer_type (mutez %amount) (address %recipient)) (or (pair %token_transfer_type (address %contract_address) (list %transfer_list (pair (address %from_) (list %txs (pair (address %to_) (nat %token_id) (nat %amount)))))) (pair %legacy_token_transfer_type (address %contract_address) (pair %transfer (address %from) (pair %target (address %to) (nat %value)))))) nat %agoraPostIDis used to refer to an Agora post explaining the proposed transfer and/or changes and motivation for them.
- a list of
- Proposal to update the guardian address in the BaseDAO contract:
- This proposal takes an address parameter and use it to update the guardian address in the storage.
- Proposal to update the contract delegate:
- This proposal takes a
keyhashoptionparameter and usees it to update the delegate address of the contract. Please note that this different from theUpdate_delegateentrypoint which updates the delegates of an account.
- This proposal takes a
The proposer must lock frozen_scale_value * s + frozen_extra_value tokens where s = size(proposal_metadata).
I. e. s is total size of the diff and post ID.
It should naturally prohibit spam proposals and too big proposals (unless frozen_scale_value is 0).
Additionally, we require s < max_proposal_size as a safety measure because too large proposals can be too costly to deal with in terms of gas.
For transfer proposals, it's required that min_xtz_amount <= amount <= max_xtz_amount.
max_proposal_size, frozen_scale_value, frozen_extra_value, min_xtz_amount and max_xtz_amount
are parameters of the contract specified by the DAO creator.
Note that by setting frozen_scale_value to 0 it's possible to require a constant number of tokens to be locked.
When a proposal is rejected, the amount of tokens to slash is computed as
slash_scale_value * frozen / slash_division_value.
slash_scale_value and slash_division_value are specified by the DAO creator.
One can set them to 1 and 1 by default to always slash all staked tokens.
Except for the Guardian updates, It simply applies all updates from the accepted proposal one by one. They are applied in the same order as specified in the proposal, the head of the list is applied first.
For the Update guardian proposal, it updates the guardian address in the storage.
Here is a summary of all the strings used as error messages thrown by proposal_check.
| Error | Description |
|---|---|
ZERO_MUTEZ |
Xtz transfer amount cannot be 0 |
LOW_XTZ |
Xtz transfer amount cannot be smaller than 'min_xtz_amount' |
HIGH_XTZ |
Xtz transfer amount cannot be bigger than 'max_xtz_amount' |
WRONG_TOKEN_AMOUNT |
Incorrect token amounts locked |
LARGE_PROPOSAL |
Proposal size is bigger than 'max_proposal_size' |
A custom entrypoint lookup_registry is included in the registryDAO contract
to lookup values in the registry. The parameter of this entrypoint is (pair k address)
where address is the address of a callback contract of type (k, v option).