-
Notifications
You must be signed in to change notification settings - Fork 9
Proposal parameters
A proposal contract holds proposal parameters. If the proposal is executable, then it also defines an execution code.
Parameters:
- proposal type (uint): This parameter must match to an ID of a proposal template. The proposal will be validated according to the chosen template.
- execution type (uint): Execution type when proposal gets resolved. Possible options: 0 = not executable, 1 = call, 2 = delegatecall.
- minVotes (ratio): Minimum voting turnout for the proposal to get resolved. The ratio has 18 decimals.
- minAgreement (ratio): Minimum acceptable ratio of agreement for an option. It's guaranteed not to win otherwise. The ratio has 18 decimals.
- options (bytes32[]): List of options to vote for. Each option has a short title (no longer than 32 bytes).
- votingStartTime (unix timestamp): Date when the voting starts. See proposal states for details.
- votingMinEndTime (unix timestamp): Date of the earliest possible voting end. See proposal states for details.
- votingMaxEndTime (unix timestamp): Date of the latest possible voting end. See proposal states for details.
There are some constraints imposed on the proposal contracts to prevent execution of a malicious code.
To define such proposal constraints, we introduced the proposal templates. Each proposal template defines the following constraints:
- execution type (uint): Execution type when proposal gets resolved. Possible options: 0 = not executable, 1 = call, 2 = delegatecall.
- minVotes (ratio): Minimum allowed
Minimum voting turnout
. The ratio has 18 decimals. - minAgreement (ratio): Minimum allowed
Minimum voting agreement
. The ratio has 18 decimals. - opinionScales (uint[]): Each opinion scale defines an exact measure of agreement which voter may choose.
- minVotingDuration (seconds): Minimum duration of the voting.
- maxVotingDuration (seconds): Maximum duration of the voting.
- minStartDelay (seconds): Minimum delay of the voting (i.e. must start with a delay).
- maxStartDelay (seconds): Maximum delay of the voting (i.e. must start sooner).
- verifier (address): If defined, then ProposalTemplates calls this contract to verify the proposal. It may be used to extend proposal verification.
Some examples of proposals and their templates. The examples are mere example, they do not match to any templates in an actual network.
These proposals aren't executable and are unlikely to break anything. Thus, the requirements shouldn't be very strict:
Minimum start delay is 1 hour, maximum start delay is 30 days, minimum voting duration is 7 days, maximum voting duration is 180 days, minimum turnout is 55%, minimum agreement is 55%.
Examples of proposals for the template:
- Plaintext proposal. The proposal has a list of options for off-chain decisions.
Proposals of this kind may execute arbitrary code. Since they cannot execute code from governance's address, the requirements should be moderately strict:
Minimum start delay is 1 hour, maximum start delay is 30 days, minimum voting duration is 7 days, maximum voting duration is 180 days, minimum turnout is 60%, minimum agreement is 60%.
Examples of proposals for the template:
- Deposit proposal. Gathers funds and allows to transfer them to a specific address during proposal execution.
Proposals of this kind may execute arbitrary code on behalf of the governance contract. The requirements must be as strict as possible:
Minimum start delay is 1 hour, maximum start delay is 30 days, minimum voting duration is 14 days, maximum voting duration is 180 days, minimum turnout is 90%, minimum agreement is 90%.
Examples of proposals for the template:
- Software Upgrade proposal. Upgrade a contract via Upgradeability Proxy. Governance contract should be an admin of the upgradeable contract.
- Network parameters proposal. Changes one of the network parameters (such as
reward rate
). Governance contract should be authorized to perform the changes.
Template uses an additional verifier to check that proposal bytecode matches to a reference (see BytecodeMatcher
contract).
Since all the proposals of this template have a verified bytecode, the requirements are less strict compared to the template General delegatecall-executable
.
Minimum start delay is 1 hour, maximum start delay is 30 days, minimum voting duration is 7 days, maximum voting duration is 180 days, minimum turnout is 90%, minimum agreement is 55%.
Examples of proposals for the template:
- Slashing penalty proposal. Changes a slashing penalty of one of the validators. Governance contract should be authorized to perform the changes.
Only contract owner has a right to add or erase proposal templates. However, ownership of the contract may be transferred to the Governance contract.
Creation of the new templates may be done by an executable proposal. This way, the system may be self-governed.