Skip to content

MajorityVotingBase ​

Abstract contract · src/base/MajorityVotingBase.sol

Explained in: Create, vote, and execute a proposal, Majority voting, Voting modes

Author: Aragon X - 2022-2025

Inherits: IMajorityVoting, Initializable, ERC165Upgradeable, MetadataExtensionUpgradeable, PluginUUPSUpgradeable, ProposalUpgradeable

The abstract implementation of majority voting plugins.

Parameterization ​

We define two parameters $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes} + N_\text{no}} \in [0,1]$$ and $$\texttt{participation} = \frac{N_\text{yes} + N_\text{no} + N_\text{abstain}}{N_\text{total}} \in [0,1],$$ where $N_\text{yes}$, $N_\text{no}$, and $N_\text{abstain}$ are the yes, no, and abstain votes that have been cast and $N_\text{total}$ is the total voting power available at proposal creation time.

Limit Values: Support Threshold & Minimum Participation ​

Two limit values are associated with these parameters and decide if a proposal execution should be possible: $\texttt{supportThreshold} \in [0,1)$ and $\texttt{minParticipation} \in [0,1]$.

For threshold values, $>$ comparison is used. This does not include the threshold value. E.g., for $\texttt{supportThreshold} = 50%$, the criterion is fulfilled if there is at least one more yes than no votes ($N_\text{yes} = N_\text{no} + 1$). For minimum values, $\ge{}$ comparison is used. This does include the minimum participation value. E.g., for $\texttt{minParticipation} = 40%$ and $N_\text{total} = 10$, the criterion is fulfilled if 4 out of 10 votes were casted.

Majority voting implies that the support threshold is set with $$\texttt{supportThreshold} \ge 50% .$$ However, this is not enforced by the contract code and developers can make unsafe parameters and only the frontend will warn about bad parameter settings.

Execution Criteria ​

After the vote is closed, two criteria decide if the proposal passes.

The Support Criterion ​

For a proposal to pass, the required ratio of yes and no votes must be met: $$(1- \texttt{supportThreshold}) \cdot N_\text{yes} > \texttt{supportThreshold} \cdot N_\text{no}.$$ Note, that the inequality yields the simple majority voting condition for $\texttt{supportThreshold}=\frac{1}{2}$.

The Participation Criterion ​

For a proposal to pass, the minimum voting power must have been cast: $$N_\text{yes} + N_\text{no} + N_\text{abstain} \ge \texttt{minVotingPower},$$ where $\texttt{minVotingPower} = \texttt{minParticipation} \cdot N_\text{total}$.

Vote Replacement ​

The contract allows votes to be replaced. Voters can vote multiple times and only the latest voteOption is tallied.

Early Execution ​

This contract allows a proposal to be executed early, iff the vote outcome cannot change anymore by more people voting. Accordingly, vote replacement and early execution are mutually exclusive options. The outcome cannot change anymore iff the support threshold is met even if all remaining votes are no votes. We call this number the worst-case number of no votes and define it as

$$N_\text{no, worst-case} = N_\text{no} + \texttt{remainingVotes}$$

where

$$\texttt{remainingVotes} = N_\text{total}-\underbrace{(N_\text{yes}+N_\text{no}+N_\text{abstain})}_{\text{turnout}}.$$

We can use this quantity to calculate the worst-case support that would be obtained if all remaining votes are casted with no:

$$ \begin{align*} \texttt{worstCaseSupport} &= \frac{N_\text{yes}}{N_\text{yes} + (N_\text{no, worst-case})} \[3mm] &= \frac{N_\text{yes}}{N_\text{yes} + (N_\text{no} + \texttt{remainingVotes})} \[3mm] &= \frac{N_\text{yes}}{N_\text{yes} + N_\text{no} + N_\text

  • (N_\text{yes} + N_\text{no} + N_\text{abstain})} \[3mm] &= \frac{N_\text{yes}}{N_\text{total} - N_\text{abstain}} \end{align*} $$

