Skip to content

LockToVotePlugin ​

Contract · src/LockToVotePlugin.sol

Explained in: Lock to Vote Plugin

Inherits: ILockToVote, MajorityVotingBase, LockToGovernBase

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 _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 _proposalId does not exist.

ParameterTypeDescription
_proposalIduint256
_voteraddress
_voteOptionIMajorityVoting.VoteOption
ReturnsTypeDescription
[0]boolReturns true if the account is allowed to vote.

clearVote ​

solidity
function clearVote(uint256 _proposalId, address _voter) external

Selector: 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 ​

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

ParameterTypeDescription
_metadatabytes
_actionsAction[]
_startDateuint64
_endDateuint64UNUSED: The parameter is kept for compatibility with IProposal but its value is computed internally. It should be set to 0.
_databytes
ReturnsTypeDescription
proposalIduint256The id of the proposal.

currentTokenSupply ​

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

ReturnsTypeDescription
[0]uint256The total token supply.

customProposalParamsABI ​

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

ReturnsTypeDescription
[0]stringABI of params in data of createProposal.

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

getVote ​

solidity
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 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.VoteEntryThe vote option cast by a voter for a certain proposal.

getVotingSettings ​

solidity
function getVotingSettings() external view returns (MajorityVotingBase.VotingSettings)

Selector: 0xf6832643

Returns the current voting settings.

ReturnsTypeDescription
[0]MajorityVotingBase.VotingSettings

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.

initialize ​

solidity
function initialize(
    IDAO _dao,
    ILockManager _lockManager,
    MajorityVotingBase.VotingSettings _votingSettings,
    IPlugin.TargetConfig _targetConfig,
    bytes _pluginMetadata
) external

Selector: 0xcc4b0070

Initializes the component.

Dev: This method is required to support ERC-1822.

ParameterTypeDescription
_daoIDAOThe IDAO interface of the associated DAO.
_lockManagerILockManager
_votingSettingsMajorityVotingBase.VotingSettingsThe voting settings.
_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.
_pluginMetadatabytesThe plugin specific information encoded in bytes. This can also be an ipfs cid encoded in bytes.

isMember ​

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

ParameterTypeDescription
_accountaddressThe address of the account to be checked.
ReturnsTypeDescription
[0]boolWhether the account is a member or not.

isMinApprovalReached ​

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

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

isMinVotingPowerReached ​

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

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

isProposalEnded ​

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

Selector: 0xf3dfd559

Returns wether a proposal has ended or not.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolTrue if the proposal is executed or past the endDate, false otherwise. False if it doesn't exist.

isProposalOpen ​

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

Selector: 0x780e19c1

Returns wether a proposal is open for submitting votes or not.

ParameterTypeDescription
_proposalIduint256The ID of the proposal.
ReturnsTypeDescription
[0]boolTrue if the proposal is open, false if it hasn't started yet or if it has been already settled.

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.

lockManager ​

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

ReturnsTypeDescription
[0]ILockManager

minApprovalRatio ​

solidity
function minApprovalRatio() external view returns (uint256)

Selector: 0x0e04be90

Returns the configured minimum approval ratio.

ReturnsTypeDescription
[0]uint256The minimal approval ratio.

minParticipationRatio ​

solidity
function minParticipationRatio() external view returns (uint32)

Selector: 0xb9835a17

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.

ReturnsTypeDescription
[0]uint256The minimum voting power required to create a proposal.

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.

proposalDuration ​

solidity
function proposalDuration() external view returns (uint64)

Selector: 0x30109962

Returns the proposal duration parameter stored in the voting settings.

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

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_ID permission.

ParameterTypeDescription
_targetConfigIPlugin.TargetConfigThe target Config containing the executor address and operation mode.

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.

supportThresholdRatio ​

solidity
function supportThresholdRatio() external view returns (uint32)

Selector: 0x2e747051

Returns the support threshold parameter stored in the voting settings.

ReturnsTypeDescription
[0]uint32The support threshold parameter.

token ​

solidity
function token() external view returns (IERC20)

Selector: 0xfc0c546a

Returns the address of the token contract used to determine the voting power.

ReturnsTypeDescription
[0]IERC20The address of the token used for voting.

updateVotingSettings ​

solidity
function updateVotingSettings(MajorityVotingBase.VotingSettings _votingSettings) external

Selector: 0x3f8b32d9

Updates the voting settings.

Dev: Requires the UPDATE_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

usedVotingPower ​

solidity
function usedVotingPower(uint256 _proposalId, address _voter) external view returns (uint256)

Selector: 0xeff759a8

Returns whether the account has voted for the proposal.

ReturnsTypeDescription
[0]uint256The amount of balance that has been allocated to the proposal by the given account.

vote ​

solidity
function vote(
    uint256 _proposalId,
    address _voter,
    IMajorityVoting.VoteOption _voteOption,
    uint256 _newVotingPower
) external

Selector: 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.

ParameterTypeDescription
_proposalIduint256
_voteraddress
_voteOptionIMajorityVoting.VoteOption
_newVotingPoweruint256

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.

LockManagerDefined ​

solidity
event LockManagerDefined(ILockManager indexed lockManager)

Emitted when the address of the LockManager is set.

ParameterTypeDescription
lockManagerILockManagerThe address of the LockManager contract

MembersAdded ​

solidity
event MembersAdded(address[] members)

Emitted when members are added to the DAO plugin.

ParameterTypeDescription
membersaddress[]The list of new members being added.

MembershipContractAnnounced ​

solidity
event MembershipContractAnnounced(address indexed definingContract)

