Specs

Source

See the github repo herearrow-up-right.

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:

  1. DAO actions must be encoded in role-restricted external contracts (laws) following the ILaw interface

  2. Proposing, voting, cancelling and executing actions are role-restricted along the target law

  3. All DAO actions must run through the governance flow provided by Powers.sol

  4. Uses a non-weighted voting mechanism: one account has one vote

  5. 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 to type(uint256).min (0)

  • PUBLIC_ROLE: Set to type(uint256).max

  • DENOMINATOR: Set to 100 (100%)

Other State Variables

  • name: Name of the DAO

  • uri: URI to metadata of the DAO

  • _constituteExecuted: Boolean tracking if constitute function has been called

  • lawCounter: 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

Casts 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 requested

  • ActionExecuted: Emitted when an executive action has been executed

  • ProposedActionCreated: Emitted when a proposal is created

  • ProposedActionCancelled: Emitted when a proposal is cancelled

  • VoteCast: Emitted when a vote is cast

Role and Law Events

  • RoleSet: Emitted when a role is assigned or revoked

  • RoleLabel: Emitted when a role is labeled

  • LawAdopted: Emitted when a law is adopted

  • LawRevoked: Emitted when a law is revoked

  • LawRevived: Emitted when a law is revived

Other Events

  • Powers__Initialized: Emitted when protocol is initialized

  • FundsReceived: 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