LockToVotePlugin
Contract · src/LockToVotePlugin.sol
Explained in: Lock to Vote Plugin
Inherits: ILockToVote, MajorityVotingBase, LockToGovernBase
Functions
canExecute
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
_proposalIddoes not exist.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal to be checked. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | True if the proposal can be executed, false otherwise. |
canVote
function canVote(
uint256 _proposalId,
address _voter,
IMajorityVoting.VoteOption _voteOption
) external view returns (bool)Selector: 0x17d1b404
Checks if an account can participate on a proposal. This can fail because the vote - has not started, - has ended, - was executed, or - the voter doesn't have voting powers. - the voter can increase the amount of tokens assigned
Dev: Reverts if the proposal with the given
_proposalIddoes not exist.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | |
_voter | address | |
_voteOption | IMajorityVoting.VoteOption |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Returns true if the account is allowed to vote. |
clearVote
function clearVote(uint256 _proposalId, address _voter) externalSelector: 0x2098be15
Reverts if the vote cannot be cleared due to the voting settings. This can be because: - The plugin is in Standard votingMode and the voter has votes registered on active proposals
createProposal
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)Selector: 0xea65ab82
Creates a new proposal.
Dev: Requires the
CREATE_PROPOSAL_PERMISSION_IDpermission.
| Parameter | Type | Description |
|---|---|---|
_metadata | bytes | |
_actions | Action[] | |
_startDate | uint64 | |
_endDate | uint64 | UNUSED: The parameter is kept for compatibility with IProposal but its value is computed internally. It should be set to 0. |
_data | bytes |
| Returns | Type | Description |
|---|---|---|
proposalId | uint256 | The id of the proposal. |
currentTokenSupply
function currentTokenSupply() external view returns (uint256)Selector: 0xd9779fbe
Returns the current token supply. NOTE: It includes any non circulating supply that might be vesting, locked or undistributed.
| Returns | Type | Description |
|---|---|---|
[0] | uint256 | The total token supply. |
customProposalParamsABI
function customProposalParamsABI() external pure 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.
| Returns | Type | Description |
|---|---|---|
[0] | string | ABI of params in data of createProposal. |
dao
function dao() external view returns (IDAO)Selector: 0x4162169f
Returns the DAO contract.
execute
function execute(uint256 _proposalId) externalSelector: 0xfe0d94c1
Executes a proposal.
Dev: Requires the
EXECUTE_PROPOSAL_PERMISSION_IDpermission.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal to be executed. |
getCurrentTargetConfig
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)Selector: 0xc98425ee
Returns the currently set target contract.
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.TargetConfig |
getMetadata
function getMetadata() external view returns (bytes)Selector: 0x7a5b4f59
Returns the metadata currently applied.
getProposal
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.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
open | bool | Whether the proposal is open or not. |
executed | bool | Whether the proposal is executed or not. |
parameters | MajorityVotingBase.ProposalParameters | The parameters of the proposal. |
tally | MajorityVotingBase.Tally | The current tally of the proposal. |
actions | Action[] | The actions to be executed to the target contract address. |
allowFailureMap | uint256 | The bit map representations of which actions are allowed to revert so tx still succeeds. |
targetConfig | IPlugin.TargetConfig | Execution configuration, applied to the proposal when it was created. Added in build 3. |
getTargetConfig
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().
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.TargetConfig |
getVote
function getVote(
uint256 _proposalId,
address _voter
) external view returns (IMajorityVoting.VoteEntry)Selector: 0xbc3f931f
Returns whether the account has voted for the proposal.
Dev: May return
noneif the_proposalIddoes not exist, or the_accountdoes not have voting power.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
_voter | address |
| Returns | Type | Description |
|---|---|---|
[0] | IMajorityVoting.VoteEntry | The vote option cast by a voter for a certain proposal. |
getVotingSettings
function getVotingSettings() external view returns (MajorityVotingBase.VotingSettings)Selector: 0xf6832643
Returns the current voting settings.
| Returns | Type | Description |
|---|---|---|
[0] | MajorityVotingBase.VotingSettings |
hasSucceeded
function hasSucceeded(uint256 _proposalId) external view returns (bool)Selector: 0xc218c132
Whether proposal succeeded or not.
Dev: Reverts if the proposal with the given
_proposalIddoes not exist.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The id of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Returns if proposal has been succeeded or not without including time window checks. |
implementation
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.
initialize
function initialize(
IDAO _dao,
ILockManager _lockManager,
MajorityVotingBase.VotingSettings _votingSettings,
IPlugin.TargetConfig _targetConfig,
bytes _pluginMetadata
) externalSelector: 0xcc4b0070
Initializes the component.
Dev: This method is required to support ERC-1822.
| Parameter | Type | Description |
|---|---|---|
_dao | IDAO | The IDAO interface of the associated DAO. |
_lockManager | ILockManager | |
_votingSettings | MajorityVotingBase.VotingSettings | The voting settings. |
_targetConfig | IPlugin.TargetConfig | Configuration 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. |
_pluginMetadata | bytes | The plugin specific information encoded in bytes. This can also be an ipfs cid encoded in bytes. |
isMember
function isMember(address _account) external view returns (bool)Selector: 0xa230c524
Checks if an account is a member of the DAO.
Dev: This function must be implemented in the plugin contract that introduces the members to the DAO.
| Parameter | Type | Description |
|---|---|---|
_account | address | The address of the account to be checked. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Whether the account is a member or not. |
isMinApprovalReached
function isMinApprovalReached(uint256 _proposalId) external view returns (bool)Selector: 0x36fa9589
Checks if the min approval value defined as: $$\texttt{minApprovalRatio} = \frac{N_\text{yes}}{N_\text{total}}$$ for a proposal is greater or equal than the minimum approval value.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Returns true if the approvals is greater or equal than the minimum approval and false otherwise. |
isMinVotingPowerReached
function isMinVotingPowerReached(uint256 _proposalId) external view returns (bool)Selector: 0xcfd40b84
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.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Returns true if the participation is greater or equal than the minimum participation, and false otherwise. |
isProposalEnded
function isProposalEnded(uint256 _proposalId) external view returns (bool)Selector: 0xf3dfd559
Returns wether a proposal has ended or not.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | True if the proposal is executed or past the endDate, false otherwise. False if it doesn't exist. |
isProposalOpen
function isProposalOpen(uint256 _proposalId) external view returns (bool)Selector: 0x780e19c1
Returns wether a proposal is open for submitting votes or not.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | True if the proposal is open, false if it hasn't started yet or if it has been already settled. |
isSupportThresholdReached
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.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | The ID of the proposal. |
| Returns | Type | Description |
|---|---|---|
[0] | bool | Returns true if the support is greater than the support threshold and false otherwise. |
lockManager
function lockManager() external view returns (ILockManager)Selector: 0xacca30a2
Returns the address of the manager contract, which holds the locked balances and the allocated vote balances.
| Returns | Type | Description |
|---|---|---|
[0] | ILockManager |
minApprovalRatio
function minApprovalRatio() external view returns (uint256)Selector: 0x0e04be90
Returns the configured minimum approval ratio.
| Returns | Type | Description |
|---|---|---|
[0] | uint256 | The minimal approval ratio. |
minParticipationRatio
function minParticipationRatio() external view returns (uint32)Selector: 0xb9835a17
Returns the minimum participation parameter stored in the voting settings.
| Returns | Type | Description |
|---|---|---|
[0] | uint32 | The minimum participation parameter. |
minProposerVotingPower
function minProposerVotingPower() external view returns (uint256)Selector: 0xf60046b2
Returns the minimum voting power required to create a proposal stored in the voting settings.
| Returns | Type | Description |
|---|---|---|
[0] | uint256 | The minimum voting power required to create a proposal. |
pluginType
function pluginType() external pure returns (IPlugin.PluginType)Selector: 0x41de6830
Returns the plugin's type
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.PluginType |
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. |
proposalDuration
function proposalDuration() external view returns (uint64)Selector: 0x30109962
Returns the proposal duration parameter stored in the voting settings.
protocolVersion
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
releaseandbuildnumbers found in theVersion.Tagstruct inside thePluginRepocontract being used to version plugin setup and associated plugin implementation contracts.
| Returns | Type | Description |
|---|---|---|
[0] | uint8[3] | Returns the semantic Aragon OSx protocol version number. |
proxiableUUID
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
notDelegatedmodifier.
setMetadata
function setMetadata(bytes _metadata) externalSelector: 0xee57e36f
Allows to update only the metadata.
| Parameter | Type | Description |
|---|---|---|
_metadata | bytes | The utf8 bytes of a content addressing cid that stores plugin's information. |
setTargetConfig
function setTargetConfig(IPlugin.TargetConfig _targetConfig) externalSelector: 0xbb225da2
Defines of the IExecutor contract where executable actions will be sent to. IMPORTANT: The executor address (target) should only be set to the DAO or to the Executor contract deployed by Aragon. IMPORTANT: Defining any other executor in DelegateCall mode (operation), can lead to undefined behaviour.
Dev: The caller must have the
SET_TARGET_CONFIG_PERMISSION_IDpermission.
| Parameter | Type | Description |
|---|---|---|
_targetConfig | IPlugin.TargetConfig | The target Config containing the executor address and operation mode. |
supportsInterface
function supportsInterface(bytes4 _interfaceId) external view returns (bool)Selector: 0x01ffc9a7
Checks if this or the parent contract supports an interface by its ID.
| Parameter | Type | Description |
|---|---|---|
_interfaceId | bytes4 | The ID of the interface. |
supportThresholdRatio
function supportThresholdRatio() external view returns (uint32)Selector: 0x2e747051
Returns the support threshold parameter stored in the voting settings.
| Returns | Type | Description |
|---|---|---|
[0] | uint32 | The support threshold parameter. |
token
function token() external view returns (IERC20)Selector: 0xfc0c546a
Returns the address of the token contract used to determine the voting power.
| Returns | Type | Description |
|---|---|---|
[0] | IERC20 | The address of the token used for voting. |
updateVotingSettings
function updateVotingSettings(MajorityVotingBase.VotingSettings _votingSettings) externalSelector: 0x3f8b32d9
Updates the voting settings.
Dev: Requires the
UPDATE_SETTINGS_PERMISSION_IDpermission.
| Parameter | Type | Description |
|---|---|---|
_votingSettings | MajorityVotingBase.VotingSettings | The new voting settings. |
upgradeTo
function upgradeTo(address newImplementation) externalSelector: 0x3659cfe6
Dev: Upgrade the implementation of the proxy to
newImplementation.Calls {_authorizeUpgrade}.
Emits an {Upgraded} event.
oz-upgrades-unsafe-allow-reachable: delegatecall
upgradeToAndCall
function upgradeToAndCall(address newImplementation, bytes data) external payableSelector: 0x4f1ef286
Dev: Upgrade the implementation of the proxy to
newImplementation, and subsequently execute the function call encoded indata.Calls {_authorizeUpgrade}.
Emits an {Upgraded} event.
oz-upgrades-unsafe-allow-reachable: delegatecall
usedVotingPower
function usedVotingPower(uint256 _proposalId, address _voter) external view returns (uint256)Selector: 0xeff759a8
Returns whether the account has voted for the proposal.
| Returns | Type | Description |
|---|---|---|
[0] | uint256 | The amount of balance that has been allocated to the proposal by the given account. |
vote
function vote(
uint256 _proposalId,
address _voter,
IMajorityVoting.VoteOption _voteOption,
uint256 _newVotingPower
) externalSelector: 0x483f50f8
Votes on a proposal and, depending on the mode, executes it.
Dev:
voteOption, 1 -> abstain, 2 -> yes, 3 -> novotingPower updates any prior voting power, it does not add to the existing amount.
| Parameter | Type | Description |
|---|---|---|
_proposalId | uint256 | |
_voter | address | |
_voteOption | IMajorityVoting.VoteOption | |
_newVotingPower | uint256 |
votingMode
function votingMode() external view returns (MajorityVotingBase.VotingMode)Selector: 0x23d07188
Returns the vote mode stored in the voting settings.
| Returns | Type | Description |
|---|---|---|
[0] | MajorityVotingBase.VotingMode |
Events
AdminChanged
event AdminChanged(address previousAdmin, address newAdmin)Dev: Emitted when the admin account has changed.
BeaconUpgraded
event BeaconUpgraded(address indexed beacon)Dev: Emitted when the beacon is changed.
Initialized
event Initialized(uint8 version)Dev: Triggered when the contract has been initialized or reinitialized.
LockManagerDefined
event LockManagerDefined(ILockManager indexed lockManager)Emitted when the address of the LockManager is set.
| Parameter | Type | Description |
|---|---|---|
lockManager | ILockManager | The address of the LockManager contract |
MembersAdded
event MembersAdded(address[] members)Emitted when members are added to the DAO plugin.
| Parameter | Type | Description |
|---|---|---|
members | address[] | The list of new members being added. |
MembershipContractAnnounced
event MembershipContractAnnounced(address indexed definingContract)Emitted to announce the membership being defined by a contract.
| Parameter | Type | Description |
|---|---|---|
definingContract | address | The contract defining the membership. |
MembersRemoved
event MembersRemoved(address[] members)Emitted when members are removed from the DAO plugin.
| Parameter | Type | Description |
|---|---|---|
members | address[] | The list of existing members being removed. |
MetadataSet
event MetadataSet(bytes metadata)Emitted when metadata is updated.
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. |
TargetSet
event TargetSet(IPlugin.TargetConfig newTargetConfig)Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
|---|---|---|
newTargetConfig | IPlugin.TargetConfig |
Upgraded
event Upgraded(address indexed implementation)Dev: Emitted when the implementation is upgraded.
VoteCast
event VoteCast(
uint256 indexed proposalId,
address indexed voter,
IMajorityVoting.VoteOption voteOption,
uint256 votingPower
)Emitted when a vote is cast by a voter.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
voter | address | The voter casting the vote. |
voteOption | IMajorityVoting.VoteOption | The casted vote option. |
votingPower | uint256 | The voting power behind this vote. |
VoteCleared
event VoteCleared(uint256 indexed proposalId, address indexed voter)Thrown when a user's vote has been cleared.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | the ID of the proposal where the vote was cleared. |
voter | address | The address of the token holder whose vote was cleared. |
VotingSettingsUpdated
event VotingSettingsUpdated(
MajorityVotingBase.VotingMode votingMode,
uint32 supportThresholdRatio,
uint32 minParticipationRatio,
uint32 minApprovalRatio,
uint64 proposalDuration,
uint256 minProposerVotingPower
)Emitted when the voting settings are updated.
| Parameter | Type | Description |
|---|---|---|
votingMode | MajorityVotingBase.VotingMode | A parameter to select the vote mode. |
supportThresholdRatio | uint32 | The support threshold ratio. |
minParticipationRatio | uint32 | The minimum participation ratio. |
minApprovalRatio | uint32 | The minimum ratio of yes votes over the token supply needed for the proposal advance. |
proposalDuration | uint64 | The duration of the proposal in seconds. |
minProposerVotingPower | uint256 | The minimum voting power required to create a proposal. |
Errors
AlreadyInitialized
error AlreadyInitialized()Thrown when initialize is called after it has already been executed.
DaoUnauthorized
error DaoUnauthorized(address dao, address where, address who, bytes32 permissionId)Thrown if a call is unauthorized in the associated DAO.
| Parameter | Type | Description |
|---|---|---|
dao | address | The associated DAO. |
where | address | The context in which the authorization reverted. |
who | address | The address (EOA or contract) missing the permission. |
permissionId | bytes32 | The permission identifier. |
DateOutOfBounds
error DateOutOfBounds(uint64 limit, uint64 actual)Thrown if a date is out of bounds.
| Parameter | Type | Description |
|---|---|---|
limit | uint64 | The limit value. |
actual | uint64 | The actual value. |
DelegateCallFailed
error DelegateCallFailed()Thrown when delegatecall fails.
EmptyDAOAddress
error EmptyDAOAddress()Thrown when the given DAO address is empty.
FunctionDeprecated
error FunctionDeprecated()InvalidActionTarget
error InvalidActionTarget(uint256 actionIdx, address target)Thrown when a proposal action is targeting address(0) or the LockManager
| Parameter | Type | Description |
|---|---|---|
actionIdx | uint256 | The index of the action |
target | address | The invalid address that was passed |
InvalidTargetAddress
error InvalidTargetAddress()Thrown when atempting to set the plugin or the LockManager as execution targets
InvalidTargetConfig
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)Thrown when target is of type 'IDAO', but operation is delegateCall.
| Parameter | Type | Description |
|---|---|---|
targetConfig | IPlugin.TargetConfig | The target config to update it to. |
LockManagerAlreadyDefined
error LockManagerAlreadyDefined()Thrown when attempting to define the address of the LockManager after it was already set.
NonexistentProposal
error NonexistentProposal(uint256 proposalId)Thrown when a proposal doesn't exist.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal which doesn't exist. |
NoVotingPower
error NoVotingPower()Thrown when creating a proposal without any locked tokens.
ProposalAlreadyExists
error ProposalAlreadyExists(uint256 proposalId)Thrown if the proposal with same actions and metadata already exists.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The id of the proposal. |
ProposalCreationForbidden
error ProposalCreationForbidden(address sender)Thrown when a sender is not allowed to create a proposal.
| Parameter | Type | Description |
|---|---|---|
sender | address | The sender address. |
ProposalDurationOutOfBounds
error ProposalDurationOutOfBounds(uint64 limit, uint64 actual)Thrown if the proposal duration value is out of bounds (less than one hour or greater than 1 month).
| Parameter | Type | Description |
|---|---|---|
limit | uint64 | The limit value. |
actual | uint64 | The actual value. |
ProposalExecutionForbidden
error ProposalExecutionForbidden(uint256 proposalId)Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
RatioOutOfBounds
error RatioOutOfBounds(uint256 limit, uint256 actual)Thrown if a ratio value exceeds the maximal value of 10**6.
| Parameter | Type | Description |
|---|---|---|
limit | uint256 | The maximal value. |
actual | uint256 | The actual value. |
VoteCallForbidden
error VoteCallForbidden(address caller)Thrown when the address calling vote() is not the LockManager.
| Parameter | Type | Description |
|---|---|---|
caller | address | The address calling vote(). |
VoteCastForbidden
error VoteCastForbidden(uint256 proposalId, address account)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.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
account | address | The address of the _account. |
VoteRemovalForbidden
error VoteRemovalForbidden(uint256 proposalId, address voter)Thrown when attempting to remove a vote, because it is still active or because the plugin mode doesn't allow it.
| Parameter | Type | Description |
|---|---|---|
proposalId | uint256 | The ID of the proposal. |
voter | address | The address of the voter. |
VoteRemovalUnauthorized
error VoteRemovalUnauthorized(address caller)Thrown when attempting to call clearVote() from an address other than the LockManager.
| Parameter | Type | Description |
|---|---|---|
caller | address | The address calling clearVote(). |
Constants
Public, so each is also readable through a generated getter.
CREATE_PROPOSAL_PERMISSION_ID
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
Inherited from MajorityVotingBase.
bytes32 public constant EXECUTE_PROPOSAL_PERMISSION_ID = keccak256("EXECUTE_PROPOSAL_PERMISSION");Value: 0xf281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea887889
The ID of the permission required to call the execute function.
LOCK_MANAGER_PERMISSION_ID
bytes32 public constant LOCK_MANAGER_PERMISSION_ID = keccak256("LOCK_MANAGER_PERMISSION");Value: 0x28959d3c8d9c85fe68b3927a0425322ccc2f64692cea992da81e150c47353017
The ID of the permission required to call vote and clearVote.
SET_METADATA_PERMISSION_ID
Inherited from MetadataExtensionUpgradeable.
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.
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_SETTINGS_PERMISSION_ID
Inherited from MajorityVotingBase.
bytes32 public constant UPDATE_SETTINGS_PERMISSION_ID = keccak256("UPDATE_SETTINGS_PERMISSION");Value: 0x371f7eb46741163a91bb271e73a2a58ae7a0b6bc80c10a8c7e03ae2e4bc0e425
The ID of the permission required to call the updateVotingSettings function.
UPGRADE_PLUGIN_PERMISSION_ID
Inherited from PluginUUPSUpgradeable.
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.
enum Operation {
Call,
DelegateCall
}Specifies the type of operation to perform.
| Option | Value |
|---|---|
Call | 0 |
DelegateCall | 1 |
PluginType
Inherited from IPlugin.
enum PluginType {
UUPS,
Cloneable,
Constructable
}Types of plugin implementations available within OSx.
| Option | Value |
|---|---|
UUPS | 0 |
Cloneable | 1 |
Constructable | 2 |
VoteOption
Inherited from IMajorityVoting.
enum VoteOption {
None,
Abstain,
Yes,
No
}Vote options that a voter can chose from.
| Option | Value | Description |
|---|---|---|
None | 0 | The default option state of a voter indicating the absence from the vote. This option neither influences support nor participation. |
Abstain | 1 | This option does not influence the support but counts towards participation. |
Yes | 2 | This option increases the support and counts towards participation. |
No | 3 | This option decreases the support and counts towards participation. |
VotingMode
Inherited from MajorityVotingBase.
enum VotingMode {
Standard,
VoteReplacement
}The different voting modes available.
| Option | Value | Description |
|---|---|---|
Standard | 0 | In standard mode, the voting power can be increased but votes cannot be replaced. |
VoteReplacement | 1 | In vote replacement mode, voters can change their vote multiple times and only the latest vote option is tallied. |
Structs
MetadataExtensionStorage
Inherited from MetadataExtensionUpgradeable.
struct MetadataExtensionStorage {
bytes metadata;
}Proposal
Inherited from MajorityVotingBase.
struct Proposal {
bool executed;
MajorityVotingBase.ProposalParameters parameters;
MajorityVotingBase.Tally tally;
mapping(address => IMajorityVoting.VoteEntry) votes;
Action[] actions;
uint256 allowFailureMap;
IPlugin.TargetConfig targetConfig;
}A container for proposal-related information.
| Field | Type | Description |
|---|---|---|
executed | bool | Whether the proposal is executed or not. |
parameters | MajorityVotingBase.ProposalParameters | The proposal parameters at the time of the proposal creation. |
tally | MajorityVotingBase.Tally | The vote tally of the proposal. |
votes | mapping(address => IMajorityVoting.VoteEntry) | The voting power cast by each voter. |
actions | Action[] | The actions to be executed when 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. |
targetConfig | IPlugin.TargetConfig | Configuration 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
Inherited from MajorityVotingBase.
struct ProposalParameters {
MajorityVotingBase.VotingMode votingMode;
uint32 supportThresholdRatio;
uint64 startDate;
uint64 endDate;
uint256 minParticipationRatio;
uint256 minApprovalRatio;
}A container for the proposal parameters at the time of proposal creation.
| Field | Type | Description |
|---|---|---|
votingMode | MajorityVotingBase.VotingMode | A parameter to select the vote mode. |
supportThresholdRatio | uint32 | The support threshold ratio. Its value has to be in the interval [0, 10^6) defined by RATIO_BASE = 10**6. This is intended as the primary metric for proposals to pass. |
startDate | uint64 | The timestamp on which a proposal starts accepting votes. Range: [startDate, endDate) |
endDate | uint64 | The timestamp on which a proposal no longer accepts votes. |
minParticipationRatio | uint256 | The minimum voting power ratio needed for a proposal to reach the minimum participation. Its value has to be in the interval [0, 10^6] defined by RATIO_BASE = 10**6. This is a intended as secondary metric to prevent noise or spam from passing unadvertedly. Relatively high ratios are not encouraged. |
minApprovalRatio | uint256 | Minimum ratio of allocated YES votes. Its value has to be in the interval [0, 10^6] defined by RATIO_BASE = 10**6. This is a intended as secondary metric to prevent noise or spam from passing unadvertedly. Relatively high ratios are not encouraged. |
Tally
Inherited from MajorityVotingBase.
struct Tally {
uint256 abstain;
uint256 yes;
uint256 no;
}A container for the proposal vote tally.
| Field | Type | Description |
|---|---|---|
abstain | uint256 | The number of abstain votes casted. |
yes | uint256 | The number of yes votes casted. |
no | uint256 | The number of no votes casted. |
TargetConfig
Inherited from IPlugin.
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
Calloperation. However, this configuration allows the plugin to specify a custom executor and select eitherCallorDelegateCallbased on the desired execution context.
| Field | Type | Description |
|---|---|---|
target | address | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
operation | IPlugin.Operation | The type of operation (Call or DelegateCall) to execute on the target, as defined by Operation. |
VoteEntry
Inherited from IMajorityVoting.
struct VoteEntry {
IMajorityVoting.VoteOption voteOption;
uint256 votingPower;
}Holds the state of an account's vote
| Field | Type | Description |
|---|---|---|
voteOption | IMajorityVoting.VoteOption | 1 -> abstain, 2 -> yes, 3 -> no |
votingPower | uint256 | How many tokens the account has allocated to voteOption |
VotingSettings
Inherited from MajorityVotingBase.
struct VotingSettings {
MajorityVotingBase.VotingMode votingMode;
uint32 supportThresholdRatio;
uint32 minParticipationRatio;
uint32 minApprovalRatio;
uint64 proposalDuration;
uint256 minProposerVotingPower;
}A container for the majority voting settings that will be applied as parameters on proposal creation.
| Field | Type | Description |
|---|---|---|
votingMode | MajorityVotingBase.VotingMode | A parameter to select the vote mode. In standard mode (0), the voting power can be increased but votes cannot be replaced. In vote replacement mode (1), voters can change their vote multiple times and only the latest vote option is tallied. |
supportThresholdRatio | uint32 | The support threshold ratio. Its value has to be in the interval [0, 10^6) defined by RATIO_BASE = 10**6. This is intended as the primary metric for proposals to pass. |
minParticipationRatio | uint32 | The minimum voting power ratio needed for a proposal to reach the minimum participation. Its value has to be in the interval [0, 10^6] defined by RATIO_BASE = 10**6. This is a intended as secondary metric to prevent noise or spam from passing unadvertedly. Relatively high ratios are not encouraged. |
minApprovalRatio | uint32 | Minimum ratio of allocated YES votes. Its value has to be in the interval [0, 10^6] defined by RATIO_BASE = 10**6. This is a intended as secondary metric to prevent noise or spam from passing unadvertedly. Relatively high ratios are not encouraged. |
proposalDuration | uint64 | The duration of the proposal vote in seconds. |
minProposerVotingPower | uint256 | The minimum voting power required to create a proposal. |