In analogy, we can modify the support criterion from above to allow for early execution:

$$ \begin{align*} (1 - \texttt{supportThreshold}) \cdot N_\text{yes} &> \texttt{supportThreshold} \cdot N_\text{no, worst-case} \[3mm] &> \texttt{supportThreshold} \cdot (N_\text{no} + \texttt{remainingVotes}) \[3mm] &> \texttt{supportThreshold} \cdot (N_\text

  • N_\text{total}-(N_\text{yes}+N_\text{no}+N_\text{abstain})) \[3mm] &> \texttt{supportThreshold} \cdot (N_\text{total} - N_\text{yes} - N_\text{abstain}) \end{align*} $$

Accordingly, early execution is possible when the vote is open, the modified support criterion, and the particicpation criterion are met.

Dev: This contract implements the IMajorityVoting interface.

security-contact: sirt@aragon.org

Functions ​

canExecute ​

solidity
function canExecute(uint256 _proposalId) external view returns (bool)

Selector: 0xcc63604a

Checks if a proposal can be executed.

Dev: Reverts if the proposal with the given _proposalId does not exist.

ParameterTypeDescription
_proposalIduint256The ID of the proposal to be checked.
ReturnsTypeDescription
[0]boolTrue if the proposal can be executed, false otherwise.

canVote ​

solidity
function canVote(
    uint256 _proposalId,
    address _account,
    IMajorityVoting.VoteOption _voteOption
) external view returns (bool)

Selector: 0x17d1b404

Checks if an account can participate on a proposal. This can be because the vote - has not started, - has ended, - was executed, or - the voter doesn't have voting powers.

Dev: Reverts if the proposal with the given _proposalId does not exist.

ParameterTypeDescription
_proposalIduint256The proposal Id.
_accountaddressThe account address to be checked.
_voteOptionIMajorityVoting.VoteOptionWhether the voter abstains, supports or opposes the proposal.
ReturnsTypeDescription
[0]boolReturns true if the account is allowed to vote.

createProposal(bytes,(address,uint256,bytes)[],uint256,uint64,uint64,uint8,bool) ​

solidity
function createProposal(
    bytes _metadata,
    Action[] _actions,
    uint256 _allowFailureMap,
    uint64 _startDate,
    uint64 _endDate,
    IMajorityVoting.VoteOption _voteOption,
    bool _tryEarlyExecution
) external returns (uint256 proposalId)

Selector: 0x9cba3021

Creates a new majority voting proposal.

ParameterTypeDescription
_metadatabytesThe metadata of the proposal.
_actionsAction[]The actions that will be executed after the proposal passes.
_allowFailureMapuint256Allows proposal to succeed even if an action reverts. Uses bitmap representation. If the bit at index x is 1, the tx succeeds even if the action at x failed. Passing 0 will be treated as atomic execution.
_startDateuint64The start date of the proposal vote. If 0, the current timestamp is used and the vote starts immediately.
_endDateuint64The end date of the proposal vote. If 0, _startDate + minDuration is used.
_voteOptionIMajorityVoting.VoteOptionThe chosen vote option to be casted on proposal creation.
_tryEarlyExecutionboolIf true, early execution is tried after the vote cast. The call does not revert if early execution is not possible.
ReturnsTypeDescription
proposalIduint256The ID of the proposal.

createProposal(bytes,(address,uint256,bytes)[],uint64,uint64,bytes) ​

solidity
function createProposal(
    bytes _metadata,
    Action[] _actions,
    uint64 _startDate,
    uint64 _endDate,
    bytes _data
) external returns (uint256 proposalId)

Selector: 0xea65ab82

Creates a new proposal.

ParameterTypeDescription
_metadatabytesThe metadata of the proposal.
_actionsAction[]The actions that will be executed after the proposal passes.
_startDateuint64The start date of the proposal.
_endDateuint64The end date of the proposal.
_databytesThe additional abi-encoded data to include more necessary fields.
ReturnsTypeDescription
proposalIduint256The id of the proposal.

