ProposalUpgradeable
Abstract contract · src/common/plugin/extensions/proposal/ProposalUpgradeable.sol
Explained in: Proposals
Author: Aragon X - 2022-2024
Inherits: IProposal, ERC165Upgradeable
An abstract contract containing the traits and internal functionality to create and execute proposals that can be inherited by upgradeable DAO plugins.
security-contact: sirt@aragon.org
Functions
canExecute
function canExecute(uint256 _proposalId) external view returns (bool)Selector: 0xcc63604a
Checks if a proposal can be executed.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal to be checked. |
createProposal
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)Selector: 0xea65ab82
Creates a new proposal.
| Parameter | Type | Description |
|---|---|---|
_metadata | bytes | The metadata of the proposal. |
_actions | Action[] | The actions that will be executed after the proposal passes. |
_startDate | uint64 | The start date of the proposal. |
_endDate | uint64 | The end date of the proposal. |
_data | bytes | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
|---|---|---|
proposalId | uint256 | The id of the proposal. |
customProposalParamsABI
function customProposalParamsABI() external view returns (string)Selector: 0x3d3f4b1b
The human-readable abi format for extra params included in data of createProposal.
Dev: Used for UI to easily detect what extra params the contract expects.
execute
function execute(uint256 _proposalId) externalSelector: 0xfe0d94c1
Executes a proposal.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal to be executed. |
hasSucceeded
function hasSucceeded(uint256 _proposalId) external view returns (bool)Selector: 0xc218c132
Whether proposal succeeded or not.
Dev: Note that this must not include time window checks and only make a decision based on the thresholds.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The id of the proposal. |
proposalCount
function proposalCount() external view returns (uint256)Selector: 0xda35c664
Returns the proposal count which determines the next proposal ID.
Dev: This function is deprecated but remains in the interface for backward compatibility. It now reverts to prevent ambiguity.
| Returns | Type | Description |
|---|---|---|
[0] | uint256 | The proposal count. |
supportsInterface
function supportsInterface(bytes4 _interfaceId) external view returns (bool)Selector: 0x01ffc9a7
Checks if this or the parent contract supports an interface by its ID.
Dev: In addition to the current interfaceId, also support previous version of the interfaceId that did not include the following functions:
createProposal,hasSucceeded,execute,canExecute,customProposalParamsABI.
| Parameter | Type | Description |
|---|---|---|
_interfaceId | bytes4 | The ID of the interface. |
Events
Initialized
event Initialized(uint8 version)Dev: Triggered when the contract has been initialized or reinitialized.
ProposalCreated
event ProposalCreated(
uint256 indexed proposalId,
address indexed creator,
uint64 startDate,
uint64 endDate,
bytes metadata,
Action[] actions,
uint256 allowFailureMap
)Emitted when a proposal is created.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
creator | address | The creator of the proposal. |
startDate | uint64 | The start date of the proposal in seconds. |
endDate | uint64 | The end date of the proposal in seconds. |
metadata | bytes | The metadata of the proposal. |
actions | Action[] | The actions that will be executed if the proposal passes. |
allowFailureMap | uint256 | A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index i is 1, the proposal succeeds even if the ith action reverts. A failure map value of 0 requires every action to not revert. |
ProposalExecuted
event ProposalExecuted(uint256 indexed proposalId)Emitted when a proposal is executed.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
Errors
FunctionDeprecated
error FunctionDeprecated()