Emitted to announce the membership being defined by a contract.

ParameterTypeDescription
definingContractaddressThe contract defining the membership.

MembersRemoved ​

solidity
event MembersRemoved(address[] members)

Emitted when members are removed from the DAO plugin.

ParameterTypeDescription
membersaddress[]The list of existing members being removed.

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.

VoteCleared ​

solidity
event VoteCleared(uint256 indexed proposalId, address indexed voter)

Thrown when a user's vote has been cleared.

ParameterTypeDescription
proposalIduint256the ID of the proposal where the vote was cleared.
voteraddressThe address of the token holder whose vote was cleared.

VotingSettingsUpdated ​

solidity
event VotingSettingsUpdated(
    MajorityVotingBase.VotingMode votingMode,
    uint32 supportThresholdRatio,
    uint32 minParticipationRatio,
    uint32 minApprovalRatio,
    uint64 proposalDuration,
    uint256 minProposerVotingPower
)

Emitted when the voting settings are updated.

ParameterTypeDescription
votingModeMajorityVotingBase.VotingModeA parameter to select the vote mode.
supportThresholdRatiouint32The support threshold ratio.
minParticipationRatiouint32The minimum participation ratio.
minApprovalRatiouint32The minimum ratio of yes votes over the token supply needed for the proposal advance.
proposalDurationuint64The duration of the proposal 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.

EmptyDAOAddress ​

solidity
error EmptyDAOAddress()

Thrown when the given DAO address is empty.

FunctionDeprecated ​

solidity
error FunctionDeprecated()

InvalidActionTarget ​

solidity
error InvalidActionTarget(uint256 actionIdx, address target)

Thrown when a proposal action is targeting address(0) or the LockManager

ParameterTypeDescription
actionIdxuint256The index of the action
targetaddressThe invalid address that was passed

InvalidTargetAddress ​

solidity
error InvalidTargetAddress()

Thrown when atempting to set the plugin or the LockManager as execution targets

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.

LockManagerAlreadyDefined ​

solidity
error LockManagerAlreadyDefined()

Thrown when attempting to define the address of the LockManager after it was already set.

NonexistentProposal ​

solidity
error NonexistentProposal(uint256 proposalId)

Thrown when a proposal doesn't exist.

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

NoVotingPower ​

solidity
error NoVotingPower()

Thrown when creating a proposal without any locked tokens.

ProposalAlreadyExists ​

solidity
error ProposalAlreadyExists(uint256 proposalId)

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

ParameterTypeDescription
proposalIduint256The id of the proposal.

ProposalCreationForbidden ​

solidity
error ProposalCreationForbidden(address sender)

Thrown when a sender is not allowed to create a proposal.

ParameterTypeDescription
senderaddressThe sender address.

ProposalDurationOutOfBounds ​

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

ParameterTypeDescription
limituint64The limit value.
actualuint64The actual value.

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.

VoteCallForbidden ​

solidity
error VoteCallForbidden(address caller)

Thrown when the address calling vote() is not the LockManager.

ParameterTypeDescription
calleraddressThe address calling vote().

VoteCastForbidden ​

solidity
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.
ParameterTypeDescription
proposalIduint256The ID of the proposal.
accountaddressThe address of the _account.

VoteRemovalForbidden ​

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

ParameterTypeDescription
proposalIduint256The ID of the proposal.
voteraddressThe address of the voter.

VoteRemovalUnauthorized ​

solidity
error VoteRemovalUnauthorized(address caller)

Thrown when attempting to call clearVote() from an address other than the LockManager.

ParameterTypeDescription
calleraddressThe address calling clearVote().

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 ​

Inherited from MajorityVotingBase.

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.

LOCK_MANAGER_PERMISSION_ID ​

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

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_SETTINGS_PERMISSION_ID ​

Inherited from MajorityVotingBase.

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

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 ​

Inherited from MajorityVotingBase.

solidity
enum VotingMode {
    Standard,
    VoteReplacement
}

The different voting modes available.

OptionValueDescription
Standard0In standard mode, the voting power can be increased but votes cannot be replaced.
VoteReplacement1In 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 ​

Inherited from MajorityVotingBase.

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

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.
votesmapping(address => IMajorityVoting.VoteEntry)The voting power cast by each voter.
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.
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 ​

Inherited from MajorityVotingBase.

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

FieldTypeDescription
votingModeMajorityVotingBase.VotingModeA parameter to select the vote mode.
supportThresholdRatiouint32The 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.
startDateuint64The timestamp on which a proposal starts accepting votes. Range: [startDate, endDate)
endDateuint64The timestamp on which a proposal no longer accepts votes.
minParticipationRatiouint256The 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.
minApprovalRatiouint256Minimum 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.

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.

VoteEntry ​

Inherited from IMajorityVoting.

solidity
struct VoteEntry {
    IMajorityVoting.VoteOption voteOption;
    uint256 votingPower;
}

Holds the state of an account's vote

FieldTypeDescription
voteOptionIMajorityVoting.VoteOption1 -> abstain, 2 -> yes, 3 -> no
votingPoweruint256How many tokens the account has allocated to voteOption

VotingSettings ​

Inherited from MajorityVotingBase.

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

FieldTypeDescription
votingModeMajorityVotingBase.VotingModeA 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.
supportThresholdRatiouint32The 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.
minParticipationRatiouint32The 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.
minApprovalRatiouint32Minimum 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.
proposalDurationuint64The duration of the proposal vote in seconds.
minProposerVotingPoweruint256The minimum voting power required to create a proposal.