customProposalParamsABI ​

solidity
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.

dao ​

solidity
function dao() external view returns (IDAO)

Selector: 0x4162169f

Returns the DAO contract.

execute ​

solidity
function execute(uint256 _proposalId) external

Selector: 0xfe0d94c1

Executes a proposal.

Dev: Requires the EXECUTE_PROPOSAL_PERMISSION_ID permission.

ParameterTypeDescription
_proposalIduint256The ID of the proposal to be executed.

getCurrentTargetConfig ​

solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)

Selector: 0xc98425ee

Returns the currently set target contract.

ReturnsTypeDescription
[0]IPlugin.TargetConfig

getMetadata ​

solidity
function getMetadata() external view returns (bytes)

Selector: 0x7a5b4f59

Returns the metadata currently applied.

getProposal ​

solidity
function getProposal(
    uint256 _proposalId
) external view returns (bool open, bool executed, MajorityVotingBase.ProposalParameters parameters, MajorityVotingBase.Tally tally, Action[] actions, uint256 allowFailureMap, IPlugin.TargetConfig targetConfig)

Selector: 0xc7f758a8

Returns all information for a proposal by its ID.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
openboolWhether the proposal is open or not.
executedboolWhether the proposal is executed or not.
parametersMajorityVotingBase.ProposalParametersThe parameters of the proposal.
tallyMajorityVotingBase.TallyThe current tally of the proposal.
actionsAction[]The actions to be executed to the target contract address.
allowFailureMapuint256The bit map representations of which actions are allowed to revert so tx still succeeds.
targetConfigIPlugin.TargetConfigExecution configuration, applied to the proposal when it was created. Added in build 3.

getTargetConfig ​

solidity
function getTargetConfig() external view returns (IPlugin.TargetConfig)

Selector: 0xdd63c06f

A convenient function to get current target config only if its target is not address(0), otherwise dao().

ReturnsTypeDescription
[0]IPlugin.TargetConfig

getVoteOption ​

solidity
function getVoteOption(
    uint256 _proposalId,
    address _voter
) external view returns (IMajorityVoting.VoteOption)

Selector: 0x970601d8

Returns whether the account has voted for the proposal.

Dev: May return none if the _proposalId does not exist, or the _account does not have voting power.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
_voteraddress
ReturnsTypeDescription
[0]IMajorityVoting.VoteOptionThe vote option cast by a voter for a certain proposal.

hasSucceeded ​

solidity
function hasSucceeded(uint256 _proposalId) external view returns (bool)

Selector: 0xc218c132

Whether proposal succeeded or not.

Dev: Reverts if the proposal with the given _proposalId does not exist.

ParameterTypeDescription
_proposalIduint256The id of the proposal.
ReturnsTypeDescription
[0]boolReturns if proposal has been succeeded or not without including time window checks.

implementation ​

solidity
function implementation() external view returns (address)

Selector: 0x5c60da1b

Returns the address of the implementation contract in the proxy storage slot slot the UUPS proxy is pointing to.

isMinApprovalReached ​

solidity
function isMinApprovalReached(uint256 _proposalId) external view returns (bool)

Selector: 0x36fa9589

Checks if the min approval value defined as: $$\texttt{minApproval} = \frac{N_\text{yes}}{N_\text{total}}$$ for a proposal is greater or equal than the minimum approval value.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolReturns true if the approvals is greater or equal than the minimum approval and false otherwise.

isMinParticipationReached ​

solidity
function isMinParticipationReached(uint256 _proposalId) external view returns (bool)

Selector: 0x8a4b00f8

Checks if the participation value defined as: $$\texttt{participation} = \frac{N_\text{yes}+N_\text{no}+N_\text{abstain}}{N_\text{total}}$$ for a proposal is greater or equal than the minimum participation value.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolReturns true if the participation is greater or equal than the minimum participation, and false otherwise.

