Specs
Source
See the github repo here.
Overview
Powers is a Role Restricted Governance Protocol that provides a modular, flexible, decentralized and efficient governance engine for DAOs. It is designed to be used in combination with implementations of Law.sol contracts.
Key differences from OpenZeppelin's Governor.sol:
DAO actions must be encoded in role-restricted external contracts (laws) following the
ILawinterfaceProposing, voting, cancelling and executing actions are role-restricted along the target law
All DAO actions must run through the governance flow provided by Powers.sol
Uses a non-weighted voting mechanism: one account has one vote
Core protocol is intentionally minimalistic - complexity (timelocks, delayed execution, guardian roles, weighted votes, staking) must be integrated through laws
State Variables
_actions
An internal mapping of Action structs. Its data can be accessed through the getActionCalldata, getActionUri and getActionNonce getter functions.
mapping(uint256 actionId => Action) internal _actions;_laws
An internal mapping of AdoptedLaw structs that tracks all active laws in the protocol.
_roles
An internal mapping of Role structs that tracks role assignments and membership.
_deposits
An internal mapping that tracks deposits from accounts (only covers chain native currency).
Constants
ADMIN_ROLE: Set totype(uint256).min(0)PUBLIC_ROLE: Set totype(uint256).maxDENOMINATOR: Set to 100 (100%)
Other State Variables
name: Name of the DAOuri: URI to metadata of the DAO_constituteExecuted: Boolean tracking if constitute function has been calledlawCounter: Number of laws initiated (starts at 1)
Functions
Governance Functions
request
Initiates an action to be executed through a law. Entry point for all actions in the protocol.
fulfill
Completes an action by executing the actual calls. Can only be called by an active law contract.
propose
Creates a new proposal for an action that requires voting. Only callable if the law requires voting (quorum > 0).
cancel
Cancels an existing proposal. Can only be called by the original proposer.
castVote&castVoteWithReason
&castVoteWithReasonCasts a vote on an active proposal. Vote types: 0=Against, 1=For, 2=Abstain.
Role and Law Administration
constitute
Initializes the DAO by activating its founding laws. Can only be called once by an admin account.
adoptLaw & revokeLaw
Activates or deactivates a law in the protocol.
assignRole & revokeRole
Grants or removes a role from an account.
labelRole
Assigns a human-readable label to a role.
Structs
Action
Tracks a proposal's state and voting information.
AdoptedLaw
Tracks an active law's address and status.
Role
Tracks role assignments and membership.
Deposit
Tracks a deposit's amount and block number.
Events
Governance Events
ActionRequested: Emitted when an executive action is requestedActionExecuted: Emitted when an executive action has been executedProposedActionCreated: Emitted when a proposal is createdProposedActionCancelled: Emitted when a proposal is cancelledVoteCast: Emitted when a vote is cast
Role and Law Events
RoleSet: Emitted when a role is assigned or revokedRoleLabel: Emitted when a role is labeledLawAdopted: Emitted when a law is adoptedLawRevoked: Emitted when a law is revokedLawRevived: Emitted when a law is revived
Other Events
Powers__Initialized: Emitted when protocol is initializedFundsReceived: Emitted when protocol receives funds
Enums
ActionState
Represents the state of a proposal:
Active
Cancelled
Defeated
Succeeded
Requested
Fulfilled
NonExistent
VoteType
Supported vote types (matches Governor Bravo ordering):
Against
For
Abstain
Last updated