isSupportThresholdReached ​

solidity
function isSupportThresholdReached(uint256 _proposalId) external view returns (bool)

Selector: 0xcf131149

Checks if the support value defined as: $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes}+N_\text{no}}$$ for a proposal is greater than the support threshold.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolReturns true if the support is greater than the support threshold and false otherwise.

isSupportThresholdReachedEarly ​

solidity
function isSupportThresholdReachedEarly(uint256 _proposalId) external view returns (bool)

Selector: 0x0de21856

Checks if the worst-case support value defined as: $$\texttt{worstCaseSupport} = \frac{N_\text{yes}}{ N_\text{total}-N_\text{abstain}}$$ for a proposal is greater than the support threshold.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolReturns true if the worst-case support is greater than the support threshold and false otherwise.

minApproval ​

solidity
function minApproval() external view returns (uint256)

Selector: 0x03ff90f6

Returns the configured minimum approval value.

ReturnsTypeDescription
[0]uint256The minimal approval value.

minDuration ​

solidity
function minDuration() external view returns (uint64)

Selector: 0x56715761

Returns the minimum duration parameter stored in the voting settings.

minParticipation ​

solidity
function minParticipation() external view returns (uint32)

Selector: 0x054fd2c2

Returns the minimum participation parameter stored in the voting settings.

ReturnsTypeDescription
[0]uint32The minimum participation parameter.

minProposerVotingPower ​

solidity
function minProposerVotingPower() external view returns (uint256)

Selector: 0xf60046b2

Returns the minimum voting power required to create a proposal stored in the voting settings.

pluginType ​

solidity
function pluginType() external pure returns (IPlugin.PluginType)

Selector: 0x41de6830

Returns the plugin's type

ReturnsTypeDescription
[0]IPlugin.PluginType

proposalCount ​

solidity
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.

ReturnsTypeDescription
[0]uint256The proposal count.

protocolVersion ​

solidity
function protocolVersion() external pure returns (uint8[3])

Selector: 0x2ae9c600

Returns the semantic Aragon OSx protocol version number that the implementing contract is associated with.

Dev: This version number is not to be confused with the release and build numbers found in the Version.Tag struct inside the PluginRepo contract being used to version plugin setup and associated plugin implementation contracts.

ReturnsTypeDescription
[0]uint8[3]Returns the semantic Aragon OSx protocol version number.

proxiableUUID ​

solidity
function proxiableUUID() external view returns (bytes32)

Selector: 0x52d1902d

Dev: Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade.

IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the notDelegated modifier.

setMetadata ​

solidity
function setMetadata(bytes _metadata) external

Selector: 0xee57e36f

Allows to update only the metadata.

ParameterTypeDescription
_metadatabytesThe utf8 bytes of a content addressing cid that stores plugin's information.

setTargetConfig ​

solidity
function setTargetConfig(IPlugin.TargetConfig _targetConfig) external

Selector: 0xbb225da2

Dev: Sets the target to a new target (newTarget). The caller must have the SET_TARGET_CONFIG_PERMISSION_ID permission.

ParameterTypeDescription
_targetConfigIPlugin.TargetConfigThe target Config containing the address and operation type.

supportsInterface ​

solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)

Selector: 0x01ffc9a7

Checks if this or the parent contract supports an interface by its ID.

ParameterTypeDescription
_interfaceIdbytes4The ID of the interface.

supportThreshold ​

solidity
function supportThreshold() external view returns (uint32)

Selector: 0x7c36e8e8

Returns the support threshold parameter stored in the voting settings.

ReturnsTypeDescription
[0]uint32The support threshold parameter.

totalVotingPower ​

solidity
function totalVotingPower(uint256 _blockNumber) external view returns (uint256)

Selector: 0x536f9f42

Returns the total voting power checkpointed for a specific block number.

ParameterTypeDescription
_blockNumberuint256The block number.

updateMinApprovals ​

solidity
function updateMinApprovals(uint256 _minApprovals) external

Selector: 0xaac91e46

Updates the minimal approval value.

Dev: Requires the UPDATE_VOTING_SETTINGS_PERMISSION_ID permission.

ParameterTypeDescription
_minApprovalsuint256The new minimal approval value.

updateVotingSettings ​

solidity
function updateVotingSettings(MajorityVotingBase.VotingSettings _votingSettings) external

Selector: 0x0dfb278e

Updates the voting settings.

Dev: Requires the UPDATE_VOTING_SETTINGS_PERMISSION_ID permission.

ParameterTypeDescription
_votingSettingsMajorityVotingBase.VotingSettingsThe new voting settings.

upgradeTo ​

solidity
function upgradeTo(address newImplementation) external

Selector: 0x3659cfe6

Dev: Upgrade the implementation of the proxy to newImplementation.

Calls {_authorizeUpgrade}.

Emits an {Upgraded} event.

oz-upgrades-unsafe-allow-reachable: delegatecall

upgradeToAndCall ​

solidity
function upgradeToAndCall(address newImplementation, bytes data) external payable

Selector: 0x4f1ef286

Dev: Upgrade the implementation of the proxy to newImplementation, and subsequently execute the function call encoded in data.

Calls {_authorizeUpgrade}.

Emits an {Upgraded} event.

oz-upgrades-unsafe-allow-reachable: delegatecall

vote ​

solidity
function vote(
    uint256 _proposalId,
    IMajorityVoting.VoteOption _voteOption,
    bool _tryEarlyExecution
) external

Selector: 0xce6366c4

Votes on a proposal and, optionally, executes the proposal.

Dev: _voteOption, 1 -> abstain, 2 -> yes, 3 -> no

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
_voteOptionIMajorityVoting.VoteOptionThe chosen vote option.
_tryEarlyExecutionboolIf true, early execution is tried after the vote cast. The call does not revert if early execution is not possible.

votingMode ​

solidity
function votingMode() external view returns (MajorityVotingBase.VotingMode)

Selector: 0x23d07188

Returns the vote mode stored in the voting settings.

ReturnsTypeDescription
[0]MajorityVotingBase.VotingMode

Events ​

AdminChanged ​

solidity
event AdminChanged(address previousAdmin, address newAdmin)

Dev: Emitted when the admin account has changed.

BeaconUpgraded ​

solidity
event BeaconUpgraded(address indexed beacon)

Dev: Emitted when the beacon is changed.

Initialized ​

solidity
event Initialized(uint8 version)

Dev: Triggered when the contract has been initialized or reinitialized.

MetadataSet ​

solidity
event MetadataSet(bytes metadata)

Emitted when metadata is updated.

ProposalCreated ​

solidity
event ProposalCreated(
    uint256 indexed proposalId,
    address indexed creator,
    uint64 startDate,
    uint64 endDate,
    bytes metadata,
    Action[] actions,
    uint256 allowFailureMap
)

Emitted when a proposal is created.

ParameterTypeDescription
proposalIduint256The ID of the proposal.
creatoraddressThe creator of the proposal.
startDateuint64The start date of the proposal in seconds.
endDateuint64The end date of the proposal in seconds.
metadatabytesThe metadata of the proposal.
actionsAction[]The actions that will be executed if the proposal passes.
allowFailureMapuint256A 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 ​

solidity
event ProposalExecuted(uint256 indexed proposalId)

Emitted when a proposal is executed.

ParameterTypeDescription
proposalIduint256The ID of the proposal.

TargetSet ​

solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)

Emitted each time the TargetConfig is set.

ParameterTypeDescription
newTargetConfigIPlugin.TargetConfig

Upgraded ​

solidity
event Upgraded(address indexed implementation)

Dev: Emitted when the implementation is upgraded.

VoteCast ​

solidity
event VoteCast(
    uint256 indexed proposalId,
    address indexed voter,
    IMajorityVoting.VoteOption voteOption,
    uint256 votingPower
)

Emitted when a vote is cast by a voter.

ParameterTypeDescription
proposalIduint256The ID of the proposal.
voteraddressThe voter casting the vote.
voteOptionIMajorityVoting.VoteOptionThe casted vote option.
votingPoweruint256The voting power behind this vote.

VotingMinApprovalUpdated ​

solidity
event VotingMinApprovalUpdated(uint256 minApprovals)

Emitted when the min approval value is updated.

ParameterTypeDescription
minApprovalsuint256The minimum amount of yes votes needed for a proposal succeed.

VotingSettingsUpdated ​

solidity
event VotingSettingsUpdated(
    MajorityVotingBase.VotingMode votingMode,
    uint32 supportThreshold,
    uint32 minParticipation,
    uint64 minDuration,
    uint256 minProposerVotingPower
)

Emitted when the voting settings are updated.

ParameterTypeDescription
votingModeMajorityVotingBase.VotingModeA parameter to select the vote mode.
supportThresholduint32The support threshold value.
minParticipationuint32The minimum participation value.
minDurationuint64The minimum duration of the proposal vote in seconds.
minProposerVotingPoweruint256The minimum voting power required to create a proposal.

Errors ​

AlreadyInitialized ​

solidity
error AlreadyInitialized()

Thrown when initialize is called after it has already been executed.

DaoUnauthorized ​

solidity
error DaoUnauthorized(address dao, address where, address who, bytes32 permissionId)

Thrown if a call is unauthorized in the associated DAO.

ParameterTypeDescription
daoaddressThe associated DAO.
whereaddressThe context in which the authorization reverted.
whoaddressThe address (EOA or contract) missing the permission.
permissionIdbytes32The permission identifier.

DateOutOfBounds ​

solidity
error DateOutOfBounds(uint64 limit, uint64 actual)

Thrown if a date is out of bounds.

ParameterTypeDescription
limituint64The limit value.
actualuint64The actual value.

DelegateCallFailed ​

solidity
error DelegateCallFailed()

Thrown when delegatecall fails.

FunctionDeprecated ​

solidity
error FunctionDeprecated()

InvalidTargetConfig ​

solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)

Thrown when target is of type 'IDAO', but operation is delegateCall.

ParameterTypeDescription
targetConfigIPlugin.TargetConfigThe target config to update it to.

MinDurationOutOfBounds ​

solidity
error MinDurationOutOfBounds(uint64 limit, uint64 actual)

Thrown if the minimal duration value is out of bounds (less than one hour or greater than 1 year).

ParameterTypeDescription
limituint64The limit value.
actualuint64The actual value.

NonexistentProposal ​

solidity
error NonexistentProposal(uint256 proposalId)

Thrown when a proposal doesn't exist.

ParameterTypeDescription
proposalIduint256The ID of the proposal which doesn't exist.

ProposalAlreadyExists ​

solidity
error ProposalAlreadyExists(uint256 proposalId)

Thrown if the proposal with same actions and metadata already exists.

ParameterTypeDescription
proposalIduint256The id of the proposal.

ProposalExecutionForbidden ​

solidity
error ProposalExecutionForbidden(uint256 proposalId)

Thrown if the proposal execution is forbidden.

ParameterTypeDescription
proposalIduint256The ID of the proposal.

RatioOutOfBounds ​

solidity
error RatioOutOfBounds(uint256 limit, uint256 actual)

Thrown if a ratio value exceeds the maximal value of 10**6.

ParameterTypeDescription
limituint256The maximal value.
actualuint256The actual value.

VoteCastForbidden ​

solidity
error VoteCastForbidden(
    uint256 proposalId,
    address account,
    IMajorityVoting.VoteOption voteOption
)

Thrown if an account is not allowed to cast a vote. This can be because the vote

  • has not started,
  • has ended,
  • was executed, or
  • the account doesn't have voting powers.
ParameterTypeDescription
proposalIduint256The ID of the proposal.
accountaddressThe address of the _account.
voteOptionIMajorityVoting.VoteOptionThe chosen vote option.

Constants ​

Public, so each is also readable through a generated getter.

CREATE_PROPOSAL_PERMISSION_ID ​

solidity
bytes32 public constant CREATE_PROPOSAL_PERMISSION_ID = keccak256("CREATE_PROPOSAL_PERMISSION");

Value: 0x8c433a4cd6b51969eca37f974940894297b9fcf4b282a213fea5cd8f85289c90

The ID of the permission required to call the createProposal functions.

EXECUTE_PROPOSAL_PERMISSION_ID ​

solidity
bytes32 public constant EXECUTE_PROPOSAL_PERMISSION_ID = keccak256("EXECUTE_PROPOSAL_PERMISSION");

Value: 0xf281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea887889

The ID of the permission required to call the execute function.

SET_METADATA_PERMISSION_ID ​

Inherited from MetadataExtensionUpgradeable.

solidity
bytes32 public constant SET_METADATA_PERMISSION_ID = keccak256("SET_METADATA_PERMISSION");

Value: 0x4707e94b25cfce1a7c363508fbb838c35864388ad77284b248282b9746982b9b

The ID of the permission required to call the setMetadata function.

SET_TARGET_CONFIG_PERMISSION_ID ​

Inherited from PluginUUPSUpgradeable.

solidity
bytes32 public constant SET_TARGET_CONFIG_PERMISSION_ID =
        keccak256("SET_TARGET_CONFIG_PERMISSION");

Value: 0x568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f7

The ID of the permission required to call the setTargetConfig function.

UPDATE_VOTING_SETTINGS_PERMISSION_ID ​

solidity
bytes32 public constant UPDATE_VOTING_SETTINGS_PERMISSION_ID = keccak256("UPDATE_VOTING_SETTINGS_PERMISSION");

Value: 0xbba35d41610b7d25c8e486006535c76bd423091563e694d206ae3d71ce949fe5

The ID of the permission required to call the updateVotingSettings function.

UPGRADE_PLUGIN_PERMISSION_ID ​

Inherited from PluginUUPSUpgradeable.

solidity
bytes32 public constant UPGRADE_PLUGIN_PERMISSION_ID = keccak256("UPGRADE_PLUGIN_PERMISSION");

Value: 0x821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f5

The ID of the permission required to call the _authorizeUpgrade function.

Enums ​

Operation ​

Inherited from IPlugin.

solidity
enum Operation {
    Call,
    DelegateCall
}

Specifies the type of operation to perform.

OptionValue
Call0
DelegateCall1

PluginType ​

Inherited from IPlugin.

solidity
enum PluginType {
    UUPS,
    Cloneable,
    Constructable
}

Types of plugin implementations available within OSx.

OptionValue
UUPS0
Cloneable1
Constructable2

VoteOption ​

Inherited from IMajorityVoting.

solidity
enum VoteOption {
    None,
    Abstain,
    Yes,
    No
}

Vote options that a voter can chose from.

OptionValueDescription
None0The default option state of a voter indicating the absence from the vote. This option neither influences support nor participation.
Abstain1This option does not influence the support but counts towards participation.
Yes2This option increases the support and counts towards participation.
No3This option decreases the support and counts towards participation.

VotingMode ​

solidity
enum VotingMode {
    Standard,
    EarlyExecution,
    VoteReplacement
}

The different voting modes available.

OptionValueDescription
Standard0In standard mode, early execution and vote replacement are disabled.
EarlyExecution1In early execution mode, a proposal can be executed early before the end date if the vote outcome cannot mathematically change by more voters voting.
VoteReplacement2In vote replacement mode, voters can change their vote multiple times and only the latest vote option is tallied.

Structs ​

MetadataExtensionStorage ​

Inherited from MetadataExtensionUpgradeable.

solidity
struct MetadataExtensionStorage {
    bytes metadata;
}

Proposal ​

solidity
struct Proposal {
    bool executed;
    MajorityVotingBase.ProposalParameters parameters;
    MajorityVotingBase.Tally tally;
    mapping(address => IMajorityVoting.VoteOption) voters;
    Action[] actions;
    uint256 allowFailureMap;
    uint256 minApprovalPower;
    IPlugin.TargetConfig targetConfig;
}

A container for proposal-related information.

FieldTypeDescription
executedboolWhether the proposal is executed or not.
parametersMajorityVotingBase.ProposalParametersThe proposal parameters at the time of the proposal creation.
tallyMajorityVotingBase.TallyThe vote tally of the proposal.
votersmapping(address => IMajorityVoting.VoteOption)The votes casted by the voters.
actionsAction[]The actions to be executed when the proposal passes.
allowFailureMapuint256A 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.
minApprovalPoweruint256The minimum amount of yes votes power needed for the proposal advance.
targetConfigIPlugin.TargetConfigConfiguration for the execution target, specifying the target address and operation type (either Call or DelegateCall). Defined by TargetConfig in the IPlugin interface, part of the osx-commons-contracts package, added in build 3.

ProposalParameters ​

solidity
struct ProposalParameters {
    MajorityVotingBase.VotingMode votingMode;
    uint32 supportThreshold;
    uint64 startDate;
    uint64 endDate;
    uint64 snapshotTimepoint;
    uint256 minVotingPower;
}

A container for the proposal parameters at the time of proposal creation.

FieldTypeDescription
votingModeMajorityVotingBase.VotingModeA parameter to select the vote mode.
supportThresholduint32The support threshold value. The value has to be in the interval [0, 10^6) defined by RATIO_BASE = 10**6.
startDateuint64The start date of the proposal vote.
endDateuint64The end date of the proposal vote.
snapshotTimepointuint64The number of the block prior to the proposal creation.
minVotingPoweruint256The minimum voting power needed for a proposal to reach minimum participation.

Tally ​

solidity
struct Tally {
    uint256 abstain;
    uint256 yes;
    uint256 no;
}

A container for the proposal vote tally.

FieldTypeDescription
abstainuint256The number of abstain votes casted.
yesuint256The number of yes votes casted.
nouint256The number of no votes casted.

TargetConfig ​

Inherited from IPlugin.

solidity
struct TargetConfig {
    address target;
    IPlugin.Operation operation;
}

Configuration for the target contract that the plugin will interact with, including the address and operation type.

Dev: By default, the plugin typically targets the associated DAO and performs a Call operation. However, this configuration allows the plugin to specify a custom executor and select either Call or DelegateCall based on the desired execution context.

FieldTypeDescription
targetaddressThe address of the target contract, typically the associated DAO but configurable to a custom executor.
operationIPlugin.OperationThe type of operation (Call or DelegateCall) to execute on the target, as defined by Operation.

VotingSettings ​

solidity
struct VotingSettings {
    MajorityVotingBase.VotingMode votingMode;
    uint32 supportThreshold;
    uint32 minParticipation;
    uint64 minDuration;
    uint256 minProposerVotingPower;
}

A container for the majority voting settings that will be applied as parameters on proposal creation.

FieldTypeDescription
votingModeMajorityVotingBase.VotingModeA parameter to select the vote mode. In standard mode (0), early execution and vote replacement are disabled. In early execution mode (1), a proposal can be executed early before the end date if the vote outcome cannot mathematically change by more voters voting. In vote replacement mode (2), voters can change their vote multiple times and only the latest vote option is tallied.
supportThresholduint32The support threshold value. Its value has to be in the interval [0, 10^6) defined by RATIO_BASE = 10**6.
minParticipationuint32The minimum participation value. Its value has to be in the interval [0, 10^6] defined by RATIO_BASE = 10**6.
minDurationuint64The minimum duration of the proposal vote in seconds.
minProposerVotingPoweruint256The minimum voting power required to create a proposal.