# Aragon OSx Protocol
The developer knowledge base for the EVM protocol behind Aragon: the **OSx** core, the **governance plugins**, and the **helpers and tooling** that make them run. It is written for developers building on and integrating with the protocol in Solidity.
## What the protocol is
**Aragon OSx is a framework for building DAOs as smart contracts.** Organizations have different needs, and those needs change over time. OSx keeps the DAO's core small: one contract holds assets, executes arbitrary actions, and owns its own permission database. You can add and remove capabilities around that core as the organization evolves. This relies on two parts:
- **Plugins** add functionality to a DAO (governance, asset management, membership, anything). A DAO installs the plugins it needs and can add, update, or remove them over its lifetime, so the organization evolves without ever being redeployed.
- **A permission system** governs who is allowed to do what, on which contract. It is the single authorization layer the DAO and its plugins share, and it can defer decisions to onchain **conditions**.
Each plugin comes with a **setup** that specifies exactly what to deploy and which permissions to grant or revoke. These changes are reviewable and applied as one all-or-nothing step, so the organization can change its capabilities safely. A versioned **plugin registry** and an installation **framework** support safe publishing, installation, and upgrades. **Factories** deploy the whole stack, and a **launchpad** handles DAO creation.
## Start here
**New to OSx?** Start with the [guides](/guides/index.md): hands-on, Foundry-based walkthroughs to follow from start to finish.
- [Why OSx](/guides/why-osx.md) — the short "what this is and why," no code.
- [A hands-on tour of OSx](/guides/hands-on-tour.md) — deploy a DAO and make it act, in one short test.
- Then the path that fits you: [deploy a DAO](/guides/deploy-a-dao.md) → [launch a governance token](/guides/launch-a-governance-token.md) → [create, vote, execute](/guides/create-vote-execute.md), or, to author your own plugin, [build a plugin](/guides/build-a-plugin.md) → [publish it](/guides/publish-a-plugin.md). Full list and reading order in [guides](/guides/index.md).
**Prefer the reference?** Read these two concepts first; everything else builds on them:
1. [The DAO contract](/core/dao.md) — what a DAO actually *is*.
2. [The permission system](/core/permissions.md) — how OSx decides who may do what.
From there, follow [actions & execution](/core/execution.md) → [the plugin model](/framework/plugins.md) → the [governance plugins](/plugins/index.md). For plugin authoring, follow [base types](/framework/plugin-types.md) → [plugin setup](/framework/plugin-setup.md) → [PluginRepo](/framework/plugin-repo.md) → [the PluginSetupProcessor](/framework/plugin-setup-processor.md). You can also browse by area below.
Browse by area:
- **[Core](/core/index.md)** — the DAO contract and its permission system: what a DAO is and how it authorizes actions.
- **[Common](/common/index.md)** — the shared cross-cutting primitives (now part of osx at `src/common`, formerly the standalone osx-commons): conditions, proposals, membership, ratio, auth, proxies, versioning.
- **[Framework](/framework/index.md)** — what a plugin *is* and how it's built, published, and installed: the plugin model, base types, setup, PluginRepo, the PluginSetupProcessor, the factories, the registries.
- **[Plugins](/plugins/index.md)** — the governance plugins (token voting, multisig, admin, staged proposals, lock-to-vote).
- **[Helpers](/helpers/index.md)** — protocol helpers: the condition library.
- **[Deployment](/deployment/index.md)** — deploying the protocol and DAOs: the protocol factory and the DAO launchpad.
- **[Tooling](/tooling/index.md)** — the tooling for building on OSx: the Foundry plugin template and the `just`/Foundry task runner.
**Coming from another system?** [OSx compared](/osx-compared.md) puts the permission model side by side with OpenZeppelin, Safe + Zodiac and Hats: where each keeps its authorization state, what that buys, what it costs, and how to express each one's patterns in OSx.
**Looking up an exact signature?** The [ABI reference](/abi/index.md) is the generated lookup layer: every public function, event, error, enum and constant of every contract, with its NatSpec, straight from the source. Read the area pages to understand a component; use the ABI reference to check its exact interface.
**The code:** every component's GitHub repository is listed in [Source repositories](/repositories.md).
---
_Operated with the `wiki` CLI: [AGENTS.md](/AGENTS.md) explains how to use it, and [WORKFLOW.md](/WORKFLOW.md) describes this base's conventions. Both are for **maintaining** the base. You can skip them if you're here to learn the protocol._
# Guides
Linear, task-oriented, **Foundry-based** walkthroughs that link into the [concept graph](/index.md) for depth. Read a guide top to bottom; follow its links when you want the underlying detail. (The one exception to "Foundry-based" is the narrative *Why OSx*, which has no code.)
Follow the reading order below, with links to the concepts each guide uses.
**Before you start:** [Setup](/guides/setup.md), the one-time Foundry project scaffold (start from the template, point at a deployed protocol) that every guide below assumes.
## Understand
- [Why OSx: the organization that can reinvent itself](/guides/why-osx.md) — how a small core, replaceable plugins, and one permission layer let an organization change over time.
- [A hands-on tour of OSx](/guides/hands-on-tour.md) — deploy a DAO, fund it, make it execute an action, and see how a permission controls the call.
## Use and operate a DAO
- [Deploy your first DAO](/guides/deploy-a-dao.md) — a bare DAO (you hold `EXECUTE`), then the same flow with a governance plugin installed in one transaction.
- [Launch a governance token with your DAO](/guides/launch-a-governance-token.md) — deploy with Token Voting and the three token paths (mint new, reuse an `IVotes` token, or wrap a plain ERC-20), accounting for delegation and clock requirements.
- [Import an existing token](/guides/import-existing-tokens.md) — choose direct reuse or wrapping, install Token Voting, and prepare holders to vote.
- [Create, vote, and execute a proposal](/guides/create-vote-execute.md) — the shared proposal lifecycle, then the multisig and token-voting specifics.
- [Manage permissions through governance](/guides/manage-permissions.md) — grant/revoke as a proposal, attach a condition, rotate one safely in a single batch, and write a small custom condition.
- [Install a plugin into a live DAO](/guides/install-a-plugin.md) — the prepare → (temporary ROOT to the PSP) → apply → revoke flow, as a governed proposal.
- [Update a plugin](/guides/update-a-plugin.md) — prepare + apply via governance, the release/build rules, and the metadata-only fast path (and uninstalling).
## Build a plugin
- [Build a plugin](/guides/build-a-plugin.md) — from the template: pick a base type, write the plugin's `auth`-gated logic, and write its `PluginSetup` (the permission arrays).
- [Publish a plugin to a PluginRepo](/guides/publish-a-plugin.md) — first version 1.1, release vs build, metadata, and the registry.
## Related concepts
For details on composing [multi-stage governance with the SPP](/plugins/spp-plugin.md), gating permissions with the ready-made [condition library](/helpers/condition-library.md), and [deploying the whole protocol](/deployment/protocol-factory.md) on a new chain, follow the linked concepts.
## Treasury flows
[Compose a Capital Tree flow](/guides/compose-capital-tree.md) — build a new recipe from registered components.
[Build and run a Capital Tree solver](/plugins/capital-tree/examples/buyback/openfill.md) — discover offers, construct fills and operate a solver.
# Setup
Set up **your own plugin project** to run the guides' Foundry code. This shared setup provides the starting point; each guide adds the configuration it needs.
**Prerequisites:** [Foundry](https://getfoundry.sh) (`curl -L https://foundry.paradigm.sh | bash`, then `foundryup`) and [`just`](https://github.com/casey/just) (`brew install just`, `cargo install just`, or your system package manager). Everything below requires `just`, the template's task runner. It coordinates network config, per-chain addresses, remappings, and verification so you don't have to manage those steps by hand.
## 1. Start from the template
Clone the [Foundry plugin template](/tooling/plugin-template.md) and initialize it:
```sh
git clone --recurse-submodules https://github.com/aragon/osx-plugin-template.git my-plugin
cd my-plugin
just init # installs dependencies and wires the remappings; `forge build` then works
```
(For a real project, use GitHub's **Use this template** to start your own repo and clone that instead.)
OSx is imported directly under `@aragon/osx/…`. Its shared primitives (conditions, proposals, proxies, and the rest, once the standalone `osx-commons` library) now live inside osx at `@aragon/osx/common/…`; there is no separate package to install.
## 2. Add the plugin you're integrating
The template ships **osx only**. A guide that installs or drives a specific governance plugin imports that plugin's package (e.g. `@aragon/multisig-plugin/…`), so add it as a dependency and a remapping. For the [multisig](/plugins/multisig-plugin.md) guides:
```sh
forge install aragon/multisig-plugin
echo '@aragon/multisig-plugin/=lib/multisig-plugin/packages/contracts/src/' >> remappings.txt
```
For [token voting](/plugins/token-voting-plugin.md), swap in:
```sh
forge install aragon/token-voting-plugin
echo '@aragon/token-voting-plugin/=lib/token-voting-plugin/src/' >> remappings.txt
```
Guides that touch only OSx core (the [DAO](/core/dao.md), [permissions](/core/permissions.md), the [framework](/framework/index.md)) need nothing extra.
## 3. Point at a deployed protocol
The guides run as **fork tests** against a chain where OSx is already deployed, so they read the protocol's addresses from the environment. The template uses [just-foundry](/tooling/just-foundry.md), which supplies these addresses for every supported network. Select a network to export them:
```sh
just switch sepolia # or mainnet, base, arbitrum, … (see lib/just-foundry/networks/)
just env # confirm the resolved values and where each came from
```
That defines `RPC_URL`, `CHAIN_ID`, and the OSx addresses the guides read by name:
| Env var | Used by |
|---|---|
| `DAO_FACTORY_ADDRESS` | every guide that creates a DAO |
| `PLUGIN_SETUP_PROCESSOR_ADDRESS` | [install](/guides/install-a-plugin.md) / [update](/guides/update-a-plugin.md) a plugin |
| `PLUGIN_REPO_FACTORY_ADDRESS` | [publish a plugin](/guides/publish-a-plugin.md) |
| `MULTISIG_PLUGIN_REPO_ADDRESS`, `TOKEN_VOTING_PLUGIN_REPO_ADDRESS`, … | installing that plugin |
These come from the network config (ultimately OSx's own `addresses.json`). To use a private endpoint, override `RPC_URL` via `.env` or `vars`; see [just-foundry](/tooling/just-foundry.md).
Put the guide's test under `test/fork-tests/` and run it through just-foundry, which loads the network env before Foundry sees it:
```sh
just test-fork # run the fork tests in test/fork-tests/
just test-fork --match-contract MyGuide # narrow to one
```
A couple of guides build on a DAO you deployed in an earlier guide and name *its* address (e.g. `DAO`). Set those addresses alongside the values above.
Your project is now configured for the guides' fork tests.
# Why OSx: the organization that can reinvent itself
*An executive, no-code introduction to what OSx means for an organization. Follow the links when you want the technical detail.*
Organizations start small and informal, grow, add functions, change how they make decisions, start new activities, and retire old ones. Most onchain organizations have rules hard-coded into a contract. Substantial changes require deploying a *new* contract and migrating the treasury, token, integrations, and history, while changing the address other people rely on.
**Aragon OSx lets an organization change without replacing its DAO.** The DAO is a small, permanent core: one contract holds the assets, carries out decisions, and owns the permissions that determine who may do what. Capabilities *around* that core can be added, replaced, and upgraded over time. The organization keeps the same treasury, address, and identity while gaining new capabilities and rules as it needs them.
## How OSx supports change
- **The core stays small.** The [DAO](/core/dao.md) itself does only three things: hold funds, execute decisions, and answer "is this allowed?". Its limited responsibilities leave little code that can fail or needs to change.
- **Capabilities are [plugins](/framework/plugins.md).** Governance (a multisig, token voting, staged approvals), treasury automation, membership, anything, is a module you install onto the DAO and can later upgrade or remove. The organization gains and sheds capabilities without being rebuilt.
- **One permission system governs everything.** A single [permission system](/core/permissions.md) decides who may do what, across the DAO and all its plugins. There is one place to reason about authority.
You can move from a founder-run multisig to full token voting, then to a staged process where a council can veto, all on the **same DAO**, with its funds and history untouched. Add payroll or buyback automation years after launch, or remove a capability when it's no longer needed.
## How governance controls changes
OSx uses governed setup changes and a small, audited core to make that flexibility safe:
- **Governance approves plugin changes.** Each plugin comes with a [setup](/framework/plugin-setup.md) that specifies exactly what will be deployed and which permissions will be granted or revoked, applied as a single, reviewable, all-or-nothing step. Governance approves the *exact* change before it happens.
- **The organization governs itself.** After setup, no founder, deployer, or Aragon-controlled key holds power over a DAO. [The DAO holds authority over itself](/core/dao.md#deployment-and-bootstrapping-root), so every change runs through the organization's own governance.
- **Small core, audited.** The minimal core and shared authorization layer limit the code where errors can occur. That code is [audited repeatedly](https://github.com/aragon/osx/tree/main/audits) across releases, by firms including Halborn and Code4rena. Keeping the core small and reviewing it supports the protocol's security.
## Where to go next
- To see how it works, start with [what a DAO is](/core/dao.md) and [the permission system](/core/permissions.md), the two ideas everything else builds on.
- To try it, [A hands-on tour of OSx](/guides/hands-on-tour.md) stands up a DAO and makes it act, in one short Foundry test.
- To launch one with governance in control from the first block, follow [Deploy your first DAO](/guides/deploy-a-dao.md).
OSx is infrastructure for an organization that expects to change over time.
# A hands-on tour of OSx
In one Foundry test, you'll deploy a [DAO](/core/dao.md), fund it, make it perform an onchain action, and see the [permission system](/core/permissions.md) reject the same action from the wrong caller.
The test demonstrates the DAO's three roles: a treasury, an [executor](/core/execution.md), and its own permission database. The later guides build on these operations.
## What you need
Do the one-time [Setup](/guides/setup.md) first, a plugin project pointed at a chain where OSx is deployed. This guide reads just the **`DAOFactory`** address (`DAO_FACTORY_ADDRESS`); nothing plugin-specific.
We fork rather than deploy the whole protocol locally: standing up OSx from scratch is the [Protocol Factory](/deployment/protocol-factory.md)'s job, not something you need for a first look.
## Step 1, deploy a bare DAO
[`DAOFactory.createDao`](/framework/dao-factory.md) creates, registers, and self-governs a DAO in one transaction. Pass an **empty** plugin array and the factory grants **you** (`msg.sender`) `EXECUTE_PERMISSION_ID` on the new DAO, so a plugin-less DAO is yours to drive directly until you install governance.
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {Action} from "@aragon/osx/common/executors/IExecutor.sol";
contract OsxInOneSitting is Test {
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS")); // exported by just-foundry
DAO dao;
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
// No plugins -> the caller (this test) receives EXECUTE_PERMISSION_ID on the DAO.
DAOFactory.DAOSettings memory daoSettings = DAOFactory.DAOSettings({
trustedForwarder: address(0),
daoURI: "",
subdomain: "", // empty = skip ENS registration
metadata: ""
});
DAOFactory.PluginSettings[] memory noPlugins = new DAOFactory.PluginSettings[](0);
(dao, ) = factory.createDao(daoSettings, noPlugins);
}
}
```
You now hold `EXECUTE`, the protocol's most consequential permission. Keeping it on a person is suitable for this demo but dangerous as a permanent arrangement; a DAO's governance plugin should hold it. See [how ROOT is bootstrapped safely](/core/dao.md#deployment-and-bootstrapping-root).
## Step 2, fund it, then make it act
A DAO holds assets like any account, and *does* things by running a batch of [actions](/core/execution.md) (one `Action` is a single external call `(to, value, data)`). In one test, fund the DAO, then have it transfer 1 ETH back out. Add this function to the contract:
```solidity
function test_fundAndSpend() public {
// Fund the treasury. Native coin sent directly hits receive(), which just records it.
vm.deal(address(this), 10 ether);
(bool funded, ) = address(dao).call{value: 5 ether}("");
assertTrue(funded);
assertEq(address(dao).balance, 5 ether);
// Ask the DAO to send 1 ETH to Bob.
address payable bob = payable(address(0xB0B));
Action[] memory actions = new Action[](1);
actions[0] = Action({to: bob, value: 1 ether, data: ""});
// callId is a caller-defined tag (a proposal id, normally); allowFailureMap = 0 = all must succeed.
dao.execute({_callId: bytes32(0), _actions: actions, _allowFailureMap: 0});
assertEq(bob.balance, 1 ether);
assertEq(address(dao).balance, 4 ether);
}
```
Funding is **permissionless**: anyone can pay a DAO, but assets leave *only* through [`execute`](/core/execution.md), which is permission-gated. The transfer runs **as the DAO**. At Bob's address, `msg.sender` is the DAO and the ether is the DAO's because `execute` uses `call`, not `delegatecall`. This is also why a DAO can call *itself* to change its own permissions; see [why it's a `call`](/core/execution.md#the-execute-function).
## Step 3, watch the permission gate
The transfer worked only because *you* hold `EXECUTE_PERMISSION_ID`. The same call from any other address is denied by the [permission system](/core/permissions.md) before a single action runs:
```solidity
function test_strangerCannotExecute() public {
Action[] memory actions = new Action[](1);
actions[0] = Action({to: address(0xB0B), value: 0, data: ""});
vm.prank(address(0xDEAD)); // an address with no permission
vm.expectRevert(); // reverts with an Unauthorized-family error before executing
dao.execute(bytes32(0), actions, 0);
}
```
The revert enforces OSx's access control. Every privileged call in the protocol, on the DAO and on every plugin, checks whether `(where, who, permissionId)` is granted. See [how a decision is made](/core/permissions.md#how-a-decision-is-made).
## What you just saw
- A DAO is **one contract** that holds assets, executes actions, and owns the rules for who may do what, [the DAO](/core/dao.md).
- Actions are how it acts, atomically and *as itself*, [actions and execution](/core/execution.md).
- Nothing privileged happens without a matching grant, [permissions](/core/permissions.md).
## Next
- [Deploy your first DAO](/guides/deploy-a-dao.md) — hand `EXECUTE` to a governance **plugin** in the same transaction, so the organization's governance controls execution.
- [Manage permissions through governance](/guides/manage-permissions.md) — grant, revoke, and condition permissions through proposals.
# Deploy your first DAO
Deploy a DAO with a [Multisig](/plugins/multisig-plugin.md) plugin so that, from block one, only a passed multisig proposal can make it act and no external address retains control. In [A hands-on tour of OSx](/guides/hands-on-tour.md), you made a *bare* DAO and held `EXECUTE_PERMISSION_ID` as an EOA. That suits a demo; this deployment gives execution authority to the organization's **governance**.
It's still one transaction. [`DAOFactory.createDao`](/framework/dao-factory.md) creates the DAO, installs the plugin through the [PSP's temporary-ROOT window](/framework/plugin-setup-processor.md#the-temporary-root-window), and hands `EXECUTE` to the plugin, atomically.
## What you need
The one-time [Setup](/guides/setup.md), with the **multisig** plugin's remapping enabled. This guide reads the **`DAOFactory`** and **Multisig `PluginRepo`** (`MULTISIG_PLUGIN_REPO_ADDRESS`) addresses, and installs a specific plugin version (a `release`/`build`, see [release vs build](/framework/plugin-repo.md#release-vs-build)).
## Step 1, the skeleton
Fork the network and wire the two addresses. Everything else happens in one test:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol";
import {PluginSetupRef} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol";
import {IPlugin} from "@aragon/osx/common/plugin/IPlugin.sol";
import {Multisig} from "@aragon/multisig-plugin/Multisig.sol"; // path follows your installed dependency
contract DeployWithMultisig is Test {
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS"));
PluginRepo multisigRepo = PluginRepo(vm.envAddress("MULTISIG_PLUGIN_REPO_ADDRESS"));
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
}
}
```
## Step 2, describe the DAO and the plugin install
A DAO created *with* plugins takes a `PluginSettings[]`: each entry names a plugin version (its [repo](/framework/plugin-repo.md) + a `(release, build)` tag) and the **install data** the plugin's [setup](/framework/plugin-setup.md) expects. Multisig's `MultisigSetup` decodes its data as `(address[] members, MultisigSettings, TargetConfig, bytes metadata)`:
```solidity
function test_deployWithMultisig() public {
// Who is on the multisig, and its rule (2-of-3, members only).
address[] memory members = new address[](3);
members[0] = address(0xA11CE);
members[1] = address(0xB0B);
members[2] = address(0xCa201);
Multisig.MultisigSettings memory settings =
Multisig.MultisigSettings({onlyListed: true, minApprovals: 2});
// Where the plugin executes. target == address(0) is the sentinel for "my own DAO":
// at runtime the plugin resolves it to TargetConfig(dao(), Call). This is what lets you
// install in the same tx that creates the DAO, the DAO address doesn't exist yet here.
IPlugin.TargetConfig memory targetConfig =
IPlugin.TargetConfig({target: address(0), operation: IPlugin.Operation.Call});
bytes memory installData = abi.encode(members, settings, targetConfig, bytes(""));
// Point at the plugin version to install.
PluginRepo.Tag memory versionTag = PluginRepo.Tag({release: 1, build: 3});
DAOFactory.PluginSettings[] memory pluginSettings = new DAOFactory.PluginSettings[](1);
pluginSettings[0] = DAOFactory.PluginSettings({
pluginSetupRef: PluginSetupRef({versionTag: versionTag, pluginSetupRepo: multisigRepo}),
data: installData
});
// ... createDao in Step 3 (same function)
}
```
The `installData` layout is dictated by the plugin's setup, not by OSx; every plugin publishes the ABI for its `data` in its build metadata. Get it wrong and `prepareInstallation` reverts on `abi.decode`.
## Step 3, create the DAO with the plugin
Continue the same function. `createDao` returns the DAO and the installed plugin(s):
```solidity
DAOFactory.DAOSettings memory daoSettings = DAOFactory.DAOSettings({
trustedForwarder: address(0),
daoURI: "",
subdomain: "",
metadata: ""
});
(DAO dao, DAOFactory.InstalledPlugin[] memory installed) =
factory.createDao(daoSettings, pluginSettings);
address multisig = installed[0].plugin;
```
The factory ran the [temporary-ROOT sequence](/framework/dao-factory.md#the-permission-choreography-why-order-matters): it prepared and applied the multisig setup, whose permission list [granted the plugin `EXECUTE_PERMISSION_ID` on the DAO](/plugins/multisig-plugin.md#permissions-it-sets-up). Because you passed a plugin, the factory did **not** grant you `EXECUTE`.
## Step 4, verify governance is in control
Confirm the plugin can make the DAO act and you cannot:
```solidity
bytes32 EXECUTE = dao.EXECUTE_PERMISSION_ID();
assertTrue(dao.hasPermission(address(dao), multisig, EXECUTE, "")); // the plugin can
assertFalse(dao.hasPermission(address(dao), address(this), EXECUTE, "")); // you cannot
}
```
The DAO now acts only when a multisig [proposal](/common/proposal.md) passes and calls [`dao.execute`](/core/execution.md). No EOA holds execution authority, and the DAO holds ROOT over itself, so changing those permissions is also a governance decision.
## What you just saw
- Specify the plugin's **version + install data**, and the [factory](/framework/dao-factory.md) prepares and applies its installation, including the temporary ROOT grants.
- The setup configures the permissions: here, `EXECUTE` goes to the plugin. See [multisig's setup](/plugins/multisig-plugin.md#permissions-it-sets-up).
- `TargetConfig.target = address(0)` means "my own DAO", which makes same-transaction installation possible.
## Next
- [Launch a governance token with your DAO](/guides/launch-a-governance-token.md), the same flow with **Token Voting**, whose install data also specifies the token choice.
- [Create, vote, and execute a proposal](/guides/create-vote-execute.md), now drive the multisig you just installed.
- Installing **admin** instead is the same shape with simpler data (a single admin address); installing into an *already-running* DAO is [Install a plugin](/guides/install-a-plugin.md).
# Launch a governance token with your DAO
Install [Token Voting](/plugins/token-voting-plugin.md) with your DAO so *token holders* make its decisions. [Deploy your first DAO](/guides/deploy-a-dao.md) installed a multisig with a fixed member set; the mechanics of `createDao` are identical here, but you also supply **the token**. Token Voting requires an [`IVotes` token](/plugins/token-voting-plugin/voting-power.md) with checkpointed, delegatable balances. Its setup gives you three ways to supply one in a single installation.
## What you need
The one-time [Setup](/guides/setup.md), with the **token voting** plugin's remapping enabled. This guide reads the **`DAOFactory`** and **Token Voting `PluginRepo`** (`TOKEN_VOTING_PLUGIN_REPO_ADDRESS`) addresses.
## The token decision
`TokenVotingSetup` looks at the `addr` you pass in its `TokenSettings` and selects one of three paths. The [governance token](/plugins/token-voting-plugin/governance-tokens.md) choice determines the install data:
| `tokenSettings.addr` | What the setup does |
|---|---|
| `address(0)` | **Mints a new `GovernanceERC20`** from the `name`/`symbol` and `mintSettings` you provide. |
| an existing **`IVotes`** token | **Reuses it as-is** (no deployment). |
| a plain ERC-20 (not `IVotes`) | **Wraps it** in a `GovernanceWrappedERC20`; holders lock the original to get voting power. |
The setup duck-types the token (it *probes* for `IVotes`, it doesn't trust a flag), and it rejects a non-contract or non-ERC-20 address. This guide takes the first path, minting a fresh token.
> **Voting power requires delegation.** With any `IVotes` token, a holder has **zero** voting power until their balance is *delegated*, even to themselves; see [voting power](/plugins/token-voting-plugin/voting-power.md#delegation). When you mint a new token, set `ensureDelegationOnMint: true` so recipients can vote without a separate delegation step. Otherwise, token holders still need to delegate before they can vote.
The token records historical voting power because reading current balances would let a holder vote, transfer their tokens, and vote again from another address. Every proposal instead uses the checkpoint just before it was created. Minting or delegating afterward cannot add power to that proposal, even if voting is scheduled to start later. With automatic delegation disabled, recipients must delegate before that checkpoint themselves.
## Step 1, the skeleton
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol";
import {PluginSetupRef} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol";
import {IPlugin} from "@aragon/osx/common/plugin/IPlugin.sol";
// The next three come from the token-voting plugin package (path follows your dependency):
import {MajorityVotingBase} from "@aragon/token-voting-plugin/base/MajorityVotingBase.sol";
import {TokenVotingSetup} from "@aragon/token-voting-plugin/TokenVotingSetup.sol";
import {GovernanceERC20} from "@aragon/token-voting-plugin/erc20/GovernanceERC20.sol";
contract DeployWithTokenVoting is Test {
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS"));
PluginRepo tokenVotingRepo = PluginRepo(vm.envAddress("TOKEN_VOTING_PLUGIN_REPO_ADDRESS"));
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
}
}
```
## Step 2, describe the token
Mint a new token to two holders. `addr = address(0)` selects the "mint new" path; `mintSettings` lists who gets how much:
```solidity
function test_deployWithTokenVoting() public {
// Path 1: mint a fresh GovernanceERC20 (addr == 0 uses name/symbol + mintSettings).
TokenVotingSetup.TokenSettings memory tokenSettings =
TokenVotingSetup.TokenSettings({addr: address(0), name: "Acme Vote", symbol: "ACME"});
address[] memory receivers = new address[](2);
receivers[0] = address(0xA11CE);
receivers[1] = address(0xB0B);
uint256[] memory amounts = new uint256[](2);
amounts[0] = 100e18;
amounts[1] = 100e18;
GovernanceERC20.MintSettings memory mintSettings = GovernanceERC20.MintSettings({
receivers: receivers,
amounts: amounts,
ensureDelegationOnMint: true // so holders can vote without delegating first
});
// ... voting rules + createDao in Step 3 (same function)
}
```
To **reuse** an existing `IVotes` token instead, set `addr` to it and leave `name`/`symbol`/`mintSettings` empty. To **wrap** a plain ERC-20, set `addr` to it (the `name`/`symbol` name the wrapper).
## Step 3, set the rules and deploy
The rest of the install data is the [voting configuration](/plugins/majority-voting.md) (thresholds are ratios out of `1_000_000`), plus the same `target: address(0)` [own-DAO sentinel](/guides/deploy-a-dao.md) used for multisig. To encode the seven fields, resolve the setup from the repo version and call its typed **`encodeInstallationParameters(...)`** function. This avoids a positional `abi.encode` that can break silently if a field moves. Not every setup provides this [encoder](/guides/build-a-plugin.md): Token Voting's does, while multisig's does not.
```solidity
MajorityVotingBase.VotingSettings memory votingSettings = MajorityVotingBase.VotingSettings({
votingMode: MajorityVotingBase.VotingMode.Standard, // see /plugins/voting-modes.md
supportThreshold: 500_000, // > 50% of yes+no (ratio out of 1e6)
minParticipation: 100_000, // >= 10% of total voting power must vote
minDuration: 7 days,
minProposerVotingPower: 0 // any holder may propose
});
IPlugin.TargetConfig memory targetConfig =
IPlugin.TargetConfig({target: address(0), operation: IPlugin.Operation.Call});
address[] memory excludedAccounts = new address[](0); // subtracted from total voting power (e.g. the treasury); none here
// Resolve the setup for the version we install, then let it encode the 7 fields in the right order.
PluginRepo.Tag memory versionTag = PluginRepo.Tag({release: 1, build: 4}); // pick the current build from the repo
TokenVotingSetup setup = TokenVotingSetup(tokenVotingRepo.getVersion(versionTag).pluginSetup);
bytes memory installData = setup.encodeInstallationParameters(
votingSettings,
tokenSettings,
mintSettings,
targetConfig,
uint256(0), // minApprovals: a fourth ratio (min share of total voting power that must vote yes, out of 1e6); 0 disables it
bytes(""), // plugin metadata
excludedAccounts
);
DAOFactory.PluginSettings[] memory pluginSettings = new DAOFactory.PluginSettings[](1);
pluginSettings[0] = DAOFactory.PluginSettings({
pluginSetupRef: PluginSetupRef({versionTag: versionTag, pluginSetupRepo: tokenVotingRepo}),
data: installData
});
DAOFactory.DAOSettings memory daoSettings =
DAOFactory.DAOSettings({trustedForwarder: address(0), daoURI: "", subdomain: "", metadata: ""});
(DAO dao, DAOFactory.InstalledPlugin[] memory installed) =
factory.createDao(daoSettings, pluginSettings);
// The plugin governs the DAO; the fresh token was deployed as a setup helper.
address tokenVoting = installed[0].plugin;
assertTrue(dao.hasPermission(address(dao), tokenVoting, dao.EXECUTE_PERMISSION_ID(), ""));
}
```
The encoder's arguments match this build's [setup ABI](/abi/token-voting-plugin/TokenVotingSetup.md#encodeinstallationparameters), keeping the field order and types aligned with what `prepareInstallation` decodes. If you encode the bytes manually, follow the selected build's setup and metadata: an incorrect order or type can make installation revert or decode unintended values. Check those definitions when adapting to another version.
## What you just saw
- The installation follows the same steps as any plugin; only the `data` differs. Here it carries the token choice and the voting rules.
- One install decision, `tokenSettings.addr`, picks between minting, reusing, and wrapping a token, [governance tokens](/plugins/token-voting-plugin/governance-tokens.md).
- `ensureDelegationOnMint: true` delegates on mint so holders have voting power. The token is deployed as a helper of the setup, owned by the DAO.
## Next
- [Create, vote, and execute a proposal](/guides/create-vote-execute.md), now run a token vote on the DAO you just launched.
- Governing with an existing token instead? The [reuse and wrap paths](/plugins/token-voting-plugin/governance-tokens.md) are the same call with a different `addr`.
# Import an existing token
If your community already has an ERC-20, you can use it to govern an OSx DAO with [Token Voting](/plugins/token-voting-plugin.md). The first decision is whether the token can supply voting power directly or holders will need to wrap it. This guide explains that choice, installs the plugin with your token, and prepares a holder to vote.
## Why a token balance is not enough
Using current balances would let a holder vote, transfer the tokens to another address, and vote again with the same tokens. Token Voting prevents this by reading **historical voting power** at a snapshot just before each proposal is created. Moving tokens afterward cannot give a second account power over that proposal.
Your token therefore needs to record voting checkpoints. OpenZeppelin's `ERC20Votes` implements this through the `IVotes` interface; equivalent implementations can also work. If your token lacks those functions, a **wrapper** can add them: holders deposit the original token and receive a voting token backed one-for-one by that deposit. The original token contract remains in place. See [governance tokens](/plugins/token-voting-plugin/governance-tokens.md) for how the two token types work.
## 1. Check whether the token can be used directly
The plugin's setup contract checks the token before installing it. It requires a token contract whose `balanceOf` call returns a `uint256`, then probes three voting functions:
| Function | Purpose |
|---|---|
| `getVotes(account)` | Current delegated voting power |
| `getPastVotes(account, timepoint)` | An account's historical voting power |
| `getPastTotalSupply(timepoint)` | Historical total supply |
Call `setup.supportsIVotesInterface(existingToken)` on the setup for your chosen plugin version to check whether the voting-function probes pass. The installation example below resolves that setup from its versioned repository. ERC-165 support is not required. Passing the probes confirms the functions are callable; also verify that the token maintains voting checkpoints.
A compatible token is reused directly. A valid ERC-20 that fails the voting probes is wrapped as `GovernanceWrappedERC20`. This guide targets Token Voting release 1, build 4, which supports block-number and timestamp-based tokens. Timestamp tokens must report a consistent [ERC-6372 clock](/plugins/token-voting-plugin/voting-power.md#block-based-vs-timestamp-based-tokens); a clock mismatch reverts installation rather than selecting a wrapper.
### If your token already supports voting
You can keep the existing token, distribution, and holders. Importing connects Token Voting to that contract; it neither mints an initial allocation nor gives the DAO minting rights over your token. Existing delegation stays in place. Check that each intended voting address has power; depending on the token's behavior, holders may need to [delegate before participating](#3-prepare-holders-to-vote).
### If your token needs wrapping
Wrapping lets you keep the original token, but changes how holders participate. They approve the wrapper, deposit tokens, and vote using the wrapped balance's delegated power. They can recover the underlying tokens by burning the wrapped tokens through `withdrawTo`.
That introduces extra transactions and a second token balance to explain to holders. Deposited underlying tokens are unavailable for trading, staking, or other uses until withdrawn. This DAO's quorum is calculated from **wrapped supply**, subject to any [excluded accounts](/plugins/token-voting-plugin/voting-power.md#whose-supply-counts-excluded-accounts), rather than the original token's entire supply. Holding the original token alone does not give someone votes in this installation.
Discuss that experience with your team and community before installing: will holders be willing and able to deposit, and does governance based on wrapped supply fit your intended participation model? If your token was only recently deployed, weigh that ongoing friction against issuing a token with voting support built in. A replacement also needs an explicit plan for existing holders and balances; importing does not migrate them automatically. The [new-token guide](/guides/launch-a-governance-token.md) covers issuing a token if you choose that route.
If you are still designing a token to deploy independently, include `ERC20Votes` or compatible historical voting support from the start to avoid needing a wrapper later. Once you have chosen direct reuse or wrapping, continue below.
## 2. Supply the existing token in the installation data
The following fork test creates a **new DAO governed by your existing token**. The setup selects direct reuse or wrapping based on the token's compatibility. For an existing DAO, the same encoded installation data goes through [Install a plugin into a live DAO](/guides/install-a-plugin.md) instead of `createDao`.
Complete the project and network steps in [Setup](/guides/setup.md). For this guide's Token Voting dependency, use these pinned packages and remappings. This build still uses the standalone commons package:
```sh
forge install aragon/osx-commons@869045b069679fad94d640a8a3e1a1b5538cf0f0
forge install aragon/token-voting-plugin@e97b783d76872d694f41dfc4bc846405019ca741
echo '@aragon/osx-commons-contracts/=lib/osx-commons/contracts/' >> remappings.txt
echo '@aragon/token-voting-plugin/=lib/token-voting-plugin/src/' >> remappings.txt
```
Keep the plugin's [pinned dependency remappings](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/remappings.txt) for its other imports. Select a network where both your token and Token Voting release 1, build 4 are deployed. The example uses `RPC_URL`, `DAO_FACTORY_ADDRESS`, and `TOKEN_VOTING_PLUGIN_REPO_ADDRESS` from Setup, plus `EXISTING_TOKEN_ADDRESS` for your token.
Set `TokenSettings.addr` to the existing address. The name and symbol below are used only if setup deploys a wrapper; they do not rename an imported token. Leave `MintSettings` empty because this path does not mint a new token allocation.
The example's [voting thresholds](/plugins/majority-voting.md) use ratios out of `1_000_000`; choose them for your community before a live installation. `target: address(0)` selects the new DAO as the execution target. The typed [setup encoder](/abi/token-voting-plugin/TokenVotingSetup.md#encodeinstallationparameters) keeps the parameter order and types aligned with this build.
Save this fixture as `test/fork-tests/ImportExistingToken.t.sol`, then add the holder test in the next section inside the contract:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol";
import {PluginSetupRef} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol";
import {IPlugin} from "@aragon/osx-commons-contracts/src/plugin/IPlugin.sol";
import {TokenVoting} from "@aragon/token-voting-plugin/TokenVoting.sol";
import {TokenVotingSetup} from "@aragon/token-voting-plugin/TokenVotingSetup.sol";
import {MajorityVotingBase} from "@aragon/token-voting-plugin/base/MajorityVotingBase.sol";
import {GovernanceERC20} from "@aragon/token-voting-plugin/erc20/GovernanceERC20.sol";
import {GovernanceWrappedERC20} from "@aragon/token-voting-plugin/erc20/GovernanceWrappedERC20.sol";
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
contract ImportExistingToken is Test {
DAO dao;
TokenVoting voting;
address existingToken;
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
existingToken = vm.envAddress("EXISTING_TOKEN_ADDRESS");
assertGt(existingToken.code.length, 0, "Expected an existing token contract");
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS"));
PluginRepo repo = PluginRepo(vm.envAddress("TOKEN_VOTING_PLUGIN_REPO_ADDRESS"));
PluginRepo.Tag memory tag = PluginRepo.Tag({release: 1, build: 4});
TokenVotingSetup setup = TokenVotingSetup(repo.getVersion(tag).pluginSetup);
bool reuseToken = setup.supportsIVotesInterface(existingToken);
TokenVotingSetup.TokenSettings memory tokenSettings = TokenVotingSetup.TokenSettings({
addr: existingToken,
name: "Wrapped Community Token",
symbol: "wCOMM"
});
GovernanceERC20.MintSettings memory mintSettings = GovernanceERC20.MintSettings({
receivers: new address[](0),
amounts: new uint256[](0),
ensureDelegationOnMint: false
});
MajorityVotingBase.VotingSettings memory votingSettings = MajorityVotingBase.VotingSettings({
votingMode: MajorityVotingBase.VotingMode.Standard,
supportThreshold: 500_000, // More than 50% of Yes + No power must be Yes.
minParticipation: 100_000, // At least 10% of total voting power must participate.
minDuration: 7 days,
minProposerVotingPower: 0 // Anyone may propose, including non-holders.
});
IPlugin.TargetConfig memory targetConfig =
IPlugin.TargetConfig({target: address(0), operation: IPlugin.Operation.Call});
bytes memory installData = setup.encodeInstallationParameters(
votingSettings,
tokenSettings,
mintSettings,
targetConfig,
uint256(0), // No additional minimum Yes share of total power.
bytes(""), // Plugin metadata.
new address[](0) // No accounts excluded from the voting-power denominator.
);
DAOFactory.PluginSettings[] memory plugins = new DAOFactory.PluginSettings[](1);
plugins[0] = DAOFactory.PluginSettings({
pluginSetupRef: PluginSetupRef({versionTag: tag, pluginSetupRepo: repo}),
data: installData
});
DAOFactory.DAOSettings memory settings =
DAOFactory.DAOSettings({trustedForwarder: address(0), daoURI: "", subdomain: "", metadata: ""});
DAOFactory.InstalledPlugin[] memory installed;
(dao, installed) = factory.createDao(settings, plugins);
voting = TokenVoting(installed[0].plugin);
assertEq(address(voting.getVotingToken()) == existingToken, reuseToken);
assertTrue(dao.hasPermission(address(dao), address(voting), dao.EXECUTE_PERMISSION_ID(), ""));
}
// Add test_prepareHolder from the next section here.
}
```
After installation, `voting.getVotingToken()` identifies the token holders will vote with: the original address on the reuse path, or the new wrapper address. The fixture checks that result and the plugin's permission to execute DAO actions. A fresh wrapper starts with no deposited voting supply; installing it does not wrap holders' balances for them.
## 3. Prepare holders to vote
Voting power belongs to the address a holder [delegates to](/plugins/token-voting-plugin/voting-power.md#delegation). A holder can delegate to themselves to vote directly, or to another address to vote on their behalf. Delegation does not transfer token ownership. Even a long-held balance may have no voting power until it is delegated.
Add this test inside `ImportExistingToken`. Set `TOKEN_HOLDER` to an address holding the original token on the fork. If wrapping is needed, also set `WRAP_AMOUNT` to a positive amount within that balance, in the underlying token's smallest units. The test prepares a holder who chooses to vote for themselves; `vm.prank` simulates their transactions on the fork.
```solidity
function test_prepareHolder() public {
address votingToken = address(voting.getVotingToken());
address holder = vm.envAddress("TOKEN_HOLDER");
if (votingToken != existingToken) {
uint256 amount = vm.envUint("WRAP_AMOUNT");
vm.startPrank(holder);
IERC20Upgradeable(existingToken).approve(votingToken, amount);
GovernanceWrappedERC20(votingToken).depositFor(holder, amount);
vm.stopPrank();
}
// This holder chooses self-delegation for either token path.
vm.startPrank(holder);
voting.getVotingToken().delegate(holder);
vm.stopPrank();
assertGt(voting.getVotingToken().getVotes(holder), 0);
// Continue here with the snapshot check in Step 4.
}
```
The wrapper automatically self-delegates on receipt if the recipient has no existing delegate; it preserves an existing delegation otherwise. The explicit `delegate(holder)` above makes this test deterministic and intentionally replaces any prior choice. In your holder flow, preserve the person's choice: a holder who delegates elsewhere should check that delegate's voting power instead.
Holders can later call `withdrawTo(holder, amount)` on the wrapper to recover their underlying tokens. Withdrawal changes future voting power, but does not erase the power recorded for an existing proposal's snapshot.
## 4. Wait for the voting power to enter the snapshot
The holder now has current voting power. To use it on a proposal, it must exist at that proposal's earlier snapshot. A token balance held for months does not help if its delegation, or its deposit into a wrapper, happens too late.
Finish holder preparation **before creating the proposal**, not merely before voting opens. A scheduled future start does not move the snapshot. For block-based tokens, deposits and delegation must precede the creation block; for timestamp-based tokens, they must precede its timestamp.
Add this after the power assertion inside `test_prepareHolder`, before its closing brace. It advances the token's clock and checks that the holder has power at the snapshot a proposal created now would use:
```solidity
if (voting.tokenIndexedByTimestamp()) {
vm.warp(block.timestamp + 1);
} else {
vm.roll(block.number + 1);
}
uint256 snapshot = voting.tokenIndexedByTimestamp() ? block.timestamp - 1 : block.number - 1;
assertGt(voting.getVotingToken().getPastVotes(holder, snapshot), 0);
```
Run the assembled fixture with `just test-fork --match-contract ImportExistingToken`, using the environment configured in [Setup](/guides/setup.md). Onchain, holders submit their own transactions and wait for the appropriate block or timestamp before anyone creates the proposal.
The import and holder-preparation steps are now complete. Continue with [Create, vote, and execute](/guides/create-vote-execute.md#token-voting-decide-by-weight): add its `IMajorityVoting` import, and import `Action` from `@aragon/osx-commons-contracts/src/executors/IExecutor.sol` to match this Token Voting build. Use `voting` where that example uses `tokenVoting`, and replace `alice` and `bob` with accounts you have prepared to vote. Prepare all participating holders before advancing the clock. The deployed addresses and prepared balances exist only in this fork; append the proposal calls to the same test after the snapshot check.
If a holder cannot vote, check their chosen delegate, `getPastVotes(voter, proposalSnapshot)`, and whether the proposal is open. Current `getVotes` alone does not establish eligibility for an older proposal. Having one eligible holder also does not guarantee the proposal can pass: its [participation and approval thresholds](/plugins/majority-voting.md) still need enough power to turn out.
# Create, vote, and execute a proposal
After [deploying a DAO with a plugin](/guides/deploy-a-dao.md), create, approve, and execute a proposal to make the DAO act. A DAO runs actions when a caller holding [`EXECUTE_PERMISSION_ID`](/guides/deploy-a-dao.md) calls its [`execute`](/core/execution.md#the-execute-function). The usual and recommended caller is a governance plugin enacting a [**proposal**](/common/proposal.md): a bundle of [actions](/core/execution.md) put up for a decision and, if it passes, run on the DAO. The [Admin plugin](/plugins/admin-plugin.md) can execute without a vote; the examples below use multisig approval and token voting. Governance plugins share the **same lifecycle**, differing in how the decision is made:
```
createProposal(...) -> id // package the actions
...the plugin decides... // approve (multisig) or vote (token voting)
execute(id) // once it passes, run the actions on the DAO
```
`execute` on the plugin is what finally calls [`dao.execute`](/core/execution.md), and it works because the plugin holds [`EXECUTE_PERMISSION_ID` on the DAO](/guides/deploy-a-dao.md) (granted at install). Both plugins below also grant `EXECUTE_PROPOSAL_PERMISSION_ID` to **anyone**, so once a proposal passes, *any* address can trigger execution. Whether it's *passed* ([`hasSucceeded`](/common/proposal.md)) is separate from whether it's *executable now* (`canExecute`, which also weighs timing).
Both examples assume the plugin is already installed (from [Deploy your first DAO](/guides/deploy-a-dao.md) / [Launch a governance token](/guides/launch-a-governance-token.md)). The demo action has the DAO update its own metadata. You can replace it with any action the DAO is allowed to perform.
## The skeleton
Both functions below are methods of one test contract that holds the installed plugin handles and the members/voters:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {Action} from "@aragon/osx/common/executors/IExecutor.sol";
import {Multisig} from "@aragon/multisig-plugin/Multisig.sol";
import {TokenVoting} from "@aragon/token-voting-plugin/TokenVoting.sol";
import {IMajorityVoting} from "@aragon/token-voting-plugin/base/IMajorityVoting.sol";
contract Proposals is Test {
DAO dao;
Multisig multisig; // installed per "Deploy your first DAO"
TokenVoting tokenVoting; // installed per "Launch a governance token"
address alice = address(0xA11CE); // a member / delegated voter
address bob = address(0xB0B);
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
dao = DAO(payable(vm.envAddress("DAO")));
multisig = Multisig(vm.envAddress("MULTISIG"));
tokenVoting = TokenVoting(vm.envAddress("TOKEN_VOTING"));
}
// ... the two functions below live here
}
```
## Multisig: approve to a threshold
A [multisig](/plugins/multisig-plugin.md) proposal passes when `minApprovals` members approve. With the 2-of-3 from the deploy guide, one member creates and approves the proposal. A second approves with `_tryExecution` to run it in that same call:
```solidity
function test_multisigProposal() public {
Multisig ms = multisig; // the 2-of-3 from "Deploy your first DAO"; alice/bob/carol are members
Action[] memory actions = new Action[](1);
actions[0] = Action({
to: address(dao),
value: 0,
data: abi.encodeCall(DAO.setMetadata, (bytes("ipfs://Qm...new")))
});
// Note the multisig arg order: (metadata, actions, allowFailureMap, approveProposal, tryExecution, start, end).
vm.prank(alice);
uint256 id = ms.createProposal(
"", actions, 0,
true, // alice approves as she creates (approval #1)
false, // don't try to execute yet (threshold not met)
uint64(block.timestamp),
uint64(block.timestamp + 7 days)
);
// Second approval reaches minApprovals (2); _tryExecution runs it immediately.
vm.prank(bob);
ms.approve(id, true);
assertFalse(ms.canExecute(id)); // already executed, so no longer executable
}
```
`approve(id, false)` followed by a separate `execute(id)` is the two-step equivalent; `_tryExecution` combines the last approval with execution. Only *listed* members may approve; see [membership & eligibility](/plugins/multisig-plugin/membership.md) for who counts and when.
## Token Voting: decide by weight
A [token vote](/plugins/token-voting-plugin.md) uses delegated voting power at a fixed [snapshot](/plugins/token-voting-plugin/voting-power.md#the-snapshot). The snapshot is taken just before proposal creation: the previous block for block-based tokens, or the previous second for timestamp-based tokens. Scheduling voting to start later does not move that snapshot.
**Snapshots prevent double voting with the same tokens.** Suppose Alice has 100 self-delegated tokens at the snapshot and Bob has none. Alice votes, then transfers those 100 tokens to Bob. If the plugin used current balances, Bob could vote with the same tokens again. Instead, it reads their historical power: Alice has 100 and Bob has zero for this proposal. Delegating that power to another address after the snapshot cannot duplicate it either. Token Voting does not lock the tokens; the snapshot fixes which accounts can use their voting power on this proposal.
Holding tokens alone is not sufficient. Holders [delegate](/plugins/token-voting-plugin/voting-power.md#delegation) to themselves to vote directly, or to another address to vote on their behalf. An undelegated balance gives its holder no voting power. Complete delegation and allow the token's clock to advance before creating the proposal. The [launch guide](/guides/launch-a-governance-token.md) enables self-delegation on mint; [imported and wrapped tokens](/guides/import-existing-tokens.md#3-prepare-holders-to-vote) have their own delegation behavior. The example below assumes Alice and Bob both have power at the snapshot.
Votes use `VoteOption` (`Abstain`, `Yes`, or `No`); `None` lets a creator submit without an initial vote:
```solidity
function test_tokenVote() public {
TokenVoting tv = tokenVoting; // the plugin from "Launch a governance token"
Action[] memory actions = new Action[](1);
actions[0] = Action({
to: address(dao),
value: 0,
data: abi.encodeCall(DAO.setMetadata, (bytes("ipfs://Qm...new")))
});
// Token-voting arg order differs: (metadata, actions, allowFailureMap, start, end, voteOption, tryEarlyExecution).
vm.prank(alice);
uint256 id = tv.createProposal(
"", actions, 0,
uint64(block.timestamp),
uint64(block.timestamp + 7 days),
IMajorityVoting.VoteOption.None, // create without voting yet
false
);
vm.prank(alice);
tv.vote(id, IMajorityVoting.VoteOption.Yes, false);
vm.prank(bob);
tv.vote(id, IMajorityVoting.VoteOption.Yes, false);
// Standard mode: the vote must run its full duration before it can execute.
vm.warp(block.timestamp + 7 days + 1);
tv.execute(id);
}
```
In **Standard** mode, the vote runs the full duration even once the outcome is decided. **Early Execution** mode lets a passed proposal execute immediately through `_tryEarlyExecution` / `vote(id, Yes, true)`; see [voting modes](/plugins/voting-modes.md). Whether a proposal passed depends on the support and participation [thresholds](/plugins/majority-voting.md).
## What you just saw
- One lifecycle, **create → decide → execute**; only the "decide" step changes between plugins.
- `execute` runs the proposal's actions *as the DAO*, because the plugin holds `EXECUTE` on the DAO; anyone can trigger it once the proposal passes.
- "Passed" ([`hasSucceeded`](/common/proposal.md)) and "executable now" (`canExecute`) are different questions; `canExecute` also checks timing.
## Next
- [Manage permissions through governance](/guides/manage-permissions.md), the proposal's actions can grant/revoke permissions, letting the DAO re-wire its own authority.
- [Install a plugin into a live DAO](/guides/install-a-plugin.md), add governance to a DAO after launch.
# Manage permissions through governance
A DAO owns its own [permission database](/core/permissions.md), so changing who may do what is itself an action the DAO performs on itself. A DAO that [holds `ROOT` over itself](/core/dao.md#deployment-and-bootstrapping-root) can call `dao.grant(...)` through a passed proposal: the action runs *as the DAO*, which is its own permission admin. Here you'll grant a permission, gate one with a [condition](/common/permission-conditions.md) you write, and rotate that condition safely.
`grant`, `revoke`, and `grantWithCondition` are all `auth(ROOT_PERMISSION_ID)`, so they only work when called by (or as) the ROOT holder, which is the DAO itself.
## Step 1, the skeleton
This test uses a **bare DAO** where you hold `EXECUTE` (as in [the hands-on tour](/guides/hands-on-tour.md)), so you can `dao.execute` the permission-change actions directly and see the effect. On a governed DAO, these exact actions go inside a [proposal](/guides/create-vote-execute.md). Either way, they run as the DAO.
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {PermissionManager} from "@aragon/osx/core/permission/PermissionManager.sol";
import {Action} from "@aragon/osx/common/executors/IExecutor.sol";
import {IPermissionCondition} from "@aragon/osx/common/permission/condition/IPermissionCondition.sol";
contract ManagePermissions is Test {
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS"));
DAO dao;
address alice = address(0xA11CE);
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
DAOFactory.DAOSettings memory s = DAOFactory.DAOSettings(address(0), "", "", "");
DAOFactory.PluginSettings[] memory none = new DAOFactory.PluginSettings[](0);
(dao, ) = factory.createDao(s, none); // bare DAO: this test holds EXECUTE
}
}
```
## Step 2, grant a permission
Have the DAO grant Alice the right to set its metadata. The action targets the DAO's own `grant`:
```solidity
function test_grant() public {
bytes32 SET_METADATA = dao.SET_METADATA_PERMISSION_ID();
Action[] memory actions = new Action[](1);
actions[0] = Action({
to: address(dao),
value: 0,
data: abi.encodeCall(PermissionManager.grant, (address(dao), alice, SET_METADATA))
});
dao.execute(bytes32(0), actions, 0);
assertTrue(dao.hasPermission(address(dao), alice, SET_METADATA, ""));
}
```
The grant reads `(where = dao, who = alice, permissionId = SET_METADATA)`, see the [permission triple](/core/permissions.md). It works because the action executes as the DAO, which holds `ROOT`. `revoke` is the mirror image with the same three arguments.
## Step 3, write a custom condition
A plain grant is a static "yes". A [condition](/common/permission-conditions.md) makes it a *dynamic* yes: the permission system calls your contract at decision time. Inherit `PermissionCondition` (it supplies the ERC-165 wiring `grantWithCondition` checks for) and implement `isGranted`. Here, a permission that only holds until a deadline:
```solidity
import {PermissionCondition} from "@aragon/osx/common/permission/condition/PermissionCondition.sol";
contract OnlyBeforeDeadline is PermissionCondition {
uint256 public immutable deadline;
constructor(uint256 _deadline) {
deadline = _deadline;
}
function isGranted(address /*where*/, address /*who*/, bytes32 /*permissionId*/, bytes calldata /*data*/)
external
view
returns (bool)
{
return block.timestamp <= deadline;
}
}
```
A condition [fails closed](/common/permission-conditions.md): a revert or invalid return counts as "denied". Its `data` argument is the *full calldata* of the gated call, so a condition can decode and check the arguments. For boolean combinations of standard checks (time, block, sub-conditions), [`RuledCondition`](/common/ruled-condition.md) expresses them as data, often avoiding bespoke code. The [condition library](/helpers/condition-library.md) also supplies ready-made conditions.
## Step 4, gate a permission, then rotate the condition safely
Attach the condition with `grantWithCondition`. A plain `grant` over an already-*conditional* permission is a [silent no-op](/core/permissions.md): it will **not** strip the condition. Conditions are immutable once set, so changing one requires `revoke` followed by re-grant. Do both in **one batch**; otherwise, the permission is denied between the two transactions:
```solidity
function test_conditionAndRotate() public {
bytes32 SET_METADATA = dao.SET_METADATA_PERMISSION_ID();
// Gate Alice's permission with a condition.
IPermissionCondition cond = new OnlyBeforeDeadline(block.timestamp + 30 days);
Action[] memory gate = new Action[](1);
gate[0] = Action({to: address(dao), value: 0,
data: abi.encodeCall(PermissionManager.grantWithCondition,
(address(dao), alice, SET_METADATA, cond))});
dao.execute(bytes32(0), gate, 0);
// Rotate to a new condition: revoke + re-grant in ONE proposal, never two.
IPermissionCondition cond2 = new OnlyBeforeDeadline(block.timestamp + 90 days);
Action[] memory rotate = new Action[](2);
rotate[0] = Action({to: address(dao), value: 0,
data: abi.encodeCall(PermissionManager.revoke, (address(dao), alice, SET_METADATA))});
rotate[1] = Action({to: address(dao), value: 0,
data: abi.encodeCall(PermissionManager.grantWithCondition,
(address(dao), alice, SET_METADATA, cond2))});
dao.execute(bytes32(0), rotate, 0);
// Alice still holds the permission, now under the new condition (evaluated live, before the deadline).
assertTrue(dao.hasPermission(address(dao), alice, SET_METADATA, ""));
}
```
Batching the `revoke` and re-`grant` into one atomic [execute](/core/execution.md) prevents a period between transactions when the permission is denied. On a governed DAO, put both in the *same* proposal.
## What you just saw
- Changing authority is an ordinary DAO action, gated by `ROOT`, which the DAO holds over itself. Governance can therefore change the DAO's own rules.
- A [condition](/common/permission-conditions.md) is a small contract you attach at grant time; it fails closed and can inspect the call's arguments.
- Rotate a condition with `revoke` + `grantWithCondition` in **one batch**. A plain re-grant can't strip a condition, and two transactions leave a period when the permission is denied.
## Next
- [Install a plugin into a live DAO](/guides/install-a-plugin.md), the permission changes required to add governance after launch.
- [Build a plugin](/guides/build-a-plugin.md), whose `PluginSetup` returns exactly these grant/revoke operations for the installer to apply.
# Install a plugin into a live DAO
Install a plugin into a DAO that's **already running** through the [PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md): **prepare** permissionlessly, then **apply** through a governed proposal that grants temporary ROOT for one PSP call. In [Deploy your first DAO](/guides/deploy-a-dao.md), the factory handled permissions *at creation*. Adding plugins later is more common, and **governance** coordinates the permission changes in place of the factory.
The split is the safety property: whoever *computes* an installation isn't who *authorizes* it. Prepare touches nothing; apply is what the DAO approves. See [why prepare and apply are separate](/framework/plugin-setup-processor.md#why-prepare-and-apply-are-separate).
## What you need
The one-time [Setup](/guides/setup.md), with the **multisig** plugin's remapping enabled. This guide reads the **`DAOFactory`**, **`PluginSetupProcessor`** (`PLUGIN_SETUP_PROCESSOR_ADDRESS`), and **Multisig `PluginRepo`** addresses.
## Step 1, the skeleton
As in [manage permissions](/guides/manage-permissions.md), the test uses a bare DAO where you hold `EXECUTE`, so you can `dao.execute` the apply batch directly; on a governed DAO those same actions are a [proposal](/guides/create-vote-execute.md).
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol";
import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol";
import {PluginSetupProcessor} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessor.sol";
import {PluginSetupRef, hashHelpers} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol";
import {PermissionManager} from "@aragon/osx/core/permission/PermissionManager.sol";
import {IPluginSetup} from "@aragon/osx/common/plugin/setup/IPluginSetup.sol";
import {Action} from "@aragon/osx/common/executors/IExecutor.sol";
import {IPlugin} from "@aragon/osx/common/plugin/IPlugin.sol";
import {Multisig} from "@aragon/multisig-plugin/Multisig.sol";
contract InstallPlugin is Test {
DAOFactory factory = DAOFactory(vm.envAddress("DAO_FACTORY_ADDRESS"));
PluginSetupProcessor psp = PluginSetupProcessor(vm.envAddress("PLUGIN_SETUP_PROCESSOR_ADDRESS"));
PluginRepo multisigRepo = PluginRepo(vm.envAddress("MULTISIG_PLUGIN_REPO_ADDRESS"));
DAO dao;
function setUp() public {
vm.createSelectFork(vm.envString("RPC_URL"));
DAOFactory.DAOSettings memory s = DAOFactory.DAOSettings(address(0), "", "", "");
DAOFactory.PluginSettings[] memory none = new DAOFactory.PluginSettings[](0);
(dao, ) = factory.createDao(s, none); // bare DAO: this test holds EXECUTE
}
}
```
## Step 2, prepare (permissionless)
Anyone may call `prepareInstallation`. It runs the plugin's [setup](/framework/plugin-setup.md), deploying the plugin and any helpers and returning the **exact permissions** the install wants, without touching the DAO. Here we prepare the same multisig as the deploy guide:
```solidity
function test_installMultisig() public {
// Multisig install data (see "Deploy your first DAO").
address[] memory members = new address[](3);
members[0] = address(0xA11CE); members[1] = address(0xB0B); members[2] = address(0xCa201);
Multisig.MultisigSettings memory settings = Multisig.MultisigSettings({onlyListed: true, minApprovals: 2});
IPlugin.TargetConfig memory targetConfig =
IPlugin.TargetConfig({target: address(0), operation: IPlugin.Operation.Call});
bytes memory data = abi.encode(members, settings, targetConfig, bytes(""));
PluginSetupRef memory ref = PluginSetupRef({
versionTag: PluginRepo.Tag({release: 1, build: 3}),
pluginSetupRepo: multisigRepo
});
// Prepare: deploys the plugin + helpers, returns the requested permissions. Nothing on the DAO changes yet.
(address plugin, IPluginSetup.PreparedSetupData memory prepared) =
psp.prepareInstallation(address(dao), PluginSetupProcessor.PrepareInstallationParams(ref, data));
// ... apply in Step 3 (same function)
}
```
A `…Prepared` event is **not** an installation. A griefer can prepare repeatedly and change nothing. See [preparing is cheap and permissionless](/framework/plugin-setup-processor.md#keep-in-mind).
## Step 3, apply (governed, inside a temporary-ROOT window)
Applying grants the permissions, so the PSP needs `ROOT` on the DAO for the duration, and no longer. The proposal has **three actions**: grant ROOT, apply, revoke ROOT. You must apply *exactly* what was prepared: the same `plugin`, `permissions`, and a hash of the `helpers`. A [setup-id check](/framework/plugin-setup-processor.md#setup-ids-what-keeps-apply-honest) enforces this match.
```solidity
bytes32 ROOT = dao.ROOT_PERMISSION_ID();
PluginSetupProcessor.ApplyInstallationParams memory applyParams = PluginSetupProcessor.ApplyInstallationParams({
pluginSetupRef: ref,
plugin: plugin,
permissions: prepared.permissions,
helpersHash: hashHelpers(prepared.helpers)
});
Action[] memory actions = new Action[](3);
// 1. Grant the PSP ROOT on the DAO (so it can apply the plugin's permission changes).
actions[0] = Action(address(dao), 0,
abi.encodeCall(PermissionManager.grant, (address(dao), address(psp), ROOT)));
// 2. Apply: the PSP grants the plugin its permissions (incl. EXECUTE on the DAO).
actions[1] = Action(address(psp), 0,
abi.encodeCall(PluginSetupProcessor.applyInstallation, (address(dao), applyParams)));
// 3. Close the window: revoke the PSP's ROOT.
actions[2] = Action(address(dao), 0,
abi.encodeCall(PermissionManager.revoke, (address(dao), address(psp), ROOT)));
dao.execute(bytes32(0), actions, 0);
// The multisig now governs the DAO.
assertTrue(dao.hasPermission(address(dao), plugin, dao.EXECUTE_PERMISSION_ID(), ""));
}
```
The DAO needs no `APPLY_INSTALLATION_PERMISSION`. `applyInstallation` runs *as the DAO* (`msg.sender == dao`), which the PSP's `canApply` check accepts directly. That permission is required only for a caller *other than* the DAO. The [DAOFactory grants it to itself](/framework/dao-factory.md#the-permission-choreography-why-order-matters) because the factory calls the PSP, so it needs an extra grant that a self-executing proposal doesn't. The temporary-ROOT window is otherwise the same and remains atomic: if any step reverts, the whole install rolls back and the PSP never keeps ROOT.
## What you just saw
- **Prepare** is permissionless and mutates nothing; **apply** is the governed step, and the only thing that changes the DAO.
- Apply runs inside a **temporary-ROOT window** the same batch opens and closes, [never leave the PSP with ROOT](/framework/plugin-setup-processor.md#keep-in-mind).
- You apply *exactly* what was prepared (`plugin` + `permissions` + `hashHelpers(helpers)`); the [setup-id binding](/framework/plugin-setup-processor.md#setup-ids-what-keeps-apply-honest) rejects anything else.
## Next
- [Update a plugin](/guides/update-a-plugin.md), the same prepare/apply sequence for moving an installed plugin to a new version.
- [Build a plugin](/guides/build-a-plugin.md), write the `PluginSetup` whose prepared permissions this flow applies.
# Update a plugin
Move an installed plugin to a newer version through the **same prepare → governed apply** sequence as [installation](/guides/install-a-plugin.md). Updates are **release-locked**, with a **metadata-only fast path** that skips the ROOT window entirely. Uninstalling uses the corresponding sequence to revoke permissions.
Start with an installed plugin (see [Install a plugin](/guides/install-a-plugin.md)) and its `plugin`, `dao`, and original `currentHelpers` from `preparedSetupData.helpers`. The test holds `EXECUTE` on a bare DAO so it can `dao.execute` the apply batch directly.
## Step 1, prepare the update (release-locked)
`prepareUpdate` is permissionless like `prepareInstallation`, but it enforces the [versioning rule](/framework/plugin-repo.md#release-vs-build): the **release must stay the same and the build must strictly increase**, or it reverts `InvalidUpdateVersion`. Crossing a release is an incompatible change that an existing instance cannot adopt through an update. You must **install a fresh instance**, a new contract with its own address and empty state, and uninstall the old one. That is an [uninstall + reinstall](/framework/plugin-setup-processor.md#the-three-lifecycles), not an in-place update.
```solidity
function test_update() public {
PluginRepo.Tag memory currentTag = PluginRepo.Tag({release: 1, build: 3});
PluginRepo.Tag memory newTag = PluginRepo.Tag({release: 1, build: 4}); // same release, higher build
IPluginSetup.SetupPayload memory payload = IPluginSetup.SetupPayload({
plugin: plugin,
currentHelpers: currentHelpers, // exactly what the last setup returned, in order
data: bytes("") // update input the new build's setup expects (often empty)
});
(bytes memory initData, IPluginSetup.PreparedSetupData memory prepared) =
psp.prepareUpdate(address(dao), PluginSetupProcessor.PrepareUpdateParams({
currentVersionTag: currentTag,
newVersionTag: newTag,
pluginSetupRepo: repo,
setupPayload: payload
}));
// ... apply in Step 2 (same function)
}
```
`currentHelpers` must be passed in the **exact order** the previous setup returned them, or the [applied-setup-id check](/framework/plugin-setup-processor.md#setup-ids-what-keeps-apply-honest) fails.
## Step 2, apply the update (governed, temporary-ROOT window)
Use the [install apply window](/guides/install-a-plugin.md#step-3-apply-governed-inside-a-temporary-root-window) with an additional grant. `applyUpdate` performs the **UUPS proxy upgrade** using `initData` from prepare. That upgrade requires `UPGRADE_PLUGIN_PERMISSION` on the *plugin*, which **`ROOT` does not confer** ([`isGranted`](/core/permissions.md) has no ROOT bypass). For an implementation-changing update, the PSP therefore needs **two** temporary grants: `ROOT` on the DAO for the permission diff and `UPGRADE_PLUGIN_PERMISSION` on the plugin for the upgrade. As with install, no `APPLY_UPDATE_PERMISSION` is needed because the DAO calls the PSP itself:
```solidity
bytes32 ROOT = dao.ROOT_PERMISSION_ID();
bytes32 UPGRADE_PLUGIN = keccak256("UPGRADE_PLUGIN_PERMISSION"); // PluginUUPSUpgradeable.UPGRADE_PLUGIN_PERMISSION_ID
PluginSetupProcessor.ApplyUpdateParams memory applyParams = PluginSetupProcessor.ApplyUpdateParams({
plugin: plugin,
pluginSetupRef: PluginSetupRef({versionTag: newTag, pluginSetupRepo: repo}),
initData: initData,
permissions: prepared.permissions,
helpersHash: hashHelpers(prepared.helpers)
});
Action[] memory actions = new Action[](5);
// Open the window: PSP needs ROOT (permission diff) AND UPGRADE on the plugin (the proxy upgrade).
actions[0] = Action(address(dao), 0, abi.encodeCall(PermissionManager.grant, (address(dao), address(psp), ROOT)));
actions[1] = Action(address(dao), 0, abi.encodeCall(PermissionManager.grant, (plugin, address(psp), UPGRADE_PLUGIN)));
actions[2] = Action(address(psp), 0, abi.encodeCall(PluginSetupProcessor.applyUpdate, (address(dao), applyParams)));
// Close it: revoke both.
actions[3] = Action(address(dao), 0, abi.encodeCall(PermissionManager.revoke, (plugin, address(psp), UPGRADE_PLUGIN)));
actions[4] = Action(address(dao), 0, abi.encodeCall(PermissionManager.revoke, (address(dao), address(psp), ROOT)));
dao.execute(bytes32(0), actions, 0);
}
```
The `UPGRADE_PLUGIN_PERMISSION` grant distinguishes update from install: `applyInstallation` only *deploys*, it never upgrades a proxy, so it needs `ROOT` alone. Some plugin setups grant the PSP a *standing* upgrade permission at install; then only ROOT needs a temporary grant. Granting upgrade permission per-update, as here, works in either case.
## The metadata-only shortcut
If a new build changes **only** the off-chain [metadata](/framework/plugin-metadata.md) (docs, the params schema) and reuses the *same setup contract*, so the implementation address is unchanged, the update touches no permissions and no code. `prepareUpdate` returns an empty permission set, and `applyUpdate` then skips both the proxy upgrade and the permission apply. Self-executed by the DAO it needs **no** temporary grants at all (no ROOT, no upgrade permission); handed to a keeper it needs only `APPLY_UPDATE_PERMISSION_ID`. Either way it's the cheapest lifecycle step.
## Uninstalling: the mirror
Uninstalling follows the same sequence. `prepareUninstallation` returns the permissions to **revoke** (not grant), and `applyUninstallation` runs in the same governed window (with `APPLY_UNINSTALLATION_PERMISSION_ID`):
```solidity
function test_uninstall() public {
PluginSetupRef memory ref =
PluginSetupRef({versionTag: PluginRepo.Tag({release: 1, build: 4}), pluginSetupRepo: repo});
IPluginSetup.SetupPayload memory payload =
IPluginSetup.SetupPayload({plugin: plugin, currentHelpers: currentHelpers, data: bytes("")});
// Prepare (permissionless): returns the permissions to REVOKE, the mirror of install's grants.
PermissionLib.MultiTargetPermission[] memory toRevoke =
psp.prepareUninstallation(address(dao), PluginSetupProcessor.PrepareUninstallationParams(ref, payload));
PluginSetupProcessor.ApplyUninstallationParams memory applyParams =
PluginSetupProcessor.ApplyUninstallationParams({plugin: plugin, pluginSetupRef: ref, permissions: toRevoke});
// Apply in a temporary-ROOT window. Simpler than update: uninstall only revokes permissions,
// there's no proxy upgrade (no UPGRADE grant) and, self-executed by the DAO, no APPLY_UNINSTALLATION_PERMISSION.
bytes32 ROOT = dao.ROOT_PERMISSION_ID();
Action[] memory actions = new Action[](3);
actions[0] = Action(address(dao), 0, abi.encodeCall(PermissionManager.grant, (address(dao), address(psp), ROOT)));
actions[1] = Action(address(psp), 0, abi.encodeCall(PluginSetupProcessor.applyUninstallation, (address(dao), applyParams)));
actions[2] = Action(address(dao), 0, abi.encodeCall(PermissionManager.revoke, (address(dao), address(psp), ROOT)));
dao.execute(bytes32(0), actions, 0);
// The plugin can no longer make the DAO act.
assertFalse(dao.hasPermission(address(dao), plugin, dao.EXECUTE_PERMISSION_ID(), ""));
}
```
After it applies, the plugin's applied-setup id is cleared, so the same plugin *could* later be reinstalled fresh.
## What you just saw
- Update is prepare → apply like install, but **release-locked**: same release, strictly higher build (`InvalidUpdateVersion` otherwise). Its apply does the UUPS upgrade, which needs the PSP to hold `UPGRADE_PLUGIN_PERMISSION` on the plugin, **`ROOT` alone doesn't authorize the upgrade**.
- A **metadata-only** update changes nothing onchain, so it skips the ROOT window and needs only `APPLY_UPDATE`.
- **Uninstall** is the same window with the setup's *revoke* list; a cross-release migration is uninstall + reinstall (a **fresh instance** with a new address, not the old one upgraded).
## Next
- [Build a plugin](/guides/build-a-plugin.md), write the `PluginSetup` (and its `prepareUpdate`) that all of this drives.
- [Publish a plugin to a PluginRepo](/guides/publish-a-plugin.md), cut the new build this update installs.
# Build a plugin
Build a plugin as **two artifacts**: the **plugin contract**, containing your logic gated by [permissions](/core/permissions.md), and its **[`PluginSetup`](/framework/plugin-setup.md)**, which deploys the plugin and declares exactly which permissions to grant on install and revoke on uninstall. The [PSP applies](/guides/install-a-plugin.md) the setup in the temporary-ROOT window. A correct setup lets the framework install, update, and uninstall your plugin consistently.
Start from the [Foundry plugin template](/tooling/plugin-template.md) (the [Setup](/guides/setup.md) scaffold): it gives you starter contracts for all three [base types](/framework/plugin-types.md) (`MyStaticPlugin`, `MyCloneablePlugin`, `MyUpgradeablePlugin`), a `MyPluginSetup`, tests, and deploy scripts. This guide uses the **UUPS-upgradeable** variant. (Imports below are the template's.)
## Step 1, the plugin contract
Inherit [`PluginUUPSUpgradeable`](/framework/plugin-types.md) (it gives you `dao()`, the `auth` modifier, and UUPS upgrade authorization), initialize with `__PluginUUPSUpgradeable_init(_dao)`, declare your permission ids, and gate privileged functions with `auth`:
```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;
import {DAO, IDAO, Action} from "@aragon/osx/core/dao/DAO.sol";
import {PluginUUPSUpgradeable} from "@aragon/osx/common/plugin/PluginUUPSUpgradeable.sol";
contract MyUpgradeablePlugin is PluginUUPSUpgradeable {
bytes32 public constant MANAGER_PERMISSION_ID = keccak256("MANAGER_PERMISSION");
uint256 public number; // added in build 1
function initialize(IDAO _dao, uint256 _initialNumber) external initializer {
__PluginUUPSUpgradeable_init(_dao);
number = _initialNumber;
}
/// Caller must hold MANAGER_PERMISSION_ID *on this plugin*, resolved against the DAO.
function setNumber(uint256 _number) external auth(MANAGER_PERMISSION_ID) {
number = _number;
}
/// Make the DAO act. Requires the plugin to hold EXECUTE_PERMISSION_ID on the DAO.
function resetDaoMetadata() external {
Action[] memory actions = new Action[](1);
actions[0].to = address(dao());
actions[0].data = abi.encodeCall(IDAO.setMetadata, (""));
DAO(payable(address(dao()))).execute(bytes32(block.timestamp), actions, 0);
}
uint256[49] private __gap; // storage gap for safe upgrades
}
```
`auth(MANAGER_PERMISSION_ID)` asks the DAO whether the caller holds this permission on *this plugin*, rather than checking a local list (the [plugin is the `where`](/common/auth.md)). A plugin makes the DAO act by building [actions](/core/execution.md) and calling `dao.execute`. This requires the plugin to hold `EXECUTE_PERMISSION_ID` on the DAO, granted by the setup below. The `__gap` preserves storage layout across [upgrades](/framework/plugin-types.md).
## Step 2, the PluginSetup
The setup deploys the plugin and returns the **exact permissions** the install needs. `prepareInstallation` decodes its install `data`, deploys the proxy, and lists the grants; `prepareUninstallation` lists the matching revokes. This is the ABI and the permission set that [Deploy your first DAO](/guides/deploy-a-dao.md) and [Install a plugin](/guides/install-a-plugin.md) feed to the PSP:
```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;
import {IDAO, DAO} from "@aragon/osx/core/dao/DAO.sol";
import {PluginSetup} from "@aragon/osx/common/plugin/setup/PluginSetup.sol";
import {IPluginSetup} from "@aragon/osx/common/plugin/setup/IPluginSetup.sol";
import {PermissionLib} from "@aragon/osx/common/permission/PermissionLib.sol";
import {ProxyLib} from "@aragon/osx/common/utils/deployment/ProxyLib.sol";
import {MyUpgradeablePlugin} from "../MyUpgradeablePlugin.sol";
contract MyPluginSetup is PluginSetup {
constructor() PluginSetup(address(new MyUpgradeablePlugin())) {} // the implementation to clone/proxy
function prepareInstallation(address _dao, bytes memory _data)
external
returns (address plugin, PreparedSetupData memory preparedSetupData)
{
(address manager, uint256 initialNumber) = abi.decode(_data, (address, uint256));
plugin = ProxyLib.deployUUPSProxy(
implementation(),
abi.encodeCall(MyUpgradeablePlugin.initialize, (IDAO(_dao), initialNumber))
);
PermissionLib.MultiTargetPermission[] memory permissions = new PermissionLib.MultiTargetPermission[](2);
// 1) The manager may call setNumber on the plugin.
permissions[0] = PermissionLib.MultiTargetPermission({
operation: PermissionLib.Operation.Grant,
where: plugin,
who: manager,
condition: PermissionLib.NO_CONDITION,
permissionId: MyUpgradeablePlugin(implementation()).MANAGER_PERMISSION_ID()
});
// 2) The plugin may make the DAO execute.
permissions[1] = PermissionLib.MultiTargetPermission({
operation: PermissionLib.Operation.Grant,
where: _dao,
who: plugin,
condition: PermissionLib.NO_CONDITION,
permissionId: DAO(payable(_dao)).EXECUTE_PERMISSION_ID()
});
preparedSetupData.permissions = permissions;
}
function prepareUninstallation(address _dao, SetupPayload calldata _payload)
external
view
returns (PermissionLib.MultiTargetPermission[] memory permissions)
{
address manager = abi.decode(_payload.data, (address));
permissions = new PermissionLib.MultiTargetPermission[](2);
permissions[0] = PermissionLib.MultiTargetPermission({
operation: PermissionLib.Operation.Revoke, where: _payload.plugin, who: manager,
condition: PermissionLib.NO_CONDITION,
permissionId: MyUpgradeablePlugin(implementation()).MANAGER_PERMISSION_ID()
});
permissions[1] = PermissionLib.MultiTargetPermission({
operation: PermissionLib.Operation.Revoke, where: _dao, who: _payload.plugin,
condition: PermissionLib.NO_CONDITION, permissionId: DAO(payable(_dao)).EXECUTE_PERMISSION_ID()
});
}
}
```
The install `data` layout (`(address manager, uint256 initialNumber)` here) is your plugin's public contract with installers. Publish it in the build [metadata](/framework/plugin-metadata.md), and expose a typed `encodeInstallationParameters` / `decodeInstallationParameters` pair on your setup so callers don't have to assemble bytes by hand ([shown below](#typed-install-data)). The [permission system](/core/permissions.md) enforces two rules on this array: a **conditional** grant must use `Operation.GrantWithCondition` (a plain `Grant` carrying a non-zero condition reverts), and uninstall should revoke what install granted so no permissions remain.
## Typed install data
The install `data` is positional `abi.encode`d bytes. A wrong field order or type makes `prepareInstallation` revert on `abi.decode` or silently misconfigure the plugin. Publish the ABI *as code*: a matched pair of `pure` helpers on your setup. Route `prepareInstallation` through the decoder to keep it consistent with the encoder. The [Token Voting setup](/plugins/token-voting-plugin.md) provides this pair:
```solidity
// Add to MyPluginSetup:
function encodeInstallationParameters(address manager, uint256 initialNumber)
external pure returns (bytes memory)
{
return abi.encode(manager, initialNumber);
}
function decodeInstallationParameters(bytes memory _data)
public pure returns (address manager, uint256 initialNumber)
{
(manager, initialNumber) = abi.decode(_data, (address, uint256));
}
```
Then `prepareInstallation` decodes through the pair instead of a raw `abi.decode`:
```solidity
(address manager, uint256 initialNumber) = decodeInstallationParameters(_data);
```
The setup now defines the layout. Installers build their `data` with `setup.encodeInstallationParameters(manager, n)` rather than assembling `abi.encode` arguments themselves, as [Launch a governance token](/guides/launch-a-governance-token.md) does against the Token Voting setup. Keep both helpers consistent with the build [metadata](/framework/plugin-metadata.md) ABI: they describe the same layout and must change together.
## What you just saw
- A plugin is your **logic + a setup**; the setup, not the plugin contract, configures permissions.
- `auth` defers to the DAO (the plugin is the `where`); to make the DAO act, the setup grants the plugin `EXECUTE` on the DAO.
- `prepareUninstallation` mirrors `prepareInstallation`'s grants as revokes. For an **updatable** plugin, extend [`PluginUpgradeableSetup`](/framework/plugin-setup.md) and add `prepareUpdate` (see [Update a plugin](/guides/update-a-plugin.md)).
- **Publish typed install params.** Add an `encodeInstallationParameters`/`decodeInstallationParameters` pair to your setup so installers don't have to assemble `data` by hand. The Token Voting setup and the [launch guide](/guides/launch-a-governance-token.md) use this pattern.
## Next
- [Publish a plugin to a PluginRepo](/guides/publish-a-plugin.md), turn this setup into an installable, versioned release.
- [Write a custom condition](/guides/manage-permissions.md) if your plugin's permissions need dynamic rules.
# Publish a plugin to a PluginRepo
After [building a plugin and its setup](/guides/build-a-plugin.md), **publish** it to a [PluginRepo](/framework/plugin-repo.md). This lets the [PSP](/framework/plugin-setup-processor.md) install, update, and uninstall a published version, applying the setup's permissions atomically. A DAO can instead deploy a plugin and grant its permissions directly through governance. Publishing is the recommended path because it provides versioning, setup checks, and a defined uninstall procedure.
A PluginRepo is a versioned registry for **one** plugin: every entry is a `PluginSetup` address plus its [metadata](/framework/plugin-metadata.md), tagged with a `(release, build)`. That tag is what [Deploy your first DAO](/guides/deploy-a-dao.md) and [Install a plugin](/guides/install-a-plugin.md) reference. You'll create the repo with a first version, then publish later versions.
## What you need
The one-time [Setup](/guides/setup.md), plus:
- The **`PluginRepoFactory`** address (`PLUGIN_REPO_FACTORY_ADDRESS`).
- Your compiled `MyPluginSetup` (from [Build a plugin](/guides/build-a-plugin.md)).
- Two [metadata](/framework/plugin-metadata.md) blobs on IPFS (a **build** JSON documenting your install-data ABI, and a **release** JSON); you pass their `ipfs://…` pointers, not the JSON.
## Step 1, create the repo and its first version
`PluginRepoFactory.createPluginRepoWithFirstVersion` deploys the repo, registers its ENS **subdomain** in the [PluginRepoRegistry](/framework/plugin-repo-registry.md), and publishes version **(release 1, build 1)**, i.e. `1.1`, in one call. It also grants your `maintainer` the repo permissions: `MAINTAINER_PERMISSION` for future publishing, plus repo-upgrade and root rights over the repo.
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {Test} from "forge-std/Test.sol";
import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol";
import {PluginRepoFactory} from "@aragon/osx/framework/plugin/repo/PluginRepoFactory.sol";
import {MyPluginSetup} from "../src/setup/MyPluginSetup.sol";
contract PublishPlugin is Test {
PluginRepoFactory repoFactory = PluginRepoFactory(vm.envAddress("PLUGIN_REPO_FACTORY_ADDRESS"));
function test_publish() public {
vm.createSelectFork(vm.envString("RPC_URL"));
address pluginSetup = address(new MyPluginSetup()); // your setup = one repo version
address maintainer = address(this);
PluginRepo repo = repoFactory.createPluginRepoWithFirstVersion({
_subdomain: "my-plugin", // unique ENS label; a-z, 0-9, '-'
_pluginSetup: pluginSetup,
_maintainer: maintainer, // receives MAINTAINER_PERMISSION on the repo
_releaseMetadata: bytes("ipfs://"),
_buildMetadata: bytes("ipfs://")
});
// repo now holds version 1.1; any DAO can install it by (repo, tag {release:1, build:1}).
}
}
```
The subdomain must be unique and lowercase (the [registry charset](/framework/registries.md)); if it's taken, the call reverts. The factory also verifies that your `pluginSetup` implements the setup interface and rejects a non-setup address.
## Step 2, publish later versions
Once the repo exists, the maintainer cuts new versions with `createVersion`. You choose the **release**; the repo assigns the **build** number itself (you don't pass it):
```solidity
// A new BUILD: a backward-compatible change. Same release, the repo bumps the build to 1.2, 1.3, ...
repo.createVersion({
_release: 1,
_pluginSetup: address(new MyPluginSetupV2()),
_buildMetadata: bytes("ipfs://"),
_releaseMetadata: bytes("") // unchanged on a pure build
});
// A new RELEASE: an incompatible change. _release must be exactly latestRelease + 1; build restarts at 1.
repo.createVersion({
_release: 2,
_pluginSetup: address(new MyPluginSetupV2()),
_buildMetadata: bytes("ipfs://"),
_releaseMetadata: bytes("ipfs://")
});
```
`createVersion` is `auth(MAINTAINER_PERMISSION_ID)`, so only the maintainer (or whoever they grant it to) can publish. A **release** must increment by exactly one (`InvalidReleaseIncrement` otherwise), and the [release-vs-build distinction](/framework/plugin-repo.md#release-vs-build) is the contract you make with installers: a new **build** is an in-place [update](/guides/update-a-plugin.md); a new **release** signals incompatibility, so moving to it is an uninstall + reinstall.
## What you just saw
- A PluginRepo is a **versioned registry for one plugin**; a version is a `PluginSetup` + metadata at a `(release, build)` tag.
- `createPluginRepoWithFirstVersion` bootstraps the repo, its ENS name, version `1.1`, and the maintainer permission in one call.
- **Build** = compatible (installs as an update); **release** = incompatible (increment by one; reinstall). The repo assigns build numbers; you pick releases.
## Next
- [Update a plugin](/guides/update-a-plugin.md), how a DAO moves to the new build you just published.
- Back to the [guides index](/guides/index.md) for the full path, or the concept graph starting at [the plugin framework](/framework/index.md).
# Compose a Capital Tree flow
Build a new flow by combining registered budgets, actions and splitters in a recipe: the component choices, settings, connections and permissions used to install the flow. If the components already provide the behavior you need, only their settings and connections change.
For example, the [swap, retain and donate flow](/plugins/capital-tree/concepts.md#example-swap-retain-and-donate) combines [`StreamBudget@1`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol), [`OpenFillAction@1`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol), [`WeightSplitter@1`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol), [`KeepAction@1`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/KeepAction.sol) and [`VaultDonateAction@1`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/VaultDonateAction.sol). Its recipe puts Open Fill at node 0, with Keep and Vault Donate as children, and attaches the splitter to node 0. Weights of 200,000 and 800,000 assign 20% to retention and 80% to donation; [`forwardSurplus`](/plugins/capital-tree/execution.md#inputs-and-outputs) makes that split apply to all received tokens.
## Build a custom recipe
The following function body builds the overview's flow from registered components. It belongs in a recipe builder using [`CapitalTreePluginSetup`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/setup/CapitalTreePluginSetup.sol) as `Setup` and the existing [`Recipes`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) library. The setup defines `InstallParams` (the whole recipe), `RecipeNode` (one node declaration) and `Grant` (a permission recipient and ID). `manager`, `guardian`, `stream`, `swap` and `vault` are its inputs; `stream` and `swap` use the library's `Stream` and `Swap` structs.
```solidity
Setup.InstallParams memory recipe = Recipes.buyAndBurn(manager, guardian, stream, swap);
// Keep the stream, Open Fill declaration and management grants.
Setup.RecipeNode memory swapNode = recipe.nodes[0];
recipe.nodes = new Setup.RecipeNode[](3);
recipe.nodes[0] = swapNode;
recipe.nodes[0].children = new uint32[](2);
recipe.nodes[0].children[0] = 1;
recipe.nodes[0].children[1] = 2;
uint32[] memory weights = new uint32[](2);
weights[0] = 200_000;
weights[1] = 800_000;
recipe.nodes[0].splitter.id = bytes32("WeightSplitter@1");
recipe.nodes[0].splitter.settings = abi.encode(weights);
recipe.nodes[0].splitter.permissions = new Setup.Grant[](0);
recipe.nodes[0].forwardSurplus = true;
recipe.nodes[1].action.id = bytes32("KeepAction@1");
recipe.nodes[2].action.id = bytes32("VaultDonateAction@1");
recipe.nodes[2].action.settings = abi.encode(vault);
bytes memory installationData = abi.encode(recipe);
```
The splitter has no delegated manager in this example; add a `SET_SETTINGS_PERMISSION_ID` grant if its weights should be adjustable. The inherited stream and Open Fill grants remain. Pass `installationData` to preparation. Setup looks up each ID in the registry and creates a separate instance with the supplied settings.
The repository's [`Install.s.sol`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Install.s.sol) selects named recipes. To use this composition, connect your builder to its preparation step; adding a new recipe name to JSON alone is insufficient.
Composition must respect each component's dependencies and the [tree rules](/plugins/capital-tree/execution.md#tree-validation). For behavior the existing components cannot express, implement a compatible component and have the registry maintainer register it under a new ID. It can then participate in recipes through the same setup interface. Each declaration still creates a fresh clone with its own state.
Next, follow [Setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to review and apply the prepared installation.
## Component initialization and permissions
Component **settings** are ABI-encoded configuration. **Dependencies** are component addresses supplied by setup: `[budget]` for actions and an empty array for budgets and splitters. Every declaration uses [`IComponent`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/IComponent.sol); [`IDAO`](/core/dao.md) represents the installing `DAO.sol` contract:
```solidity
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
interface IComponent {
struct Permission {
/// @notice Target contract.
address where;
/// @notice Authorized caller.
address who;
bytes32 permissionId;
}
/// @notice Binds the component to the DAO.sol contract and applies its settings.
/// @dev Called once on a fresh clone.
/// @param deps Setup supplies [budget] for actions, empty otherwise.
/// @param settings ABI-encoded component configuration.
function initialize(IDAO dao, address[] calldata deps, bytes calldata settings) external;
/// @notice Declares operational grants; recipe grants separately choose managers.
/// @dev Setup supplies the installing contract, new plugin and flow budget.
function requiredPermissions(address dao, address plugin, address budget)
external view returns (Permission[] memory);
}
```
Setup initializes each clone once, then combines `requiredPermissions` with the recipe's `(who, permissionId)` grants. Later setting changes use authorized setters. An absent action or splitter uses ID zero with empty settings and permissions.
## Clone addresses
Before approving, verify three things in the proposal's `applyInstallation` call:
1. **The plugin.** It equals `pluginAddress(dao, abi.encode(recipe), index)` on the setup contract. Different recipes produce different addresses, so the address commits to the configuration.
2. **The setup reference.** Its `pluginSetupRef` names the official Capital Tree PluginRepo. Anyone can publish a repo whose setup wraps the official one and adds grants.
3. **The permission list.** `keccak256(abi.encode(permissions))` equals `permissionsHash(plugin)` on the setup contract, so the proposal grants exactly what the official setup prepared.
The index counts every preparation of that recipe for that `DAO.sol` contract, by any caller: the first uses 0 and each later one increments it. Take the plugin and its index from the processor's `InstallationPrepared` event of your own preparation rather than assuming 0. A proposal built for an index that someone else's preparation used reverts when it executes.
## Registry and replacement
The registry's managing `DAO.sol` contract appoints its maintainer by granting `REGISTER_PERMISSION_ID`. That managing contract is selected at [registry deployment](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Deploy.s.sol) through `MANAGEMENT_DAO_ADDRESS`, independently of the manager and guardian chosen by each client for its flow.
Registry entries are write-once: a new implementation needs a new ID. Governance can replace runtime components with `setFlow`, which checks [tree validity](/plugins/capital-tree/execution.md#tree-validation) but does not require registered clones. Review replacement code and state: a fresh budget loses earlier accounting, including claim history.
# Plugins
The **plugins** provide ready-made functionality a `DAO.sol` contract installs. The governance plugins below make decisions (propose → vote → execute). Each is its own repo and package built on the [common building blocks](/common/index.md) and installed through the [plugin framework](/framework/index.md), so governance plugins share the same [proposal](/common/proposal.md) shape, [membership](/common/membership.md) model, and install lifecycle. Understanding those shared parts helps when moving between plugins.
**Exact signatures:** the generated ABI reference, one per plugin repo, has every public function, event, error and constant with its NatSpec: [token voting](/abi/token-voting-plugin/index.md), [multisig](/abi/multisig-plugin/index.md), [admin](/abi/admin-plugin/index.md), [SPP](/abi/staged-proposal-processor-plugin/index.md), [lock to vote](/abi/lock-to-vote-plugin/index.md).
## Token Voting Plugin
Token-weighted "one token, one vote" governance:
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — the plugin overview, proposal lifecycle, and permissions. **Start here.**
- [Voting power](/plugins/token-voting-plugin/voting-power.md) — the token, the snapshot, delegation, and who may propose.
- [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md) — mint a new token, reuse an `IVotes` token, or wrap an existing ERC-20.
**The shared voting model** (the Token Voting Plugin builds on it; other voting plugins can reuse it):
- [Majority voting](/plugins/majority-voting.md) — the support / participation / approval thresholds and pass-fail math.
- [Voting modes](/plugins/voting-modes.md) — Standard vs Early Execution vs Vote Replacement.
## Multisig Plugin
Approval by a fixed member set: a proposal passes once `minApprovals` members approve:
- [Multisig Plugin](/plugins/multisig-plugin.md) — the approval model, proposal lifecycle, and permissions. **Start here.**
- [Membership & eligibility](/plugins/multisig-plugin/membership.md) — managing members, the `minApprovals` invariant, and the two-speed eligibility model.
## Admin Plugin
Direct execution by a single trusted address, no vote, no window, for bootstrapping and fully-controlled `DAO.sol` contracts:
- [Admin Plugin](/plugins/admin-plugin.md) — the zero-width proposal lifecycle, the centralization trade-off, and migrating away.
## Staged Proposal Processor (SPP)
Meta-governance: orchestrate other plugins into a multi-stage pipeline (e.g. multisig → token vote → admin):
- [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md) — the model, why to compose plugins, the rule condition, and setup. **Start here.**
- [Stages & bodies](/plugins/spp-plugin/stages-and-bodies.md) — the data model, and the approval / optimistic / timelock stage shapes.
- [Lifecycle & state machine](/plugins/spp-plugin/lifecycle.md) — how a proposal advances, the push/pull tally, cancel/edit.
- [Composing bodies](/plugins/spp-plugin/composing-bodies.md) — making a plugin (or an external Safe) usable as a stage body.
## Lock to Vote Plugin
Token-weighted voting where power comes from tokens you *lock* into escrow (custody), not from a balance snapshot:
- [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md) — lock-vs-snapshot, the voting model, and permissions. **Start here.**
- [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md) — the vault and its unlock rules.
## Capital Tree
Compose and run recurring, automated capital flows for buybacks, swaps, treasury operations and more:
- [Capital Tree](/plugins/capital-tree.md) — the overview and reading paths. **Start here.**
- [Concepts](/plugins/capital-tree/concepts.md) — how budgets, nodes, actions and splitters form a flow, with a worked example.
- [Budgets](/plugins/capital-tree/budgets/index.md) — how much capital is available: a balance, a stream or a claimable entitlement.
- [Actions](/plugins/capital-tree/actions/index.md) and [splitters](/plugins/capital-tree/splitters/index.md) — what happens to each allocation and how it branches.
- [Examples](/plugins/capital-tree/examples/index.md) — compose the pieces into buybacks, donations and distributions.
- [Setup and permissions](/plugins/capital-tree/setup.md) — install a flow and control who can run or change it.
## Where to start
New to the framework? Read [what a plugin is](/framework/plugins.md) and [how installation works](/framework/plugin-setup-processor.md) first, then any plugin here.
# Token Voting Plugin
The Token Voting Plugin is the "one token, one vote" governance [plugin](/framework/plugins.md), the most common way an OSx DAO governs itself. Members' influence is proportional to the governance tokens they hold (or that others delegate to them), and a proposal passes when it meets a configurable [majority-voting rule](/plugins/majority-voting.md). It also puts the protocol's [shared building blocks](/common/index.md) to work: it reuses the [proposal](/common/proposal.md), [membership](/common/membership.md), and [ratio](/common/ratio.md) primitives, adds token-based [voting power](/plugins/token-voting-plugin/voting-power.md), and is installed through the standard [framework](/framework/plugin-setup-processor.md).
Start with the lifecycle and permissions below, then follow these related topics:
- **This page** — what it is, the proposal lifecycle, and the permissions it sets up.
- [Voting power](/plugins/token-voting-plugin/voting-power.md) — where power comes from: the token, the snapshot, delegation, and who may propose.
- [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md) — mint a new token, reuse an `IVotes` token, or wrap an existing ERC-20.
- The shared voting model: [majority voting](/plugins/majority-voting.md) (the thresholds) and [voting modes](/plugins/voting-modes.md) (Standard / Early Execution / Vote Replacement).
## Why it needs a special token
The problem any token vote must solve is **double voting**: hold tokens, vote, transfer them to a fresh address, and vote again, counting the same tokens twice. The plugin prevents this by only accepting tokens that support historical, per-account snapshots (`IVotes` / `ERC20Votes`). Every proposal fixes a **snapshot block** at creation and weighs each vote by the holder's balance *at that block*, so moving tokens after a proposal opens changes nothing. For this requirement and its consequences (delegation, snapshots, wrapping a plain ERC-20), see [Voting power](/plugins/token-voting-plugin/voting-power.md).
## The proposal lifecycle
**Create.** A proposal records its snapshot block, freezes the voting settings and its [execution target](/framework/plugins.md#how-a-plugin-makes-the-dao-act) (where its approved actions are sent, normally the DAO), stores the [actions](/core/execution.md) to run if it passes, and its start and end dates (the end must be at least `minDuration` after the start). The creator may cast their vote in the same transaction ("propose and vote yes"). Who may create is gated, see [gating proposal creation](/plugins/token-voting-plugin/voting-power.md#who-may-propose).
**Vote.** Eligible holders call `vote` with `Yes`, `No`, or `Abstain`, weighted by their snapshot power. Whether a voter can later change their vote depends on the [voting mode](/plugins/voting-modes.md). A voter may also ask to execute in the same call (`tryEarlyExecution`) if the mode and thresholds allow and they hold execute permission.
**Execute.** Once the proposal has passed (all [thresholds](/plugins/majority-voting.md#the-three-thresholds) met, and the timing allowed by the mode), anyone with `EXECUTE_PROPOSAL_PERMISSION_ID` calls `execute`. The plugin hands the approved actions to the DAO (via [`execute`](/core/execution.md), which is why it holds `EXECUTE_PERMISSION_ID` on the DAO) and marks the proposal executed. A passed proposal stays executable until someone runs it; there's no expiry.
The DAO changes the voting mode, `supportThreshold`, `minParticipation`, `minDuration`, and `minProposerVotingPower` through `updateVotingSettings`, and `minApproval` through `updateMinApprovals`. Both methods require `UPDATE_VOTING_SETTINGS_PERMISSION_ID`, so changing governance rules is itself a governance decision. Changes apply to new proposals; existing proposals retain their recorded rules.
## Permissions it sets up
`TokenVotingSetup` wires these on install:
| Permission | On (where) | Granted to (who) | Condition | Gates |
|---|---|---|---|---|
| `EXECUTE_PERMISSION_ID` | DAO | plugin | none | the plugin calling `dao.execute` |
| `CREATE_PROPOSAL_PERMISSION_ID` | plugin | any address | `VotingPowerCondition` | `createProposal` |
| `EXECUTE_PROPOSAL_PERMISSION_ID` | plugin | any address | none | `execute` |
| `UPDATE_VOTING_SETTINGS_PERMISSION_ID` | plugin | DAO | none | `updateVotingSettings`, `updateMinApprovals` |
| `SET_TARGET_CONFIG_PERMISSION_ID` | plugin | DAO | none | `setTargetConfig` |
| `SET_METADATA_PERMISSION_ID` | plugin | DAO | none | `setMetadata` |
| `MINT_PERMISSION_ID` | governance token | DAO | none | `mint` (only when a new token is minted) |
The two `any address` grants are intentional: proposal creation is opened to everyone but narrowed by the [`VotingPowerCondition`](/plugins/token-voting-plugin/voting-power.md#who-may-propose) to holders above a minimum, and execution is opened to everyone because the [threshold math](/plugins/majority-voting.md) already decides *whether* a proposal may execute, letting anyone trigger it just stops a passed proposal getting stuck.
## Installing it
`TokenVotingSetup` handles installation without manual permission wiring. The [plugin setup](/framework/plugin-setup.md) deploys the plugin proxy, arranges the [governance token](/plugins/token-voting-plugin/governance-tokens.md), deploys the `VotingPowerCondition`, and returns the permission set above for the [PluginSetupProcessor](/framework/plugin-setup-processor.md) to apply. Its helpers are the condition and the token, so an update or uninstall can find them again. Choosing the token is the main decision in this step; see [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md).
## Keep in mind
- **Delegate, or you have no power.** Holding the token isn't enough; voting power is zero until delegated. The most common "why can't I vote?" is an undelegated balance. See [voting power](/plugins/token-voting-plugin/voting-power.md#delegation).
- **Power is fixed at the snapshot.** Acquiring or delegating more tokens after a proposal opens does nothing for that proposal.
- **Identical proposals collide.** The proposal id hashes the actions and metadata, so a byte-identical resubmission reverts; vary the metadata to resubmit.
## See also
- [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md) — token voting powered by *locked* tokens instead of a balance snapshot; the closest cousin, and an instructive contrast.
- [Multisig Plugin](/plugins/multisig-plugin.md) (approval by a fixed member set) and [Admin Plugin](/plugins/admin-plugin.md) (direct execution by one address), the non-token alternatives.
- [Majority voting](/plugins/majority-voting.md) and [Voting modes](/plugins/voting-modes.md) — the shared voting model this plugin builds on.
# Majority voting
Majority voting provides reusable decision rules for governance plugins (`MajorityVotingBase`): the rules that turn a set of Yes/No/Abstain votes into a pass or fail. It separates *how votes are decided* from *where voting power comes from*. The concrete plugin supplies the power source; for example, the [Token Voting Plugin](/plugins/token-voting-plugin.md) weights votes by token balance. Any voting plugin can build on it.
A proposal succeeds only if **three independent criteria all hold**, plus it ran for a minimum time. They're independent on purpose, each guards against a different failure of a naive "most votes win" rule.
## The three thresholds
Every voter casts `Yes`, `No`, or `Abstain`, weighted by their **voting power**. The plugin determines what provides that power (a token balance, locked tokens, a member list; the [Token Voting Plugin sources it from IVotes balances](/plugins/token-voting-plugin/voting-power.md)). All thresholds are expressed with the [`RATIO_BASE` convention](/common/ratio.md) (`1_000_000` = 100%) and are **frozen into the proposal at creation**. Later changes to the DAO's voting settings never affect proposals already open.
### Support — do most of the *decided* voters agree?
```
support = yes / (yes + no) must be > supportThreshold
```
**Abstain is deliberately excluded** from support. Support asks "of those who took a side, did enough say yes?" Abstaining means "I'm present but express no direction", counting it as opposition would let mass abstention block proposals nobody actually voted against. Onchain the check is done cross-multiplied to avoid division: `(RATIO_BASE - supportThreshold) * yes > supportThreshold * no`. The comparison is strict (`>`), so at a 50% threshold you need *at least one more* yes than no, and the threshold is capped just below 100% (a threshold of exactly 100% could never be met).
### Participation — did enough of the electorate show up?
```
participation = (yes + no + abstain) / totalVotingPower must be >= minParticipation
```
**Abstain *is* included** here, the opposite of support, and for a complementary reason: participation measures engagement, "did enough of the token supply weigh in at all?", regardless of direction. An abstain is still participation. This is the quorum guard: it stops a tiny, unrepresentative slice of the supply from deciding for everyone. (In practice the requirement is computed once at creation as an absolute amount, `minVotingPower`, by [rounding the percentage up](/common/ratio.md) against the snapshot's total supply.)
### Approval — did enough *yes* power turn out in absolute terms?
```
yes must be >= minApproval * totalVotingPower (rounded up)
```
An absolute floor on yes-power, independent of the yes/no split and of turnout. It defends against the case a high support ratio hides: a proposal passing 2-yes / 0-no at 100% support but with almost none of the DAO engaged. Set `minApproval` above zero and that alone isn't enough to pass.
The three are **ANDed**: support (relative direction) *and* participation (turnout) *and* approval (absolute floor). A fourth setting, `minDuration` (bounded 1 hour to 365 days), forces every proposal to stay open at least that long so the vote can't be rushed.
## Keep in mind
- **Support excludes abstain; participation includes it.** This asymmetry is intentional, not a bug. If ever unsure, re-derive from the definitions: support is `yes/(yes+no)`, participation is `(yes+no+abstain)/total`.
- **A proposal can "succeed" before it can execute.** In Standard mode a proposal may have clinched its thresholds while still open (`hasSucceeded` true), yet execution is blocked until the end date (`canExecute` false). "Succeeded" is the outcome; "executable" also accounts for timing and [mode](/plugins/voting-modes.md).
## See also
- [Token Voting Plugin](/plugins/token-voting-plugin.md) and [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md) — the governance plugins built on this engine (each with its own voting-power source).
- [Voting modes](/plugins/voting-modes.md) — how the mode changes execution timing and re-voting.
- [Ratio](/common/ratio.md) — the threshold math, and why it rounds up.
- [Proposals](/common/proposal.md) — the shared lifecycle interface.
# Voting modes
A [majority-voting](/plugins/majority-voting.md) proposal always passes by the same [thresholds](/plugins/majority-voting.md#the-three-thresholds), but the **voting mode** decides *when* a passed proposal may execute and *whether* a voter can change their mind. It's a per-plugin setting, frozen into each proposal at creation. Choose it according to the timing and voting behavior your governance needs.
> These modes apply to **snapshot-based** voting power ([Token Voting](/plugins/token-voting-plugin.md)), where a voter's weight is fixed once cast. A plugin whose power is *live* rather than snapshotted, notably [Lock to Vote](/plugins/lock-to-vote-plugin.md), adapts them: its Standard mode lets weight grow, and it has no Early Execution. See that plugin for its voting rules.
## The three modes
### Standard
Votes are final once cast, and execution waits for the full voting window: a proposal can only execute after its end date, once the final tally clears the thresholds. Choose it when you want the whole window to always play out, predictable timing, no surprise early execution, everyone gets the chance to vote.
### Early Execution
The proposal can execute *before* the end date, the moment its outcome is mathematically settled. "Mathematically settled" is computed by a **worst-case** test: assume every not-yet-cast vote turned out to be `No`, and check whether support would *still* clear the threshold:
```
worstCaseNo = totalVotingPower(snapshot) - yes - abstain
passes early iff (RATIO_BASE - supportThreshold) * yes > supportThreshold * worstCaseNo
```
If yes-power is already so far ahead that even "everyone else votes no" can't overturn it, the result is final and it can execute now. Votes are final in this mode (see why below). Choose it when speed matters and you're comfortable allowing execution as soon as this test guarantees the result.
### Vote Replacement
A voter can call `vote` again and change their choice any time before the end date; only their latest vote counts (the tally nets it out). There is **no** early execution. Choose it when you want people to react to discussion and new information during the vote.
## Why Early Execution and Vote Replacement are mutually exclusive
They can't be combined, and it comes down to the math. Early execution declares an outcome *final* while the proposal is still open. That's only sound if cast votes can't change: if a "yes" could later flip to "no", no outcome is ever truly settled before the deadline. Vote replacement is exactly the ability to flip a vote. So the two are contradictory, and a proposal is in one mode or the other.
## Keep in mind
- **Early Execution and Vote Replacement are mutually exclusive by construction**, early execution's safety depends on cast votes being immutable.
- **Changing your vote doesn't change your power.** In Vote Replacement, a re-vote is still weighed at the proposal's [snapshot](/plugins/token-voting-plugin/voting-power.md#the-snapshot) (fixed when it was created); you can change *direction*, not bring newly-acquired power to bear.
## See also
- [Majority voting](/plugins/majority-voting.md) — the thresholds the mode operates around.
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — the plugin overview.
- [Voting power](/plugins/token-voting-plugin/voting-power.md) — how it sources voting power (an example of the model above).
- [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md) — offers only Standard and Vote Replacement (no Early Execution), since its voting power is live rather than snapshotted.
# Multisig Plugin
The Multisig Plugin is a governance [plugin](/framework/plugins.md) with a fixed list of members. A proposal executes once enough of them have **approved** it. It uses no tokens, weights, or percentages: "N of the M members said yes."
If you know the [Token Voting Plugin](/plugins/token-voting-plugin.md), the contrast is the quickest way in:
| | Multisig | [Token Voting](/plugins/token-voting-plugin.md) |
|---|---|---|
| Who votes | a flat [member list](/plugins/multisig-plugin/membership.md) | anyone holding an `IVotes` token |
| Weight | one member, one approval (unweighted) | proportional to token [voting power](/plugins/token-voting-plugin/voting-power.md) |
| Passing rule | `approvals >= minApprovals` | [support / participation / approval ratios](/plugins/majority-voting.md) |
| Opposition | none, you approve or you don't | `No` and `Abstain` votes |
| Voting window | creator-chosen, **no minimum duration** | a period with a `minDuration` floor |
| If it doesn't pass | it simply **expires** unexecuted | it's voted down |
## Approving, not voting
The deepest difference from [token voting](/plugins/majority-voting.md) is what a participant can *express*. A token vote carries three distinct signals: `Yes`, `No` (active opposition), and `Abstain` (present, but taking no side). Multisig collapses all of that to a single bit, **you have approved, or you have not.** There is no onchain "no" and no "abstain".
This changes what the approval record can tell you:
- **Non-approval is ambiguous.** A member who hasn't approved might oppose the proposal, might not have seen it yet, or might be away. The contract cannot tell these apart. Only *consent* is recorded onchain; dissent, indecision, and absence all look identical.
- **Opposition is passive.** You don't defeat a proposal by voting against it; you defeat it by withholding approval until it [expires](#the-proposal-lifecycle). There is no countervailing vote to cast and no quorum-of-turnout to measure.
- **The threshold is absolute, not relative.** Passing needs `minApprovals` yes-signals. There's no ratio of yes-to-no (there are no no's) and no participation floor. This is why the whole model reduces to one counter.
The member list doesn't *dictate* this rule; membership and the voting rule are separate choices. The same [Addresslist](/common/membership.md) can instead drive full [majority voting](/plugins/majority-voting.md), with members casting `Yes`/`No`/`Abstain`, which is what the earlier Addresslist Voting plugin did (now deprecated). Multisig counts approvals to a threshold. The choice therefore goes beyond "members vs tokens" to *what a participant may express*. If you need members to actively reject or formally abstain, use a majority-voting model; multisig fits when a fixed group needs "enough of us said go."
It is a [`PluginUUPSUpgradeable`](/framework/plugin-types.md) plugin reusing the shared [proposal](/common/proposal.md) lifecycle and [Addresslist membership](/common/membership.md). For member management and the two-speed eligibility model, see [Membership & eligibility](/plugins/multisig-plugin/membership.md).
## Why onchain approvals
A traditional multisig (Safe and its kin) collects **off-chain signatures** and submits them together once the threshold is met; a relayer or UI aggregates them. This plugin works the other way round: **each approval is its own onchain transaction.** That's a deliberate design choice with real consequences:
- **The approval trail *is* onchain history.** Every approval is a public transaction and an `Approved` event, not a bundle assembled somewhere off-chain, so who approved what, and when, is transparent and indexable by default.
- **No signing infrastructure to run or trust.** There's no signature-relaying service; members act on the DAO directly.
- **It composes with the rest of OSx.** Approvals and execution use the same [permission system](/core/permissions.md) and [conditions](/common/permission-conditions.md) as every other plugin. The multisig governs the DAO through these mechanisms (it can hold [`EXECUTE_PERMISSION_ID`](/core/execution.md), be gated by conditions, and so on) without a separate signing scheme.
The trade-off is gas: N approvals are N transactions. For DAO governance that's usually the right call; for high-frequency signing it's a cost to weigh.
## Its two settings
```solidity
struct MultisigSettings {
bool onlyListed; // may only members create proposals?
uint16 minApprovals; // how many approvals a proposal needs to pass
}
```
Changed via `updateMultisigSettings` (gated by `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID`, held by the DAO). Like every setting in OSx governance, `minApprovals` is **frozen into each proposal at creation**. Changing it later never changes the threshold on an open proposal. `minApprovals` is always kept within `[1, member count]`; see the [invariant](/plugins/multisig-plugin/membership.md#minapprovals-and-the-member-count).
## The proposal lifecycle
**Create.** Records a membership [snapshot](/plugins/multisig-plugin/membership.md#two-speed-eligibility) (the prior block), freezes `minApprovals` and the [execution target](/framework/plugins.md#how-a-plugin-makes-the-dao-act), stores the [actions](/core/execution.md) and start/end dates. Who may create depends on `onlyListed` (enforced by a [condition](/plugins/multisig-plugin/membership.md#who-can-create-vs-who-can-approve)). Unlike [token voting](/plugins/majority-voting.md), there's **no minimum duration**: a proposal can start immediately, and its window is just a deadline for gathering approvals, which also bounds how long the proposal's stored actions stay executable, so a stale proposal can't sit around and fire much later under changed circumstances. The creator can approve (and even try to execute) in the same transaction, so a small multisig can create, approve, and execute a proposal in one go.
**Approve.** Each eligible member calls `approve` once, `approvals` ticks up by one. A member can't approve twice, and eligibility is judged against the proposal's snapshot (below). Passing `tryExecution: true` executes immediately if the proposal has just reached the threshold, best-effort: if it can't execute, the approval still succeeds silently.
**Execute.** Once `approvals >= minApprovals` and the proposal is still within its window, anyone with `EXECUTE_PROPOSAL_PERMISSION_ID` calls `execute`; the plugin hands the actions to the DAO (it holds [`EXECUTE_PERMISSION_ID`](/core/execution.md) on the DAO). By default that permission is open to **anyone**, the approval threshold is the real gate, so letting any address trigger a passed proposal just stops it getting stuck.
> **Succeeded is not the same as executable.** `hasSucceeded` is a pure "did it reach `minApprovals`?" check, it stays true forever once met. `execute`, though, also requires being inside the voting window. So a proposal that reached its approvals but wasn't executed before `endDate` is **permanently stuck**: succeeded, but no longer executable. Execute passed multisig proposals before they expire.
## Permissions it sets up
`MultisigSetup` wires these on install:
| Permission | On (where) | Granted to (who) | Condition | Gates |
|---|---|---|---|---|
| `EXECUTE_PERMISSION_ID` | DAO | plugin | none | the plugin calling `dao.execute` |
| `CREATE_PROPOSAL_PERMISSION_ID` | plugin | any address | `ListedCheckCondition` | `createProposal` |
| `EXECUTE_PROPOSAL_PERMISSION_ID` | plugin | any address | none | `execute` |
| `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID` | plugin | DAO | none | `updateMultisigSettings`, `addAddresses`, `removeAddresses` |
| `SET_TARGET_CONFIG_PERMISSION_ID` | plugin | DAO | none | `setTargetConfig` |
| `SET_METADATA_PERMISSION_ID` | plugin | DAO | none | `setMetadata` |
Note the asymmetry: **create is conditioned, execute is not.** Proposal creation is opened to any address but narrowed by [`ListedCheckCondition`](/plugins/multisig-plugin/membership.md#who-can-create-vs-who-can-approve) (when `onlyListed` is on); execution is deliberately open, gated only by the approval count.
## Installing it
`MultisigSetup` (a [plugin setup](/framework/plugin-setup.md)) deploys the plugin proxy from your install data (the initial members, the settings, the target), deploys a fresh `ListedCheckCondition` (returned as its helper), and returns the permission set above for the [PluginSetupProcessor](/framework/plugin-setup-processor.md) to apply.
## Keep in mind
- **There's no rejection, only expiry.** A proposal that can't gather `minApprovals` before `endDate` dies unexecuted; nobody "votes no".
- **Execute a passed proposal before it expires**, or it's stuck forever (you'd have to recreate it with *different* metadata, since [the id hashes actions + metadata](/common/proposal.md)).
- **Execution is open to anyone by default.** The approval threshold is the security boundary, not who calls `execute`.
## See also
- [Membership & eligibility](/plugins/multisig-plugin/membership.md) — managing members, the `minApprovals` invariant, and the two-speed eligibility model.
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — the token-weighted alternative.
- [Admin Plugin](/plugins/admin-plugin.md) — direct execution with no vote at all (the single-controller exception, for getting a DAO started).
- [Proposals](/common/proposal.md) and [Membership](/common/membership.md) — the shared primitives it builds on.
# Admin Plugin
The Admin Plugin gives **one address** the power to make the DAO execute any actions **immediately, with no vote and no waiting**. Use it to bootstrap a DAO before handing control to a governance plugin for ongoing operation.
Use it when a DAO is, deliberately, under a single trusted controller: a solo founder, a migration script, or a [Multisig](/plugins/multisig-plugin.md)/Safe acting as that one address. The common case is **bootstrapping**: run a DAO under Admin while it's being set up, then install a governance plugin for ongoing operation and remove Admin (which the admin can do itself; see [migrating away](#migrating-away)). If you only need the DAO to start correctly configured, prefer the [DAO Launchpad](/deployment/dao-launchpad.md)'s one-shot factory, which deploys it atomically and leaves a verifiable onchain record. Use Admin when you want to *operate* under a single controller for a while, beyond deployment.
## Why a plugin, not just a permission?
You could skip Admin entirely: grant a trusted address [`EXECUTE_PERMISSION_ID`](/core/execution.md) on the DAO directly, and it could call `dao.execute(...)` itself. So why does this plugin exist? Two practical reasons:
1. **Disposable setup.** Admin is a [plugin](/framework/plugins.md) with the standard install/uninstall lifecycle: install it to run a DAO under one controller while you bootstrap it, then [replace it with ongoing governance and remove it](#migrating-away). This lets you use the setup and teardown operations instead of manually granting and later revoking a raw permission.
2. **Every action becomes an auditable proposal.** Because actions flow through `createProposal`/`executeProposal`, each one emits the standard `ProposalCreated` / `ProposalExecuted` events and enters the DAO's proposal history alongside proposals from other governance plugins. The same UIs and indexers can review them after the fact. Direct DAO execution still has its own transaction and execution events, but does not create that proposal record. **Admin records an unrestricted operator's actions as proposals.**
Admin provides *direct execution with the accountability and lifecycle of a plugin*, even though a raw permission grant would allow the same execution.
## The zero-width proposal lifecycle
Every OSx governance plugin implements the shared [`IProposal`](/common/proposal.md) interface, which was designed for plugins that *store* proposals and decide over time. Admin implements it too, but completes the whole lifecycle in a single atomic call:
**`createProposal` and `executeProposal` are the same call.** Creating a proposal *is* executing it; nothing is ever written to storage. In one transaction, `executeProposal`:
1. computes a `proposalId` (the same [deterministic hash](/common/proposal.md) other plugins use, here only for event traceability, never as a storage key),
2. runs the [actions](/core/execution.md) immediately against the live [execution target](/framework/plugins.md#how-a-plugin-makes-the-dao-act),
3. emits `ProposalCreated` and then `ProposalExecuted`, back-to-back.
Those two events exist so **indexers and tooling built for the normal proposal lifecycle keep working**: a subgraph watching for `ProposalCreated → ProposalExecuted` sees a proposal that's created and instantly passes, with no Admin-specific code path. The `startDate`/`endDate` parameters of the standard `createProposal` signature are **ignored**; there is no time window at all.
Because nothing persists, there's no proposal storage, no existence check, and no "already exists" guard: **the same actions can be executed through Admin any number of times** (contrast [Multisig](/plugins/multisig-plugin.md), where a proposal id is a storage key and identical proposals collide).
The two entry points differ only in how they carry `allowFailureMap` (the [failsafe action map](/core/execution.md#failsafe-actions)): `executeProposal` takes it as a typed `uint256` argument, while the generic `createProposal` expects it abi-encoded in its trailing `data` (as `customProposalParamsABI` advertises).
> **`canExecute` returns `true`, but `execute(id)` always reverts.** For `IProposal` compatibility Admin has to expose `canExecute`, `hasSucceeded`, and `execute(uint256)`. The first two ignore their argument and always return `true`; **`execute(uint256)` always reverts with `FunctionNotSupported`** (it exists only so the contract compiles against `IProposal`). Generic tooling that does "if `canExecute` then `execute`" will get a revert on Admin. The execution entry points are `createProposal` / `executeProposal`, which execute atomically; there is never a separate `execute()` step to call.
## Who is "the admin"
There is no dedicated admin role. **Being the admin is defined as holding `EXECUTE_PROPOSAL_PERMISSION_ID`** on the plugin, `isMember(addr)` is literally "does `addr` hold that permission?". Two consequences:
- **Singularity is a convention, not an invariant.** The [setup](#installation) grants the permission to exactly one address, but nothing stops the DAO later granting it to more, turning Admin into an "any of N" controller with no code change.
- **Rotating the admin is a permission change**, done through the DAO's [permission system](/core/permissions.md). There's no plugin-specific "transfer adminship" function.
## Installation
`AdminSetup` (a [plugin setup](/framework/plugin-setup.md)) deploys the plugin and wires three permissions:
| Permission | On (where) | Granted to (who) | Condition | Gates |
|---|---|---|---|---|
| `EXECUTE_PROPOSAL_PERMISSION_ID` | plugin | the admin address | none | `createProposal`, `executeProposal` |
| `EXECUTE_PERMISSION_ID` | DAO | plugin | none | the plugin calling `dao.execute` |
| `SET_TARGET_CONFIG_PERMISSION_ID` | plugin | DAO | none | `setTargetConfig` |
No conditions, no helper contracts, every grant is a direct 1:1 relationship (contrast [Multisig's `ListedCheckCondition`](/plugins/multisig-plugin/membership.md#who-can-create-vs-who-can-approve)). The admin address is passed in the install data (a zero address reverts).
**Admin is a [`PluginCloneable`](/framework/plugin-types.md), not UUPS.** It holds essentially no per-instance state and is typically short-lived, so a cheap [minimal-proxy clone](/common/proxies.md) fits better than the heavier UUPS machinery, at the cost that an installed instance can't be upgraded in place (you'd install a new build instead). A separate zkSync variant deploys the full contract per install rather than cloning, purely a deployment-mechanics difference for that chain, the governance behavior is identical.
## Migrating away
Because the admin can make the DAO execute *any* action, and a DAO holds [`ROOT`](/core/permissions.md) over itself, the admin can hand power over without any special function: submit an action batch that installs a governance plugin for ongoing operation (grant it its permissions) and then removes Admin. That's a typical end state for a bootstrapped DAO: use Admin during setup, then transfer control.
> **Uninstalling Admin leaves one dangling grant.** `prepareUninstallation` revokes the two DAO-side grants (`EXECUTE_PERMISSION_ID` and `SET_TARGET_CONFIG_PERMISSION_ID`) but **not** the admin's `EXECUTE_PROPOSAL_PERMISSION_ID` (the setup can't reliably enumerate every address it was granted to). It's inert: without `EXECUTE_PERMISSION_ID` the orphaned plugin can no longer reach the DAO. The grant remains as onchain state to account for when auditing permissions after an Admin removal.
## Keep in mind
- **Never call `execute(id)` on Admin.** It always reverts; execution happens inside `createProposal`/`executeProposal`. `canExecute` returning `true` is meaningless here.
- **Single point of control, by design.** No timelock, no quorum, no veto: whoever holds `EXECUTE_PROPOSAL_PERMISSION_ID` can drain or reconfigure the DAO in one transaction. Admin adds no safety net of its own, its safety is entirely the safety of that one key or contract.
- **Nothing enforces one admin.** "Single admin" is how it's installed, not a rule the code guarantees.
## See also
- [Multisig Plugin](/plugins/multisig-plugin.md) and [Token Voting Plugin](/plugins/token-voting-plugin.md) — governance plugins that *do* store proposals and decide over time; the contrast is the clearest way to understand what Admin strips away.
- [Proposals](/common/proposal.md) — the `IProposal` interface Admin implements in its most minimal form (a zero-width create-and-execute).
- [The permission system](/core/permissions.md) — how "the admin" is defined by a grant, and how the admin can grant its own successor.
# Staged Proposal Processor (SPP)
The Staged Proposal Processor is **meta-governance**: it decides nothing on its own. It coordinates *other* governance plugins across an ordered list of **stages**. At each stage a committee of existing plugins (or plain addresses) weighs in. SPP tallies whether enough of them said yes (or too many said no) within a time window before letting the proposal move to the next stage, and finally executing it.
**At each stage, a committee of existing plugins votes on whether the proposal may advance.**
## Why it exists
Real organizations rarely govern with a single rule. They want things like *"a security council multisig pre-approves, then token holders vote, then execution happens automatically."* Rather than build a new monolithic voting contract for every such flow, SPP lets you **compose the plugins you already have**, e.g. [Multisig](/plugins/multisig-plugin.md) → [Token Voting](/plugins/token-voting-plugin.md) → [Admin](/plugins/admin-plugin.md), into exactly that pipeline, writing no new governance logic. SPP is the glue; each stage delegates the real decision to a **body**.
Because a body is an address, SPP supports both fully automated onchain plugins and *"a human signs a Safe transaction."* How a body reports its decision determines whether it is automatic or manual; see [composing bodies](/plugins/spp-plugin/composing-bodies.md).
## The pieces
- A **[stage](/plugins/spp-plugin/stages-and-bodies.md)** is one step: a set of bodies, thresholds, and a timing window.
- A **[body](/plugins/spp-plugin/stages-and-bodies.md#bodies)** is a plugin or address that renders a verdict for a stage, either an **approval** or a **veto**.
- A proposal moves through the stages according to a **[state machine](/plugins/spp-plugin/lifecycle.md)**: it becomes *advanceable* once a stage's thresholds are met inside its window, and executes when it clears the last stage.
For configuration and integration details:
- [Stages & bodies](/plugins/spp-plugin/stages-and-bodies.md) — the data model: how a stage and its bodies are configured, and the three stage shapes (approval, optimistic, timelock).
- [Lifecycle & state machine](/plugins/spp-plugin/lifecycle.md) — how a proposal advances: the states, how bodies' results are tallied, and execution rules.
- [Composing bodies](/plugins/spp-plugin/composing-bodies.md) — the integration contract for making a plugin usable as an SPP body (and which plugins already are).
It's a [`PluginUUPSUpgradeable`](/framework/plugin-types.md) plugin reusing the shared [proposal](/common/proposal.md) lifecycle. Notably, **SPP both implements and consumes [`IProposal`](/common/proposal.md)**, which is what lets an SPP instance itself be a body of another SPP (nested pipelines).
## Who can create proposals: the rule condition
Creating a proposal is permission-gated (`CREATE_PROPOSAL_PERMISSION_ID`), and most organizations don't want it open to the world, they want only certain people able to put proposals into the pipeline (a specific committee, the members of a particular plugin or Safe, and so on). SPP expresses that restriction through a dedicated [permission condition](/common/permission-conditions.md), the **`SPPRuleCondition`** (deployed per install as SPP's one helper), built on the [RuledCondition](/common/ruled-condition.md) rule engine so the restriction is *configurable* rather than baked in:
- **Open by default.** With no rules configured the condition returns true, so a freshly installed SPP is usable right away, anyone can propose. This is deliberate: defaulting to "nobody" would leave a just-installed SPP unable to create any proposal at all. Restricting is an explicit opt-in, so remember to configure the rules if your governance should limit who proposes (see [Keep in mind](#keep-in-mind)).
- **Composable.** Because it's a rule tree, "who may propose" can defer to other conditions and combine them with boolean logic, restrict creation to the members of an existing plugin, or to any of several. Eligibility is whatever the DAO configures, not a rule fixed inside SPP.
- **Governed.** Rules change via `updateRules` (gated by `UPDATE_RULES_PERMISSION_ID`, held by the DAO), so who may propose is itself a governance decision.
> When you compose a rule that defers to another condition, `SPPRuleCondition` test-calls that condition with empty `data` and rejects it if it reverts. SPP can't predict what `data` a nested condition will need for a live `createProposal`, so only **data-independent** conditions compose safely. This check prevents a DAO from configuring a condition that would silently prevent everyone from creating proposals.
## Installation & permissions
`StagedProposalProcessorSetup` deploys the SPP proxy and an `SPPRuleCondition` (its one helper), and wires these permissions:
| Permission | On (where) | Granted to (who) | Condition | Gates |
|---|---|---|---|---|
| `CREATE_PROPOSAL_PERMISSION_ID` | SPP | any address | `SPPRuleCondition` | `createProposal` |
| `ADVANCE_PERMISSION_ID` | SPP | any address | none | `advanceProposal` (and try-advance) |
| `EXECUTE_PROPOSAL_PERMISSION_ID` | SPP | any address | none | `execute` (clearing the last stage) |
| `UPDATE_STAGES_PERMISSION_ID` | SPP | DAO | none | `updateStages` |
| `SET_TARGET_CONFIG_PERMISSION_ID` | SPP | DAO | none | `setTargetConfig` |
| `SET_METADATA_PERMISSION_ID` | SPP | DAO | none | `setMetadata` |
| `SET_TRUSTED_FORWARDER_PERMISSION_ID` | SPP | DAO | none | `setTrustedForwarder` |
| `UPDATE_RULES_PERMISSION_ID` | SPPRuleCondition | DAO | none | `updateRules` (who-can-propose rules) |
| `EXECUTE_PERMISSION_ID` | DAO | SPP | none | SPP calling `dao.execute` |
Two things stand out, and both are intentional:
- **Advancing and executing are open to anyone by default.** Once the [state machine](/plugins/spp-plugin/lifecycle.md) says a proposal is advanceable, any address can move it forward. The body results determine whether it may advance, not who calls. Only proposal *creation* is condition-gated by default. The DAO can restrict who advances or executes by [replacing those public permission grants](/guides/manage-permissions.md).
- **`cancel` and `edit` are *not* granted to anyone by install.** Their permissions (`CANCEL_PERMISSION_ID` / `EDIT_PERMISSION_ID`) exist and each stage has `cancelable`/`editable` flags, but a DAO must explicitly grant the permissions before cancel/edit can be used at all. Don't assume install wired them.
The **trusted forwarder** (for [ERC-2771 meta-transactions](/core/dao.md)) is deliberately installed as `address(0)`, i.e. off: a forwarder can spoof the caller's identity, so allowing an installer to set one would be exploitable. Only the DAO can enable one later (`SET_TRUSTED_FORWARDER_PERMISSION_ID`), after vetting it.
> SPP defines its *own* `EXECUTE_PROPOSAL_PERMISSION_ID` rather than reusing the DAO's `EXECUTE_PERMISSION_ID`, so it can be granted to `ANY_ADDR`: the core [permission system](/core/permissions.md) refuses to wildcard-grant `EXECUTE_PERMISSION_ID`. This allows permissionless execution once consensus is reached while respecting that safety rule.
## Keep in mind
- **Remember to configure who can propose.** Out of the box (no rules set) any address can create proposals, deliberately, so the plugin works immediately rather than being unusable. If your governance should restrict proposing, configure the [rule condition](#who-can-create-proposals-the-rule-condition) at install (or right after); don't assume it's members-only by default.
- **Advancing and executing are permissionless by default, too.** Once a proposal's bodies have decided, anyone can push it forward; the body results are the gate, not the caller. Restrict `ADVANCE_PERMISSION_ID` / `EXECUTE_PROPOSAL_PERMISSION_ID` explicitly if you need to.
- **Cancel and edit don't work until granted.** Their permissions aren't wired by install; a stage's `cancelable`/`editable` flag alone isn't enough (see [permissions](#installation--permissions)).
## See also
- [Stages & bodies](/plugins/spp-plugin/stages-and-bodies.md), [Lifecycle & state machine](/plugins/spp-plugin/lifecycle.md), [Composing bodies](/plugins/spp-plugin/composing-bodies.md).
- [Multisig](/plugins/multisig-plugin.md), [Token Voting](/plugins/token-voting-plugin.md), [Admin](/plugins/admin-plugin.md) — the plugins you compose as bodies.
- [RuledCondition](/common/ruled-condition.md) — the engine behind who-can-propose gating.
# Lock to Vote Plugin
Lock to Vote is token-weighted governance, like the [Token Voting Plugin](/plugins/token-voting-plugin.md), but your voting power comes from tokens you **actively lock into escrow**, not from a snapshot of your past balance. To vote, you lock tokens into a **[LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)** vault; your voting power is however much you currently have locked; and you get your tokens back by unlocking later.
## Lock vs. snapshot: the core idea
Both plugins prevent someone voting twice with the same tokens, but use different mechanisms:
- **[Token Voting](/plugins/token-voting-plugin.md)** defeats double-voting with **time**: it reads your balance at a [past snapshot](/plugins/token-voting-plugin/voting-power.md#the-snapshot), so moving tokens afterward changes nothing. Tokens stay liquid.
- **Lock to Vote** defeats it with **custody**: your tokens stay locked in the LockManager, so you can't move them to another address to vote again. There is no snapshot anywhere.
That single substitution drives every difference:
- **Any ERC-20 works.** No `IVotes`, no checkpointing, no delegation, custody replaces the interface requirement. (Token Voting needs an `IVotes` token or a [wrapper](/plugins/token-voting-plugin/governance-tokens.md).)
- **Voting power is live, and can grow mid-vote.** It's your *current* locked balance, so you can lock more during an open proposal and immediately have more say, something a snapshot-based vote can never do.
- **Getting liquidity back is gated.** Because there's no "the vote already happened, your balance now is irrelevant", unlocking has to be actively restricted against your outstanding votes, see the [LockManager](/plugins/lock-to-vote-plugin/lock-manager.md).
## Why lock at all, and when to reach for it
The choice affects *when* you need to hold your tokens. [Token Voting](/plugins/token-voting-plugin.md) only counts tokens you hold **in your own wallet at the proposal's snapshot**, a past moment you can't predict. To remain able to vote on any proposal, you'd have to keep tokens **idle in your wallet indefinitely**: once you stake, lend, or LP them, they're no longer "yours at snapshot time" and your voting power is lost. You can't foresee which proposal you'll care about, so remaining ready to vote means keeping that capital available.
Lock to Vote lets you lock in response to a proposal. Because power comes from an explicit lock rather than a passive snapshot, you can keep your tokens **productively deployed elsewhere** (staked, in a vault, earning yield), lock them when a proposal you care about appears, vote, then unlock and use them elsewhere again. You can acquire voting power when needed instead of keeping tokens idle continuously.
The trade-off is committing specific tokens while you vote, rather than keeping capital idle continuously in case you need it.
The plugin is designed for **exceptional intervention, not routine governance**: emergency stops or last-line vetoes, where holders lock to weigh in on one proposal, then unlock and return to earning. Its mechanics also favor this pattern. Thresholds read `totalSupply` live right up to `execute` (see [below](#the-voting-model-and-how-it-differs)), so the safe operating rule is *veto quickly, then commit quickly*. Choose Lock to Vote when holders' tokens are normally deployed elsewhere and participation is exceptional. For steady day-to-day governance where a stable quorum threshold matters, [Token Voting](/plugins/token-voting-plugin.md) fits better; avoid Lock to Vote when its model doesn't fit the use case.
## The lifecycle
1. **Approve** the LockManager to spend your ERC-20.
2. **Lock** tokens into it (`lock` / `lock(amount)`), **at any time**: before any proposal exists, or while one is already open. Your locked balance *is* your voting power, and one locked balance backs your vote on *every* proposal at once, it isn't "spent" per proposal. You can always **add** to your locked position (raising your power), but you can't shave a slice off: the only way down is a full [unlock](#getting-your-tokens-back-two-unlock-regimes) and a re-lock of less.
3. **Vote** through the LockManager (`vote`, or `lockAndVote` to do both in one transaction). Users always vote via the LockManager, never by calling the plugin directly.
4. **[Unlock](#getting-your-tokens-back-two-unlock-regimes)** to reclaim your tokens, when nothing is blocking it (see below).
## The voting model, and how it differs
Lock to Vote uses the same [majority-voting engine](/plugins/majority-voting.md) as Token Voting: full `Yes`/`No`/`Abstain` votes and the same support / participation / approval thresholds. Two deltas matter, both flowing from live voting power:
- **No Early Execution mode.** Only `Standard` and `VoteReplacement` exist ([not the three modes](/plugins/voting-modes.md)). Early execution needs an outcome to be *provably final before the deadline*, which requires a fixed ceiling on total possible voting power to bound the worst case. Here there's no such ceiling, more can be locked (and the supply itself minted) at any moment, so no outcome is ever provably final early and the mode can't exist soundly.
- **"Standard" means the direction is locked, not the weight.** In Token Voting, Standard = your vote is fixed once cast (power was snapshotted). Here, because you can lock more, Standard mode lets you **top up the same option** (vote Yes again with more locked power) but never switch option or reduce weight. Vote Replacement lets you change option too.
> The participation/approval bar is measured against the token's **current** total supply (read live, not frozen at creation), so with a mintable or burnable token the quorum bar can move **while a proposal is open *and* after it closes, right up to the moment someone triggers `execute`**. Both directions bite: a mint after voting ends can push a passing proposal back under quorum, and a burn can push a failing one over. And the denominator is the *whole supply*, not the locked portion, so a `minParticipation` set against 100% of supply can be near-unreachable when only a small fraction of holders ever lock. Size participation/approval thresholds against realistic lock participation, not total supply.
Two operating rules follow from this design. **Never treat `minParticipation` failing as "no-quorum, therefore rejected"**: always cast an explicit `No` to reject a malicious proposal, because supply can be reduced to make quorum reachable even after voting ends. **Execute passing proposals as soon as the end date passes**: any delay gives supply changes time to flip the outcome. These rules fit the participants' incentives: holders want their tokens back to redeploy them, and beneficiaries of a passed proposal want the decision finalized. That is why the plugin fits exceptional/veto use rather than routine governance where a stable quorum threshold is expected.
## Getting your tokens back: two unlock regimes
Unlocking is **all-or-nothing** (it returns your entire locked balance, there's no partial unlock), and whether you can unlock *early* depends on the plugin's [voting mode](/plugins/voting-modes.md):
- **Vote Replacement mode, unlock early.** You can unlock whenever you like. Unlocking first **withdraws your votes** from any still-open proposals (your weight leaves their tallies), then returns your tokens.
- **Standard mode, strict.** A cast vote **cannot be withdrawn**, so once you've voted on a Standard-mode proposal, the tokens you voted with are committed until that proposal **ends**. To unlock you must wait out *every* open proposal you allocated voting power to.
In **both** regimes, a **proposal's creator can't unlock while a proposal they created is still open** (whether or not they voted), their stake stays committed for its life. The full mechanics and a gas caveat are on [the LockManager](/plugins/lock-to-vote-plugin/lock-manager.md#unlocking-the-crux).
## Who can create proposals
Like Token Voting, creation is permission-gated and narrowed by a [condition](/common/permission-conditions.md), `MinVotingPowerCondition`, but with a twist unique to locking. Because a locked balance isn't consumed by proposing (the same tokens keep proving eligibility for every proposal at once), a flat minimum would let someone lock once and spam proposals. So the required lock **scales with how many open proposals you already have**: the bar is `minProposerVotingPower × (your open proposals + 1)`. Your second concurrent proposal needs twice the locked tokens, your third three times, and so on, anti-spam that fits the lock model.
## Installation & permissions
`LockToVotePluginSetup` deploys the plugin, a **fresh `LockManagerERC20` vault** for it (there's no "reuse an existing LockManager" path, one dedicated vault per install), and the `MinVotingPowerCondition`. It validates the token is an ERC-20 by duck-typing, that's the whole bar, any plain ERC-20 qualifies. It grants:
| Permission | On (where) | Granted to (who) | Condition | Gates |
|---|---|---|---|---|
| `EXECUTE_PERMISSION_ID` | DAO | plugin | none | the plugin calling `dao.execute` |
| `CREATE_PROPOSAL_PERMISSION_ID` | plugin | the configured creator (often any address) | `MinVotingPowerCondition` | `createProposal` |
| `EXECUTE_PROPOSAL_PERMISSION_ID` | plugin | the configured executor (often any address) | none | `execute` |
| `LOCK_MANAGER_PERMISSION_ID` | plugin | **the LockManager contract** | none | `vote` |
| `UPDATE_SETTINGS_PERMISSION_ID` | plugin | DAO | none | `updateVotingSettings` |
| `SET_TARGET_CONFIG_PERMISSION_ID` | plugin | DAO | none | `setTargetConfig` |
| `SET_METADATA_PERMISSION_ID` | plugin | DAO | none | `setMetadata` |
| `UPGRADE_PLUGIN_PERMISSION_ID` | plugin | DAO | none | upgrading the plugin |
Note `LOCK_MANAGER_PERMISSION_ID` is granted to a **contract** (the vault), not to users, a machine-to-machine permission: only the LockManager may relay votes into the plugin. As defense in depth, the plugin *also* hard-codes that the caller of `vote` must be its LockManager, so even a permission misconfiguration can't let anyone else vote. A proposal's actions can't target the **LockManager** (nor the zero address), so a passed proposal can't reach in and corrupt the vault, though they *can* target the plugin itself (e.g. to `updateVotingSettings`, run as the DAO).
## Keep in mind
- **In Standard mode, voting locks up your capital until the proposal ends.** You can't un-vote to reclaim tokens early (only Vote Replacement mode allows that), so locked tokens you voted with are frozen for the proposal's whole life. See [unlocking](/plugins/lock-to-vote-plugin/lock-manager.md#unlocking-the-crux).
- **A proposal's creator can't unlock while that proposal is open**, whether or not they voted.
- **Voting power can grow but never shrink on a cast vote**, and there's **no Early Execution mode**, both consequences of power being live rather than snapshotted.
- **Thresholds stay dynamic until `execute`.** Participation and approval are measured against live `totalSupply`, so with a mintable/burnable token a proposal's outcome can flip *after* voting closes: mint to defeat a passing one, burn to pass a failing one. Don't rely on `minParticipation` failing to reject a malicious proposal (cast `No` explicitly), and execute passing proposals as soon as the end date passes. See [the voting model](#the-voting-model-and-how-it-differs).
- **Choose the token carefully.** Locking credits the *requested* amount while the vault receives whatever actually transfers, so a fee-on-transfer or rebasing token leaves credited balances exceeding the vault's real holdings. The vault then can't cover every withdrawal, and because unlock is all-or-nothing, later unlockers' transfers simply revert. Prefer a plain, well-behaved ERC-20.
## See also
- [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md) — the vault and its unlock rules.
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — the snapshot-based counterpart; the contrast is the fastest way to understand both.
- [Majority voting](/plugins/majority-voting.md) and [Voting modes](/plugins/voting-modes.md) — the shared voting model (mind the two deltas above).
# Capital Tree
Capital Tree is an [OSx plugin](/framework/plugins.md) for recurring capital flows. Each tree combines a budget, nodes with actions, and optional splitters to define where capital goes.
**Funds are held by the [`DAO.sol`](/core/dao.md) contract, which executes the calls.** Budgets determine how much is available; node actions build calls and check their results. The Capital Tree plugin coordinates the flow, asking `DAO.sol` to execute those calls using its funds and authority. See [OSx actions and execution](/core/execution.md) for the underlying mechanism.
Governance installs the flow and its permissions once. Authorized callers can [trigger the flow](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) without a new proposal for each execution. One installation runs one flow.
**We recommend one tree per `DAO.sol` contract, holding the assets dedicated to that flow.** This keeps assets ringfenced and makes accounting and permissions easier to follow than sharing a treasury across multiple flows and governance processes.
A [multisig](/plugins/multisig-plugin.md) can handle flow administration. For voting-based governance, keep voting and protocol administration in a main `DAO.sol` contract, with a dedicated `DAO.sol` contract for each capital flow. A [Transfer action](/plugins/capital-tree/actions/transfer.md) can pass funds to the contract for the next stage, whose tree runs on its own trigger.
## Where to start
- [Concepts](/plugins/capital-tree/concepts.md): understand the parts of a tree and how they fit together.
- [Execution](/plugins/capital-tree/execution.md): understand how a trigger runs the tree.
- [Budgets](/plugins/capital-tree/budgets/index.md), [actions](/plugins/capital-tree/actions/index.md) and [splitters](/plugins/capital-tree/splitters/index.md): choose the building blocks.
- [Setup and permissions](/plugins/capital-tree/setup.md): review the policy, install it and manage who can change it.
- [Solvers](/plugins/capital-tree/examples/buyback/openfill.md): build a bot and contract to fill Open Fill orders.
- [Examples](/plugins/capital-tree/examples/index.md): start with a [recurring buyback](/plugins/capital-tree/examples/buyback.md), then explore other flows.
# Actions
Actions define what the plugin does at each step of a capital flow: swap, transfer, burn, retain or donate tokens. Each action uses its [node's allocation](/plugins/capital-tree/concepts.md#nodes-define-the-structure) to prepare calls for the `DAO.sol` contract to execute and checks their result.
## Building and checking a node
The plugin runs each action in this order:
1. **Build calls.** The action prepares the operations and declares the expected output.
2. **Capture initial state.** The action checks prerequisites and records what it needs to verify the result, such as a recipient's starting balance.
3. **Execute.** The `DAO.sol` contract makes the calls using its funds and authority.
4. **Check results.** The action verifies the intended effect, and the plugin checks token balances.
5. **Continue to children.** The plugin passes the output to the next nodes, dividing it through a splitter where needed.
The action's methods are read-only. Any failed check reverts the flow. See [Execution](/plugins/capital-tree/execution.md) for how the whole run fits together.
## Core concepts
- **Input and output:** an [`Asset`](/plugins/capital-tree/execution.md#inputs-and-outputs) describes the token and amount at each step. Input is the node's allocation; output is the minimum it declares for its children. [Leaves](/plugins/capital-tree/concepts.md#leaves-complete-the-flow) declare zero output.
- **Calls:** an [`Action[]`](/core/execution.md) contains the target, value and calldata for each call the `DAO.sol` contract executes. Node actions build these calls.
- **Caller and data:** [`caller`](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) triggered the flow; `data` is this node's entry in the supplied node-data array.
- **Snapshot:** bytes captured before execution, such as a recipient's balance, for checking the result afterward.
## The node action interface
[`INodeAction`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/INodeAction.sol) uses [`IBudget`](/plugins/capital-tree/budgets/index.md#the-budget-interface), [`Asset`](/plugins/capital-tree/execution.md#inputs-and-outputs) and [`Action`](/core/execution.md):
```solidity
interface INodeAction {
/// @return The required budget, or address zero when unbound.
function budget() external view returns (IBudget);
/// @notice Builds the node's calls and declares their expected output.
/// @param caller The address that triggered the flow.
/// @param data This node's entry in the trigger data.
/// @param input The token and amount assigned to this node.
/// @return output Minimum output for children; zero amount for a leaf.
/// @return actions Calls executed through the DAO.sol contract.
function build(address caller, bytes calldata data, Asset calldata input)
external view returns (Asset memory output, Action[] memory actions);
/// @notice Checks prerequisites after build and before executing the calls.
/// @return snapshot Initial state and context needed by postconditions.
function preconditions(
address caller, bytes calldata data, Asset calldata input, Asset calldata output
) external view returns (bytes memory snapshot);
/// @notice Reverts if the executed calls did not produce the required result.
/// @param snapshot State captured by preconditions, including any needed node-data context.
function postconditions(
address caller, Asset calldata input, Asset calldata output, bytes calldata snapshot
) external view;
}
```
## Choose an action
| Action | Result |
|---|---|
| [Open Fill](/plugins/capital-tree/actions/open-fill.md) | Exchanges its input for a fixed demand and passes output to children |
| [Transfer](/plugins/capital-tree/actions/transfer.md) | Pays a fixed recipient |
| [Transfer to Beneficiary](/plugins/capital-tree/actions/transfer-to-beneficiary.md) | Pays an address supplied by the caller |
| [Burn](/plugins/capital-tree/actions/burn.md) | Burns its allocation |
| [Keep](/plugins/capital-tree/actions/keep.md) | Retains its allocation in the `DAO.sol` contract |
| [Vault Donate](/plugins/capital-tree/actions/vault-donate.md) | Adds vault assets without minting shares |
All except Open Fill are leaves. See [Keep's implementation](/plugins/capital-tree/actions/keep.md#implementation) for a minimal action and [component setup](/guides/compose-capital-tree.md#component-initialization-and-permissions) for initialization and grants.
# Open Fill
Open Fill lets any solver permitted to trigger the flow take the offered tokens in exchange for delivering at least the configured amount of the requested token. It then passes the output to child actions. Combine it with a [Stream budget](/plugins/capital-tree/budgets/stream.md) for a growing offer, as in the [recurring buyback example](/plugins/capital-tree/examples/buyback.md).
## Core concepts
- **Offer:** the node's full input allocation, available for the solver to spend.
- **Demand:** `demandPerFill`, the minimum amount of `demandedToken` the `DAO.sol` contract must receive.
- **Solver:** the contract that triggers the flow and completes the exchange when called back by the `DAO.sol` contract.
```mermaid
flowchart LR
B["Stream budget"] -->|Growing USDC offer| O["Open Fill: solver fills for a fixed MYTOKEN demand"]
O -->|MYTOKEN| A["Next actions: burn, donate or split"]
```
## Choose the auction terms
Set the output token and demand in a [recipe node](/guides/compose-capital-tree.md#build-a-custom-recipe). Here `node` is a `Setup.RecipeNode` and `myToken` is an [`IERC20`](/plugins/capital-tree/budgets/index.md#the-budget-interface) reference with 18 decimals:
```solidity
node.action.id = bytes32("OpenFillAction@1");
node.action.settings = abi.encode(myToken, uint256(100e18));
```
The demand must be positive and the demanded token must differ from the budget token. Setup supplies the flow's [checkpointed budget](/plugins/capital-tree/budgets/stream.md#checkpoint-interface) as a dependency.
The maximum offer comes from the budget and any upstream split. For a root action, the stream's `maxBudget` bounds it. See [buyback pricing](/plugins/capital-tree/examples/buyback.md#how-solvers-compete-on-price) for choosing the demand, rate and cap together.
## Action interface and execution
Open Fill implements [INodeAction](/plugins/capital-tree/actions/index.md#the-node-action-interface):
1. `build()` returns the demanded output and three calls: approve the solver, call its exchange callback, then clear approval.
2. `preconditions()` records the treasury's input- and output-token balances.
3. After the `DAO.sol` contract executes the calls, `postconditions()` checks that at least the demand arrived and at most the offer was spent. Failure reverts the flow.
Children receive the declared demand. Enable [`forwardSurplus`](/plugins/capital-tree/execution.md#inputs-and-outputs) to send all received output through later steps.
## Change demand or placement
Calling `setDemandPerFill` requires `SET_SETTINGS_PERMISSION_ID` on the action and restarts the whole budget from zero. Setup grants the action `CHECKPOINT_PERMISSION_ID` on its budget for this purpose.
Open Fill can sit below an action or splitter. The whole flow waits for a successful fill; use separate flows for branches needing independent schedules.
## Solvers
See [Build and run a Capital Tree solver](/plugins/capital-tree/examples/buyback/openfill.md) for the callback interface, trigger data and supplied `GenericFillSolver`.
## See also
- [Recurring buybacks](/plugins/capital-tree/examples/buyback.md): the auction mechanism and a complete recipe.
- [All actions](/plugins/capital-tree/actions/index.md) and [Execution](/plugins/capital-tree/execution.md).
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/OpenFillAction.json).
# Transfer
Use Transfer for a fixed recipient, such as a fee destination. The `DAO.sol` contract sends this branch's full allocation to that address, completing the [leaf](/plugins/capital-tree/concepts.md#leaves-complete-the-flow). For a caller-selected recipient, use [Transfer to Beneficiary](/plugins/capital-tree/actions/transfer-to-beneficiary.md).
- **Check**: the recipient's balance rose by at least the amount. This catches tokens that return `false`
instead of reverting. Tokens that deduct a transfer fee or reduce balances during the transfer can fail this receipt check.
- **Recipient**: set at initialization, with no setter. Changing it means a new flow (`setFlow`).
## Configuration
Encode the recipient in the action declaration. This is a [recipe-building](/guides/compose-capital-tree.md#build-a-custom-recipe) excerpt; `node` is a `Setup.RecipeNode`:
```solidity
node.action.id = bytes32("TransferAction@1");
node.action.settings = abi.encode(recipient); // recipient is an address
```
The action builds the transfer using the node's allocated token and amount, and checks the recipient's balance afterward. See the [action lifecycle](/plugins/capital-tree/actions/index.md#building-and-checking-a-node).
## See also
- [All actions](/plugins/capital-tree/actions/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/TransferAction.json)
# Transfer to Beneficiary
A [leaf action](/plugins/capital-tree/concepts.md#leaves-complete-the-flow) that pays a **beneficiary**, the recipient selected by the [caller through node data](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow). It sends the whole allocation and declares zero output.
- **Check**: the beneficiary's balance rose by at least the amount. This catches tokens that return `false`
instead of reverting. As with [Transfer](/plugins/capital-tree/actions/transfer.md), tokens that reduce the amount received can fail this receipt check.
- **Who picks the address**: the caller. Use it only where the caller may direct the funds: under a
[`MerkleClaimBudget`](/plugins/capital-tree/budgets/merkle-claim.md) (only the claiming account can trigger) or on a flow
whose trigger is restricted. On a flow anyone can trigger with a stream or balance budget, anyone
could pay themselves.
## Trigger data
The recipient is encoded at the action's node index in the trigger data. Here `plugin` is the installed CapitalTreePlugin, `nodeCount` is its node-array length, and `budgetData` is the selected budget's input:
```solidity
bytes[] memory nodeData = new bytes[](nodeCount);
nodeData[beneficiaryNodeIndex] = abi.encode(beneficiary);
plugin.trigger(budgetData, nodeData);
```
Here `beneficiary` is a nonzero address and the array has one entry per node. Call from the entitled account for a Merkle flow; changing the recipient does not change which account must prove entitlement. The action rejects missing or malformed recipient data.
## See also
- [All actions](/plugins/capital-tree/actions/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferToBeneficiaryAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/TransferToBeneficiaryAction.json)
# Burn
Use Burn to destroy the tokens assigned to a branch, such as the proceeds of a [buyback](/plugins/capital-tree/examples/buy-and-burn.md). It builds a `burn(amount)` call for the `DAO.sol` contract, so the token must support burning the caller's own balance, as `ERC20Burnable` does. This [leaf](/plugins/capital-tree/concepts.md#leaves-complete-the-flow) has no further output.
- **Check**: the `DAO.sol` contract's balance dropped by the amount.
## See also
- [All actions](/plugins/capital-tree/actions/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/BurnAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/BurnAction.json)
# Keep
Use Keep to retain a branch's share in the treasury, such as 20% of a buyback. It builds no calls: the tokens already belong to the `DAO.sol` contract. Keeping funds explicitly completes that [leaf](/plugins/capital-tree/concepts.md#leaves-complete-the-flow).
## Implementation
Keep extends [`LeafAction`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/base/LeafAction.sol), the shared base for leaves. Its `build` method uses the [`Asset` and `Action` types](/plugins/capital-tree/actions/index.md#core-concepts) to declare zero output and no calls. The allocation stays in the `DAO.sol` contract:
```solidity
// Inside a contract extending LeafAction.
function build(address, bytes calldata, Asset calldata input)
external pure returns (Asset memory, Action[] memory)
{
return (_consume(input), new Action[](0));
}
```
`_consume` returns `Asset(input.token, 0)`. Other leaves can return calls that transfer, burn or donate the allocation while still declaring zero output. Their postconditions must verify the intended effect.
## See also
- [All actions](/plugins/capital-tree/actions/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/KeepAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/KeepAction.json)
# Vault Donate
Use Vault Donate to benefit existing vault holders with a branch's tokens. A **vault** holds an underlying asset; **shares** represent holders' interests in it. The `DAO.sol` contract calls `donate()` with the branch's full allocation, increasing the backing of existing shares without receiving new shares itself.
- **Check**: the input token is the vault's asset, and the vault's total assets rose by at least
the amount.
- **Trust**: the vault is trusted, and only vaults that count a donation in their assets
immediately are supported.
[The avKAT example](/plugins/capital-tree/examples/avkat-buyback.md) walks through a buyback that donates to avKAT.
## See also
- [All actions](/plugins/capital-tree/actions/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/VaultDonateAction.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/VaultDonateAction.json)
# Budgets
Choose a budget to decide how much a [trigger](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) may use: an amount accrued over time, the treasury's whole token balance, or an account's remaining entitlement. Each budget supports one ERC20 token. Funds stay in the `DAO.sol` contract; the budget calculates availability.
## Core concepts
- **Availability:** an amount in the token's smallest unit, computed before the tree runs. These **raw units** are the integer amounts used in [`Asset`](/plugins/capital-tree/execution.md#inputs-and-outputs).
- **Caller and data:** the [trigger caller](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) and its `budgetData`, bytes supplied to the budget for this run. A budget may use them to verify an entitlement—the amount an account is allowed to claim—or ignore them.
- **Commit:** accounting after a successful run. Restarting a stream begins the next accrual period; recording a claim prevents the same entitlement being paid again.
## The budget interface
[`IBudget`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/IBudget.sol) returns an [`IERC20`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.6/contracts/token/ERC20/IERC20.sol) token reference and [`Action[]`](/core/execution.md) calls:
```solidity
interface IBudget {
function token() external view returns (IERC20);
/// @notice Calculates what this caller may use in the current run.
/// @param caller The account or contract that called the plugin's trigger function.
/// @param data Budget-specific trigger data, such as a claim proof.
/// @return amount Available amount in raw token units.
function available(address caller, bytes calldata data)
external view returns (uint256 amount);
/// @notice Builds accounting calls for the DAO.sol contract to execute after the tree succeeds.
/// @dev Receives the same caller and data as available; actual spend is not supplied.
function commitActions(address caller, bytes calldata data)
external view returns (Action[] memory);
}
```
The plugin reads `token()` and `available()`, runs the tree and checks total spend, then requests `commitActions()` with the same caller and data. All three methods are read-only; the [`DAO.sol` contract executes](/plugins/capital-tree/execution.md#who-executes-the-calls) the returned accounting calls. A failed commit rolls back the run.
On completion, a Stream budget restarts even if some allocation was retained, while a Merkle budget records the full entitlement processed.
## Choose a budget
| Budget | Availability | Commit |
|---|---|---|
| [Stream](/plugins/capital-tree/budgets/stream.md) | Grows over time, bounded by funding and an optional cap | Restart from zero |
| [Balance](/plugins/capital-tree/budgets/balance.md) | Current token balance | No calls |
| [Merkle Claim](/plugins/capital-tree/budgets/merkle-claim.md) | Caller's remaining cumulative entitlement | Record the claim |
[Stream](/plugins/capital-tree/budgets/stream.md#checkpoint-interface) also exposes a checkpoint interface for restarting availability. See [Execution](/plugins/capital-tree/execution.md) for allocation checks and [component setup](/guides/compose-capital-tree.md#component-initialization-and-permissions) for initialization and commit permissions.
# Stream budget
A Stream budget makes a token amount available gradually, up to its funding limit and configured cap. Use it for recurring distributions or as the growing offer in a [buyback auction](/plugins/capital-tree/examples/buyback.md). Funds stay in the `DAO.sol` contract.
## Core concepts
- **Availability:** the amount the next run may use. Growth is bounded by the current treasury balance, its last recorded balance, and the configured cap.
- **Rate and epoch:** `amountPerEpoch` is the growth over `epochInterval` seconds. An **epoch** is this interval; growth accrues throughout it. At 10 tokens per day, half a day adds 5.
- **Cap:** `maxBudget` limits availability. Zero removes the cap; supplied auction recipes require a nonzero cap to limit their offer.
- **Sync:** `sync()` updates the recorded balance and carries current availability forward. Use it after funding changes.
- **Checkpoint:** `writeCheckpoint()` records the balance and resets availability to zero. Use it to start or deliberately restart the stream; each successful flow checkpoints automatically.
## Configuration
In a [recipe builder](/guides/compose-capital-tree.md), `recipe` is a `Setup.InstallParams` and `usdc` is an [`IERC20`](/plugins/capital-tree/budgets/index.md#the-budget-interface) reference. This streams 1 USDC per hour, capped at 10 USDC:
```solidity
recipe.budget.id = bytes32("StreamBudget@1");
recipe.budget.settings = abi.encode(
usdc,
uint256(1_000_000), // amountPerEpoch: 1 USDC
uint256(10_000_000), // maxBudget: 10 USDC
uint256(1 hours) // epochInterval
);
```
Amounts use [raw token units](/plugins/capital-tree/budgets/index.md#core-concepts). The interval must be positive; `amountPerEpoch` is at most `type(uint128).max`. Each instance belongs to one flow.
## Checkpoint interface
Stream implements [IBudget](/plugins/capital-tree/budgets/index.md#the-budget-interface): `available(caller, data)` reads availability and ignores caller and data. Its `commitActions()` returns a checkpoint call for the `DAO.sol` contract to execute after success, including when some tokens were retained.
It also implements [`ICheckpointedBudget`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/IBudget.sol):
```solidity
interface ICheckpointedBudget is IBudget {
/// @notice Restarts availability from zero and records the current balance.
/// @dev StreamBudget requires CHECKPOINT_PERMISSION_ID.
function writeCheckpoint() external;
}
```
Setup grants the `DAO.sol` contract `CHECKPOINT_PERMISSION_ID`. Anyone may call `sync()`.
## Operate the stream
| Situation | What to do |
|---|---|
| Start | Include `writeCheckpoint()` in the installation proposal. Availability stays at zero until then. |
| Add funds | Send tokens to the `DAO.sol` contract, then call `sync()` to let the new funding support growth. |
| Spend through another proposal or flow | End that transaction with `sync()` to record the reduced balance. |
| Complete a run | The flow checkpoints automatically, starting the next accrual period from zero. |
Sync prevents funding changes from releasing a backlog. For example, a stream growing by 10 per day with only 30 funded stops at 30. A later deposit and sync resume growth from 30; a checkpoint would restart from zero.
Sync immediately after an outside spend: waiting until funds return can let availability jump when replenished. A sync during a temporary balance dip can slow growth. See the [calculation](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) for balance tracking and rounding.
## Change settings and pause
The [manager](/plugins/capital-tree/setup.md#roles-and-permissions) can call `setAmountPerEpoch`, `setEpochInterval` or `setMaxBudget` with `SET_SETTINGS_PERMISSION_ID`. Each setter syncs automatically. Rate changes preserve accrued availability; lowering the cap can reduce it.
Pausing stops execution, but availability continues growing up to the budget cap and funding limits. With a stream of 1 USDC/hour capped at 10 USDC, a sufficiently funded stream paused for 24 hours can offer 10 USDC immediately on resumption, still buying the same fixed token amount in an Open Fill buyback. Missed fills are not queued; the next successful run resets availability to zero.
To restart from zero, execute `writeCheckpoint()` and `unpause()` in the same governance transaction. This clears accrued availability without moving funds. `sync()` preserves current availability and does not clear it. The `DAO.sol` contract needs `CHECKPOINT_PERMISSION_ID` on the budget and `PAUSE_PERMISSION_ID` on the plugin; the supplied recipe grants the latter to the guardian, so governance must grant it to the `DAO.sol` contract before it can perform both calls.
## See also
- [Recurring buybacks](/plugins/capital-tree/examples/buyback.md): combine Stream with Open Fill and solvers.
- [All budgets](/plugins/capital-tree/budgets/index.md) and [Execution](/plugins/capital-tree/execution.md).
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/StreamBudget.json).
# Balance budget
Use a Balance budget when a flow should process the `DAO.sol` contract's entire balance of a token, including existing holdings. The [root](/plugins/capital-tree/concepts.md#a-budget-supplies-the-flow) receives all of it each run. Choose a [Stream budget](/plugins/capital-tree/budgets/stream.md) instead to limit how much becomes available over time.
## Configuration
The component takes one setting: the ERC20 token whose balance supplies the flow. In a [recipe builder](/guides/compose-capital-tree.md), `recipe` is a `Setup.InstallParams`:
```solidity
recipe.budget.id = bytes32("BalanceBudget@1");
recipe.budget.settings = abi.encode(token); // token is an IERC20
```
`available(caller, data)` reads `token.balanceOf(address(dao()))`; caller and data are ignored. `commitActions` returns an empty array. See the [budget interface](/plugins/capital-tree/budgets/index.md#the-budget-interface).
## See also
- [All budgets](/plugins/capital-tree/budgets/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/BalanceBudget.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/BalanceBudget.json)
# Merkle Claim budget
Use this [budget](/plugins/capital-tree/budgets/index.md) to publish account entitlements and let each account claim its unpaid amount. If an account has already claimed 40 and its new total entitlement is 100, the next flow receives 60.
## Entitlements and proofs
**Cumulative** means the total entitlement across rounds. Updating that total pays only `cumulative − claimed`; it does not reset previous claims.
A **Merkle root** is a hash committing to the entitlements; a **proof** shows an account belongs to that set. Each Merkle **leaf** is an `(account, cumulative amount)` entry in OpenZeppelin's StandardMerkleTree format. These terms describe the proof, separately from Capital Tree nodes.
## Claim and record
The entitled account calls `trigger()` with `abi.encode(account, cumulative, proof)` as budget data. With [Transfer to Beneficiary](/plugins/capital-tree/actions/transfer-to-beneficiary.md), it supplies the payout address in node data. See the [claim example](/plugins/capital-tree/examples/merkle-claims.md) for the complete call.
One trigger processes one account's remaining entitlement. After the tree succeeds, the `DAO.sol` contract executes `recordClaim`; setup grants it `RECORD_CLAIM_PERMISSION_ID`. A failed payment rolls everything back. No new entitlement means `NothingToClaim`.
## Publish another round
An authorized manager calls `setRoot` with `SET_SETTINGS_PERMISSION_ID`. This controls who can receive the treasury's tokens. Review the entitlements and fund the `DAO.sol` contract for the payouts.
Keep one flow per budget instance. Sharing it could allow a second flow to claim before the first records completion. Replacing the budget with a fresh clone loses its claim history.
A claim can feed a split or other processing before payout. Adding a swap needs a compatible action: the supplied Open Fill requires a [checkpointed budget](/plugins/capital-tree/budgets/stream.md#checkpoint-interface).
## See also
- [All budgets](/plugins/capital-tree/budgets/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/MerkleClaimBudget.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/MerkleClaimBudget.json)
# Capital Tree concepts
These concepts describe how a [Capital Tree](/plugins/capital-tree.md) flow is structured and run.
## A trigger runs the flow
A **trigger** is one call to the plugin's `trigger(budgetData, nodeData)` function to run the flow. Its **caller** is the account or contract making that call.
A trigger supplies two kinds of optional input: **budget data** for calculating availability or proving entitlement, and **node data** for individual actions. The same caller identity reaches the budget and every action. The [execution lifecycle](/plugins/capital-tree/execution.md#one-transaction) runs the tree and records completion in one transaction; failure rolls back the whole run.
## A budget supplies the flow
The [budget](/plugins/capital-tree/budgets/index.md) selects an ERC20 token to start the flow and determines how much is available when triggered. Standard ERC20 tokens can be the input token; the examples use USDC. Transfer fees, rebasing or unusual approval rules can make a run fail: see [trust boundaries](/plugins/capital-tree/execution.md#trust-boundaries). An **allocation** is a token and an amount available to a node. The budget supplies the first allocation to the **root**, node 0.
## Nodes define the structure
A **node** is a position in the tree. A **parent** supplies an allocation to its **children**, the nodes directly below it. A node receives its allocation from the budget or its parent and can have an [action](/plugins/capital-tree/actions/index.md). The action builds calls for the `DAO.sol` contract to execute and checks their result. Its output becomes the allocation available to the node's children.
A node can also branch without an action: it passes its input to its children through a splitter.
## Splitters divide allocations
A [splitter](/plugins/capital-tree/splitters/index.md) is needed when a node has two or more children. It divides the node's output between them in their configured order. With one child, the whole output passes to that child without a splitter.
## Leaves complete the flow
A **leaf** is a node without children. Its action completes that branch: for example, by transferring, burning, donating or retaining its allocation. A leaf declares no output for further nodes. Keeping an allocation is an explicit action, as the retention branch in the [example below](#example-swap-retain-and-donate) illustrates.
## New trees compose new flows
Combine the same budgets, actions and splitters into different trees to create new capital flows. A **component** is a budget, action or splitter implementation. The **registry** maps component IDs to implementations and their configuration metadata. A **recipe** selects these components and declares their settings, connections and permissions. When existing components provide the behavior you need, a new flow needs only a new composition, not new component contracts.
See [composing new flows](/guides/compose-capital-tree.md) for the recipe pattern, and [Execution](/plugins/capital-tree/execution.md) for how a tree runs and its allocations are checked.
## Example: swap, retain and donate
In this example, a protocol runs a token buyback using USDC to purchase MYTOKEN through a reverse Dutch auction: the USDC offered for a fixed token quantity grows over time until a **solver**—a contract that executes the exchange—fills the order. Purchased tokens are split: 20% is retained by the treasury and 80% is donated to a staking vault to benefit existing stakers.
The [recipe](/guides/compose-capital-tree.md) selects registered budget, action and splitter components, configures their settings, and connects them into the tree below.
```mermaid
flowchart LR
C["Solver"] -->|trigger| P["1. Capital Tree plugin"]
P --> B["2. Stream budget: USDC"]
B -->|USDC| O["3. Root node: Open Fill"]
O -->|MYTOKEN output| S{"4. Weight splitter"}
S -->|20%| K["5. Leaf: Keep in treasury"]
S -->|80%| D["6. Leaf: Vault Donate"]
```
1. **Trigger the flow.** The solver calls `trigger()` on the Capital Tree plugin to start the buyback.
2. **Read the budget.** The [Stream budget](/plugins/capital-tree/budgets/stream.md) determines how much USDC is available.
3. **Buy MYTOKEN.** The solver exchanges USDC for MYTOKEN through the [Open Fill action](/plugins/capital-tree/actions/open-fill.md).
4. **Split the purchased tokens.** The [Weight Splitter](/plugins/capital-tree/splitters/weight.md) directs 20% to retention and 80% to donation.
5. **Retain 20%.** [Keep](/plugins/capital-tree/actions/keep.md) leaves these tokens in the treasury.
6. **Donate 80%.** [Vault Donate](/plugins/capital-tree/actions/vault-donate.md) sends the rest to the staking vault to benefit existing stakers.
**Component source:** [CapitalTreePlugin.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/CapitalTreePlugin.sol) · [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [OpenFillAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) · [WeightSplitter.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol) · [KeepAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/KeepAction.sol) · [VaultDonateAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/VaultDonateAction.sol).
# Examples
Start with [Run a recurring buyback](/plugins/capital-tree/examples/buyback.md) to see how Stream, Open Fill and competing solvers form a buyback mechanism. Then choose where the proceeds go, or explore another flow below. Each example below has a supplied [recipe](/plugins/capital-tree/concepts.md#new-trees-compose-new-flows) in [`script/Recipes.sol`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) and a configuration example in [aragon/capital-tree](https://github.com/aragon/capital-tree).
| Example | Composition |
|---|---|
| [Buy and Burn](/plugins/capital-tree/examples/buy-and-burn.md) | Stream → Open Fill → Burn |
| [Buyback with a Fee](/plugins/capital-tree/examples/buyback-with-fee.md) | Stream → Open Fill → weighted Burn and Transfer |
| [Buyback and Donate: avKAT](/plugins/capital-tree/examples/avkat-buyback.md) | Stream → Open Fill → weighted fee Transfer and vault donation |
| [Payroll](/plugins/capital-tree/examples/payroll.md) | Stream → weighted transfers |
| [Merkle Claims](/plugins/capital-tree/examples/merkle-claims.md) | Merkle entitlement → caller-selected beneficiary |
## Custom compositions
A grants-and-auction tree can split a stream between a transfer and Open Fill. This has no supplied recipe. Both branches wait for a successful fill; changing demand resets the whole stream, including accrued grants. Use separate flows if those schedules must be independent.
Custom splitters can implement top-ups or caps. A Merkle claim can fund further processing, but swapping needs an action compatible with that budget; the supplied Open Fill expects a [checkpointed budget](/plugins/capital-tree/budgets/stream.md#checkpoint-interface). See [Compose a Capital Tree flow](/guides/compose-capital-tree.md) to build a custom composition.
Follow [Setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install your chosen flow.
# Run a recurring buyback
Combine a [Stream budget](/plugins/capital-tree/budgets/stream.md) with [Open Fill](/plugins/capital-tree/actions/open-fill.md) to buy your protocol's token repeatedly. Stream increases the amount offered; Open Fill fixes the amount to buy. Solvers compete to complete the exchange as the offer becomes profitable, and the tree decides what happens to the purchased tokens.
This example buys and burns 100 MYTOKEN per run, offering USDC that grows by 1 per hour up to a cap of 10.
```mermaid
flowchart LR
B["Stream: 1 USDC/hour, cap 10"] -->|Growing offer| O["Open Fill: buy 100 MYTOKEN"]
S["Competing solvers"] -.->|Trigger a fill| O
O -->|100 MYTOKEN| D["Burn"]
```
## How solvers compete on price
The offer starts at zero in a **reverse Dutch auction**: the amount offered for a fixed token quantity rises over time until a solver fills the order. The buyback price is measured in USDC per MYTOKEN. A solver compares the USDC offered with the cost of sourcing 100 MYTOKEN and executing the transaction.

Here the illustrative market price is 0.078 USDC per MYTOKEN: 7.8 USDC for the fixed demand of 100. A solver filling at 8 USDC has 0.2 USDC to cover execution costs and margin. Each completed fill resets the offer to zero.
A solver that needs 9 USDC would have to wait longer. Waiting for a larger offer risks another solver filling first, encouraging earlier execution at a better buyback price. Explore the growing offer and market price in the [interactive demo](https://capital-router-demo.aragon.org/).
The **rate** controls how quickly the offer grows, the **demand** sets the purchase size, and the **cap** sets the maximum spend per fill. Here the cap limits the price to 0.10 USDC per MYTOKEN. At the cap, the offer stops growing and waits for a fill. Pricing depends on participating solvers and available liquidity; the contract enforces the cap and demand.
## Build the recipe
Use [`Recipes.buyAndBurn`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol). In this builder excerpt, `usdc` and `myToken` are `IERC20` references; MYTOKEN has 18 decimals. `manager` and `guardian` are the chosen [role holders](/plugins/capital-tree/setup.md#roles-and-permissions), and `Setup` refers to [`CapitalTreePluginSetup`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/setup/CapitalTreePluginSetup.sol).
```solidity
Recipes.Stream memory stream = Recipes.Stream({
token: usdc,
amountPerEpoch: 1_000_000, // 1 USDC
maxBudget: 10_000_000, // 10 USDC
epochInterval: 1 hours
});
Recipes.Swap memory swap = Recipes.Swap({
demandedToken: myToken,
demandPerFill: 100e18 // 100 MYTOKEN
});
Setup.InstallParams memory recipe =
Recipes.buyAndBurn(manager, guardian, stream, swap);
```
MYTOKEN must support `burn(uint256)`. Follow [Setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) and the repository's [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/buy-and-burn.example.json) to install it, then [fund and sync the stream](/plugins/capital-tree/budgets/stream.md#operate-the-stream).
## Run each buyback
1. **Watch the offer.** Solver operators monitor availability and source a route for MYTOKEN. The supplied recipe grants `TRIGGER_PERMISSION_ID` to `ANY_ADDR`, allowing any compatible solver to fill.
2. **Fill and burn.** A solver triggers the plugin. The `DAO.sol` contract executes the exchange and burns the demanded tokens; a failure rolls back the whole run.
3. **Restart.** The completed flow checkpoints the stream to zero. With funding available, the next offer begins growing immediately.
Use the [solver integration guide](/plugins/capital-tree/examples/buyback/openfill.md) to implement or operate a solver. Change the final steps to [donate to a staking vault](/plugins/capital-tree/examples/avkat-buyback.md) or [retain and donate](/guides/compose-capital-tree.md). The [Buy and Burn](/plugins/capital-tree/examples/buy-and-burn.md) variant explains surplus handling.
**Component source:** [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [OpenFillAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) · [BurnAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/BurnAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Buy and Burn
Spend streamed token A to acquire and burn token B.
```mermaid
flowchart LR
S[Stream A] --> O[Open Fill for B] --> B[Burn B]
```
Use a [Stream budget](/plugins/capital-tree/budgets/stream.md), [Open Fill](/plugins/capital-tree/actions/open-fill.md) and [Burn](/plugins/capital-tree/actions/burn.md). The demanded token must implement `burn(uint256)`.
Start with [Run a recurring buyback](/plugins/capital-tree/examples/buyback.md) for the auction mechanism, solver competition and a complete recipe. This variant burns the purchased tokens.
The supplied recipe burns the declared demand. It leaves [`forwardSurplus`](/plugins/capital-tree/execution.md#inputs-and-outputs) false, so extra B stays in the `DAO.sol` contract. To burn surplus too, explicitly enable forwarding on the Open Fill node in a custom recipe. A failed burn rolls back the fill and checkpoint.
## Configure and install
Use [`Recipes.buyAndBurn`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) and the [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/buy-and-burn.example.json). Follow [setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install the flow. Replace addresses and choose amounts in each token's smallest unit.
**Component source:** [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [OpenFillAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) · [BurnAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/BurnAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Buyback with a Fee
Extend a [recurring buyback](/plugins/capital-tree/examples/buyback.md) to burn a share of the purchased token and transfer the rest to a fixed fee recipient.
```mermaid
flowchart LR
S[Stream A] --> O[Open Fill for B] --> W{Weights}
W --> B[Burn]
W --> F[Transfer fee]
```
Combine [Stream](/plugins/capital-tree/budgets/stream.md), [Open Fill](/plugins/capital-tree/actions/open-fill.md), [Weight Splitter](/plugins/capital-tree/splitters/weight.md), [Burn](/plugins/capital-tree/actions/burn.md) and [Transfer](/plugins/capital-tree/actions/transfer.md).
[`Recipes.buyback`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) takes a fee weight in [millionths](/plugins/capital-tree/splitters/weight.md): 50,000 means 5%. Children are ordered burn first, fee second; weights are 950,000 and 50,000. A declared output of 1,000 [raw units](/plugins/capital-tree/budgets/index.md#core-concepts) therefore burns 950 and pays 50.
Both weights must be positive. Choose a demand large enough that the fee does not round to zero; supplied nodes are not skippable. Surplus above the demand stays in the `DAO.sol` contract because this recipe does not enable forwarding. The [manager](/plugins/capital-tree/setup.md#roles-and-permissions) may update weights; replacing the fixed fee recipient requires a new action and a flow update.
## Configure and install
Use `Recipes.buyback` and the [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/buyback.example.json). Follow [setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install the flow. Replace addresses and choose amounts in each token's smallest unit.
**Component source:** [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [OpenFillAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) · [WeightSplitter.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol) · [BurnAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/BurnAction.sol) · [TransferAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Buyback and Donate: avKAT
Use a [recurring buyback](/plugins/capital-tree/examples/buyback.md) to buy KAT with treasury USDC, pay a fee share of the purchased tokens to a fixed recipient and donate the rest to the avKAT staking vault. The donation benefits existing stakers; the `DAO.sol` contract receives no avKAT shares.
```mermaid
flowchart LR
S[Stream: USDC] --> O[Open Fill: buy KAT] --> W{Weights}
W --> F[Transfer fee]
W --> D[Donate to avKAT]
```
## Choose the terms
Set the [Stream](/plugins/capital-tree/budgets/stream.md) rate and cap, the KAT demand for [Open Fill](/plugins/capital-tree/actions/open-fill.md), the vault, and the fee with its recipient. The cap limits the USDC offered per fill. The fee is in basis points: 500 means 5%. The recipe requires a fee above zero and below 10,000, and a nonzero recipient, so this flow always has a fee branch. Choose amounts in raw units: USDC uses six decimals and KAT uses eighteen.
## Where the proceeds go
A [Weight Splitter](/plugins/capital-tree/splitters/weight.md) divides the purchased KAT: the fee share goes to the recipient through [Transfer](/plugins/capital-tree/actions/transfer.md), fee first, and the rest goes to the vault. This recipe enables [`forwardSurplus`](/plugins/capital-tree/execution.md#inputs-and-outputs), so KAT received above the demand is divided the same way. Pre-existing treasury KAT and unspent USDC stay in the treasury.
The vault must support [Vault Donate](/plugins/capital-tree/actions/vault-donate.md). If the swap, the fee payment or the donation fails, the whole run rolls back. A paused vault or a fee recipient that cannot receive KAT therefore blocks this flow.
## Configure and operate
Use [`Recipes.buybackAndDonate`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) and the [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/buyback-and-donate.example.json). Review the complete configuration, replace placeholder addresses and choose your auction terms; the example amounts are illustrative.
Follow [Setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install the flow. Revenue goes to the `DAO.sol` contract; [sync the stream](/plugins/capital-tree/budgets/stream.md#operate-the-stream) after funding it. The registry must include `VaultDonateAction@1` before preparing this recipe.
Deployment and fork reproduction stay in the [repository runbook](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/docs/avkat-buyback.md#reproduce).
**Component source:** [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [OpenFillAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/OpenFillAction.sol) · [WeightSplitter.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol) · [TransferAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferAction.sol) · [VaultDonateAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/VaultDonateAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Payroll
Distribute a streamed allocation among fixed recipients.
```mermaid
flowchart LR
S[Stream] --> W{Actionless branch}
W --> A[Transfer 60%]
W --> B[Transfer 30%]
W --> C[Transfer 10%]
```
Use a [Stream budget](/plugins/capital-tree/budgets/stream.md), [Weight Splitter](/plugins/capital-tree/splitters/weight.md) and one [Transfer](/plugins/capital-tree/actions/transfer.md) [clone](/plugins/capital-tree/setup.md) per recipient. The root has no action, so it needs at least two children.
Weights `[600000, 300000, 100000]` divide 1,000 [raw units](/plugins/capital-tree/budgets/index.md#core-concepts) into 600, 300 and 100. Fund the `DAO.sol` contract and sync the budget, then let an authorized caller run `plugin.trigger("", new bytes[](0))`. This Solidity expression assumes `plugin` is the installed `CapitalTreePlugin`.
The recipe permits anyone to trigger. It distributes whatever has accrued, not a fixed monthly payment, and resets the stream after success. A failed recipient transfer rolls back all payments. Small allocations can round a child to zero and revert. Restrict timing through permissions if the payroll policy needs a specific execution window.
## Configure and install
Use [`Recipes.payroll`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) and the [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/payroll.example.json). Follow [setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install the flow. Replace addresses and choose amounts in each token's smallest unit.
**Component source:** [StreamBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/StreamBudget.sol) · [WeightSplitter.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol) · [TransferAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Merkle Claims
Let each account claim its [cumulative entitlement](/plugins/capital-tree/budgets/merkle-claim.md) to an address it chooses.
```mermaid
flowchart LR
M[Merkle Claim budget] --> T[Transfer to Beneficiary]
```
Use [Merkle Claim](/plugins/capital-tree/budgets/merkle-claim.md) and [Transfer to Beneficiary](/plugins/capital-tree/actions/transfer-to-beneficiary.md). Fund the `DAO.sol` contract separately. Prepare a StandardMerkleTree of `(address, uint256)` values, with cumulative amounts in raw token units.
An account previously paid 40 with a new cumulative entitlement of 100 receives 60. The account itself sends the transaction to the installed plugin; a wrapper would change the caller identity.
```solidity
// Call from the entitled account. Variables refer to the installed flow
// and a proof against its current root; beneficiary is the chosen recipient.
bytes[] memory nodeData = new bytes[](1);
nodeData[0] = abi.encode(beneficiary);
plugin.trigger(abi.encode(account, cumulative, proof), nodeData);
```
The claim records only after the transfer succeeds. A repeated claim reverts with `NothingToClaim`; an invalid proof, wrong caller or underfunded transfer reverts without consuming the claim. A new root retains previous claim accounting. The [manager](/plugins/capital-tree/setup.md#roles-and-permissions) controls that root and therefore which accounts can spend the `DAO.sol` contract's token balance.
## Configure and install
Use [`Recipes.merkleClaim`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) and the [configuration example](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/merkle-claim.example.json). Follow [setup and permissions](/plugins/capital-tree/setup.md#the-install-proposal) to install the flow. Replace addresses and choose amounts in each token's smallest unit.
**Component source:** [MerkleClaimBudget.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/budgets/MerkleClaimBudget.sol) · [TransferToBeneficiaryAction.sol](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/actions/TransferToBeneficiaryAction.sol).
[All examples](/plugins/capital-tree/examples/index.md).
# Build and run a Capital Tree solver
A solver combines a bot that finds profitable fills with a contract that completes the exchange. This guide uses a [Stream budget](/plugins/capital-tree/budgets/stream.md) feeding [Open Fill](/plugins/capital-tree/actions/open-fill.md) at node 0, followed by the buyback's burn, transfer or donation actions. See [recurring buybacks](/plugins/capital-tree/examples/buyback.md) for how growing offers encourage competition between solvers.
## Connect to the buyback
Use the **Capital Tree plugin address installed for the buyback you want to fill** as `pluginAddress`. Deploy [`GenericFillSolver`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/solvers/GenericFillSolver.sol) with `new GenericFillSolver(operator, CapitalTreePlugin(pluginAddress))`, where `operator` is the account running your bot.
The **solver contract address** needs `TRIGGER_PERMISSION_ID` on that Capital Tree plugin, or the permission must be granted to `ANY_ADDR` to allow any solver. Read the plugin's budget and Open Fill action using the [offer queries below](#read-the-offer). To configure your own buyback, see [Open Fill](/plugins/capital-tree/actions/open-fill.md) and [Setup](/plugins/capital-tree/setup.md).
## Contract and callback
Your contract calls the plugin's `trigger()`; the `DAO.sol` contract then calls it back through [`IFiller`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/IFiller.sol). This **callback** lets the solver collect the offered tokens and deliver the demanded tokens within the same transaction. Token parameters use [`IERC20`](/plugins/capital-tree/budgets/index.md#the-budget-interface):
```solidity
interface IFiller {
/// @notice Completes the exchange before returning to the calling contract.
/// @dev Authenticate the calling DAO.sol contract before executing the exchange.
/// @param offeredAmount Maximum amount the solver may pull.
/// @param demandedAmount Minimum increase in the DAO.sol contract's demanded-token balance.
/// @param data This Open Fill node's trigger data, passed through unchanged.
function fillOffer(
IERC20 offeredToken,
uint256 offeredAmount,
IERC20 demandedToken,
uint256 demandedAmount,
bytes calldata data
) external;
}
```
Authenticate the callback's caller as the expected `DAO.sol` contract. The plugin receives the solver contract as the trigger caller, while exchanges called inside the callback originate from the solver.
**Collect the offer with `transferFrom`.** The `DAO.sol` contract approves your solver to pull up to `offeredAmount`; include the transfer in your callback. You may collect less, but must deliver at least `demandedAmount` more of the demanded token. Collection and delivery can happen in either order.
```mermaid
sequenceDiagram
actor Bot
participant S as Solver contract
participant P as Capital Tree plugin
participant D as DAO.sol contract
participant A as Offered token
Bot->>S: trigger(nodeData)
S->>P: trigger(empty budgetData, nodeData)
P->>D: execute
D->>A: approve(solver, offered)
D->>S: fillOffer(tokens, amounts, data)
S->>A: transferFrom(DAO.sol contract, solver, amount)
Note over S,D: Solver delivers demanded tokens
D->>A: approve(solver, 0)
P->>P: Check balances, run children, commit budget
```
The [balance checks](/plugins/capital-tree/execution.md#inputs-and-outputs) require full delivery and limit the offered-token spend. A failure rolls back the whole flow. Successful completion checkpoints the stream, starting the next offer from zero. Extra output follows the node's `forwardSurplus` setting, so choose amounts and recipients accordingly.
### Using [GenericFillSolver](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/solvers/GenericFillSolver.sol)
- The operator calls `trigger(nodeData)`; the solver supplies empty budget data.
- Only the configured `DAO.sol` contract can call `fillOffer`. It decodes the Open Fill node's data as [`Action[]`](/core/execution.md) and executes that batch in order. This applies to any call from that contract, not only to fills this solver triggered: a governance proposal or another plugin executing through it can make the solver run a batch. Do not leave token balances or allowances on the solver between fills.
- Each call uses the supplied calldata. Build transfers, approvals and swaps explicitly, with `value: 0`: this executor sends no native value and does not substitute callback amounts into the batch.
- `sweep(token, recipient)` sends the solver's entire token balance to the recipient. The operator or the solver itself within a batch can call it.
Batch calls revert on EVM failure but do not decode ERC20 boolean return values; `sweep` uses `SafeERC20`. Your bot or custom solver must check profitability and the intended token movements.
## Read the offer
For a root Open Fill action, read these values from the buyback's plugin at the same block:
| Read | Purpose |
|---|---|
| `plugin.dao()` | Treasury holding the tokens |
| `plugin.nodes()` | Root action at index 0 and the number of nodes |
| `plugin.budget()` | Budget to query |
| `budget.token()` and `budget.available(solverAddress, "")` | Offered token and amount |
| `action.demandedToken()` and `action.demandPerFill()` | Required output token and amount |
| `plugin.paused()` | Whether the flow can run |
Use `available()` rather than reconstructing stream growth in the bot. An Open Fill below a splitter receives its assigned share; this example uses the full budget at the root. Use the returned `nodes` array to size the trigger data, as shown below.
## Build and submit a fill
There are three encoding layers:
1. Each `Action.data` is function calldata for a transfer, approval or swap.
2. Open Fill's payload is ABI-encoded `Action[]`, matching Solidity's `abi.encode(calls)`.
3. `nodeData` contains one entry per node, with that payload at Open Fill's index and `"0x"` for nodes needing no data.
Supply the encoded batch, not `fillOffer(...)` calldata: the action constructs the callback. `GenericFillSolver` needs an encoded `Action[]` at every Open Fill node it serves.
### Match the installed node count
`nodeData.length` must match `plugin.nodes().length` when supplying fill data. Include an entry for every node, using `"0x"` for actions that need no data. For these supplied [recipes](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol), Open Fill is node 0:
| Example | Nodes in order | `nodeData` |
|---|---|---|
| [Buy and Burn](/plugins/capital-tree/examples/buy-and-burn.md) | 0: Open Fill, 1: Burn | `[fillData, "0x"]` |
| [Katana buyback and donation](/plugins/capital-tree/examples/avkat-buyback.md) | 0: Open Fill, 1: Transfer, 2: Vault Donate | `[fillData, "0x", "0x"]` |
`fillData` is the encoded `Action[]` executed by the solver. The Katana recipe's two child actions run after the fill; their recipient and vault are already configured. The splitter belongs to node 0 and adds no extra array entry.
The viem example below reads `nodes()` directly. In Solidity or a Foundry script, the equivalent is:
```solidity
uint256 nodeCount = plugin.nodes().length;
bytes[] memory nodeData = new bytes[](nodeCount);
nodeData[0] = abi.encode(calls); // calls is the solver's Action[] batch.
```
Read the installed flow each time you build a fill, so a later configuration change is reflected in the array length and node positions.
### Encode and submit with viem
The example below uses [viem](https://viem.sh/docs/contract/encodeFunctionData) and [`GenericFillSolver`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/solvers/GenericFillSolver.sol). Supply the values read above, the deployed solver address as `solver`, `publicClient`, `walletClient`, and the authorized operator as `account`. Amounts are raw token units represented as `bigint`.
Obtain a swap quote with the solver as caller and output recipient, enforcing at least `demandedAmount` of output. Here `quote` is your adapter's normalized result: `sellAmount` and `value` are bigint; `allowanceTarget` is the spender; `to` and `data` specify the swap call. The spender and swap target may differ.
This batch collects the offered tokens, swaps them, and sends exactly the demanded amount to the `DAO.sol` contract. Remaining output stays with the solver: end the batch with a `sweep` call on the solver itself, or withdraw right after the fill, because any call from the `DAO.sol` contract can make the solver run a batch (see `fillOffer` above).
```javascript
import {
encodeAbiParameters,
encodeFunctionData,
erc20Abi,
parseAbi,
parseAbiParameters,
} from "viem";
const solverAbi = parseAbi(["function trigger(bytes[] data)"]);
const pluginAbi = parseAbi([
"function nodes() view returns ((address action, uint32[] children, address splitter, bool skipWhenEmpty, bool forwardSurplus)[])",
]);
const nodes = await publicClient.readContract({
address: pluginAddress, // Capital Tree plugin installed for this buyback.
abi: pluginAbi,
functionName: "nodes",
});
const openFillIndex = 0; // Root OpenFill in this example.
const tokenCall = (token, functionName, args) => ({
to: token,
value: 0n,
data: encodeFunctionData({ abi: erc20Abi, functionName, args }),
});
if (quote.value !== 0n) throw new Error("This solver cannot send ETH");
if (quote.sellAmount <= 0n || quote.sellAmount > offeredAmount) {
throw new Error("Quoted input does not fit the offer");
}
const calls = [
// Collect the offer using the allowance from the DAO.sol contract.
tokenCall(offeredToken, "transferFrom", [dao, solver, quote.sellAmount]),
tokenCall(offeredToken, "approve", [quote.allowanceTarget, 0n]),
tokenCall(offeredToken, "approve", [quote.allowanceTarget, quote.sellAmount]),
// The quote routes swap output to the solver.
{ to: quote.to, value: 0n, data: quote.data },
tokenCall(offeredToken, "approve", [quote.allowanceTarget, 0n]),
tokenCall(demandedToken, "transfer", [dao, demandedAmount]),
];
// Equivalent to Solidity's abi.encode(calls), where calls is Action[].
const actionArray = parseAbiParameters(
"(address to, uint256 value, bytes data)[]",
);
const fillData = encodeAbiParameters(actionArray, [calls]);
const nodeData = Array(nodes.length).fill("0x");
nodeData[openFillIndex] = fillData;
// Buy and Burn: [fillData, "0x"].
// Katana: [fillData, "0x", "0x"].
const { request } = await publicClient.simulateContract({
address: solver,
abi: solverAbi,
functionName: "trigger",
args: [nodeData],
account,
});
const hash = await walletClient.writeContract(request);
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") throw new Error(`Fill reverted: ${hash}`);
```
[`encodeFunctionData`](https://viem.sh/docs/contract/encodeFunctionData) supplies the function selector and arguments; [`encodeAbiParameters`](https://viem.sh/docs/abi/encodeAbiParameters) encodes the batch for `abi.decode(data, (Action[]))`.
To pay from inventory, omit the swap and router approvals. If the swap sends output directly to the `DAO.sol` contract, omit the final demanded-token transfer. In either case, collect the offer and deliver the full demand during the callback.
## Operate and troubleshoot
Read the offer, obtain a route or price your inventory, and include gas and your margin in the profitability check. [Simulate](https://viem.sh/docs/contract/simulateContract), submit, and inspect the receipt, `NodeExecuted` events and token movements. Another solver or a settings change can invalidate the quote before inclusion; re-read and rebuild after a stale attempt. For downstream nodes, check execution events because `skipWhenEmpty` may skip a branch.
Use the relevant contract ABI to decode errors; nested failures may require a trace:
| Error | What to check |
|---|---|
| `DaoUnauthorized` | Permission target, holder and ID. The trigger caller is the solver contract. |
| `Unauthorized` | The bot must be the solver's authorized operator; the callback must come from its configured `DAO.sol` contract. |
| `Pausable: paused` | Wait for the flow to resume, then refresh the offer. |
| `DataLengthMismatch` | Re-read nodes and supply one data entry per node. |
| `EmptyInput` | Budget availability and the failing node's allocation. |
| `DemandNotMet` | Output recipient and amount delivered. Error arguments are treasury balances. |
| `OfferExceeded` | Calls spending the offered token exceeded its permitted balance decrease. |
| `UnexpectedBalance` | The indicated node's input/output amounts and token behavior. |
| `BudgetExceeded` | Total budget-token spend, including downstream actions. |
| `ActionFailed` | A call from the `DAO.sol` contract failed: Open Fill indices 0/1/2 are approval/callback/cleanup. |
| `CallFailed` | The zero-based index in the solver batch; normally wrapped by `ActionFailed(1)`. |
Transfer fees, rebasing or token restrictions can affect received amounts and cause these checks to fail.
## Source and interfaces
Use the [plugin](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/CapitalTreePlugin.sol), [node types](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/lib/types.sol), [Stream budget](/plugins/capital-tree/budgets/stream.md#checkpoint-interface) and [Open Fill](/plugins/capital-tree/actions/open-fill.md#action-interface-and-execution) for exact types, methods and events.
The repository provides [quote helpers](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/open-fill/Quotes.s.sol), [local swap tests](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/test/solvers/OpenFillLocal.t.sol) and [run instructions](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/open-fill/README.md) for additional local and fork examples.
# Execution
A [trigger](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) runs one complete Capital Tree flow. Its caller needs [`TRIGGER_PERMISSION_ID`](/plugins/capital-tree/setup.md#roles-and-permissions), and the plugin must be unpaused with no trigger already running.
## Who executes the calls
**The `DAO.sol` contract holds the funds and executes the calls.**
When configuring an action, think of its transfers, approvals and other calls as instructions for the `DAO.sol` contract. Actions and budgets return these call descriptions as [`Action[]`](/core/execution.md). The plugin passes them to `dao.execute()`; the action and budget contracts do not execute those calls themselves.
For example, a vault donation uses the `DAO.sol` contract's tokens and approval. If the vault restricts who may donate, authorize the `DAO.sol` contract: it is the `msg.sender` the vault sees. The same applies to every directly called target. The [trigger caller](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow) is supplied separately to components. See [OSx execution](/core/execution.md#the-execute-function) for how these calls use the contract's authority.
## One transaction
```mermaid
flowchart LR
B[Read budget] --> T[Run the tree]
T --> C[Check total budget spend]
C --> A[Commit budget accounting]
A --> E[Emit FlowExecuted]
```
The budget sets the starting token and amount. From node 0, the plugin completes each branch before the next sibling: [build calls, execute through the `DAO.sol` contract, check the result](/plugins/capital-tree/actions/index.md#building-and-checking-a-node), then pass output to children. An actionless branch passes its input through a splitter.
After checking total spend, the plugin submits the budget's accounting calls. This **commit** restarts a stream or records a claim for the next run. Any failure rolls back the entire transaction, including earlier transfers.
## Inputs and outputs
Each [budget](/plugins/capital-tree/budgets/index.md) supplies one ERC20 token, but the token and amount in an `Asset` can change downstream: a swap can take USDC as input and produce MYTOKEN as output. Each node works with its assigned amount. This lets a swap's proceeds feed a split, burn or donation without using the treasury's existing output-token balance as the next step's input.
An [`Asset`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/lib/types.sol) carries that allocation:
```solidity
struct Asset {
IERC20 token;
uint256 amount;
}
```
`Asset.token` can reference any ERC20 contract, subject to the [token behavior](#trust-boundaries) the checks and calls expect; USDC is only an example input token. Amounts use the chosen token's smallest units: for example, 1 USDC is `1_000_000`.
A swap may receive more than its declared minimum output. This extra amount is **surplus**. If a swap requires 100 MYTOKEN but receives 110:
- By default, children share 100; the extra 10 stays in the treasury.
- With `forwardSurplus`, children share all 110. A 20/80 split retains 22 and donates 88; pre-existing MYTOKEN is outside that allocation.
Enable forwarding on an action node with children when later steps should use all proceeds. For different tokens, proceeds are the measured output-token increase. For the same token, they are the input plus the net balance change. The balance checks enforce the declared minimum output and maximum input spend; with the same token, only their net effect can be checked.
Leaves declare zero output. A zero input reverts unless that child has `skipWhenEmpty`, which skips its entire subtree. The root cannot be skippable; other failures always revert.
## Tree validation
When composing a recipe, put parents before their children in the node array. Every node must be reachable from node 0, with one parent per child. Actionless branches need at least two children; splitters must support the child count. Components must bind to the same `DAO.sol` contract, and budget-bound actions to this flow's budget.
Before installation, simulate successful and failing triggers with the complete configuration, including the target network's gas limits. Follow the [repository testing instructions](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/README.md#develop).
## Trust boundaries
Choose trusted components: they prepare calls using treasury authority. Input/output balance checks do not validate every allowance, destination or other treasury asset; actions must check their intended effects. Budget accounting calls are also trusted.
Token behavior matters too. Open Fill and Vault Donate approve a spender and then set that approval back to zero, so a token that rejects a zero approval reverts every run, and a token that rejects changing one nonzero approval to another reverts while an allowance to that spender is outstanding. Transfer fees and rebasing can fail the balance checks.
Calls cannot target the `DAO.sol` contract or plugin. Calls carrying native value need a function selector, but there is no native-spend cap. Built-in recipes use ERC20 tokens.
## Tracking execution
Use `FlowExecuted` to confirm completion, `NodeExecuted` to inspect each node's input, forwarded output and surplus, and `BudgetCommitted` for accounting. The flow event's input is its budget allocation, not actual spend.
Each trigger has an incrementing **nonce** to distinguish runs. The `DAO.sol` contract's `Executed` events record the submitted batches. A node whose action builds no calls, such as Keep, emits `NodeExecuted` with an execution ID but has no matching `Executed` event. See the [plugin source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/CapitalTreePlugin.sol) for event fields and execution-ID encoding.
# Setup and permissions
Deploying a capital flow means installing a Capital Tree plugin and its budget, actions and optional splitters into an existing **`DAO.sol` contract**. That contract holds the funds and executes the flow. We recommend a dedicated contract for each tree.
## Deploy a flow
1. **Choose the flow and its settings.** For a buyback and burn, choose the tokens, spending rate, maximum offer and amount to buy. Choose a **manager** to change settings and a **guardian** to pause or resume the flow.
2. **Prepare the installation.** Run the repository's installer against a published Capital Tree version on your network. It deploys your plugin and components, connects them, and produces the calls governance must approve.
3. **Approve the installation.** Submit those calls through your `DAO.sol` contract's governance or multisig. Executing the proposal grants the plugin permission to run the flow.
4. **Fund the flow.** Send the spending token to the `DAO.sol` contract. For a Stream budget, call `sync()` after funding; solvers can then trigger buybacks as the offer grows.
The [repository installation guide](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/README.md#install-a-flow) provides the commands and [buy-and-burn configuration](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/config/buy-and-burn.example.json).
## How installation works
### What must already exist
You need a [governed `DAO.sol` contract](/framework/dao-factory.md), the network's [PluginSetupProcessor](/framework/plugin-setup-processor.md), and a published Capital Tree version in a [PluginRepo](/framework/plugin-repo.md). A PluginRepo is an onchain catalogue of installable versions.
The `DAO.sol` contract must run OSx 1.3.0 or later: the plugin's balance checks rely on it rejecting a nested `execute`. The supplied recipes also grant `TRIGGER_PERMISSION_ID` to `ANY_ADDR` without a condition, which the contract's permission manager accepts from OSx 1.4.0. On an earlier version, the approved installation reverts when it executes.
The Capital Tree publisher deploys the shared component implementations, their registry and the setup contract, then publishes the setup as a plugin version. The **registry** associates names such as `StreamBudget@1` with implementation addresses. Each flow reuses these implementations through separate instances with its own settings and state.
If Capital Tree has not been published on your network, follow the [deployment runbook](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/README.md#deploy) first. This shared deployment is separate from installing each client's flow.
### What you supply
A **recipe** tells setup which budget, actions and splitters to create, how to connect them, and which settings and permissions to apply. The supplied `buyAndBurn` recipe already connects Stream, Open Fill and Burn; you supply:
| Input | Example |
|---|---|
| Treasury contract | Your `DAO.sol` contract address |
| Stream settings | USDC; offer grows by 1 USDC/hour, capped at 10 USDC |
| Purchase settings | Buy 100 MYTOKEN per fill; MYTOKEN supports `burn(uint256)` |
| Management | Manager and guardian addresses, which can be the same |
[`Recipes.buyAndBurn`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Recipes.sol) turns those inputs into the complete recipe. The installer encodes it as `abi.encode(recipe)` for preparation. Token amounts use their smallest units.
### What preparation deploys
Anyone can pay to prepare an installation. [`Install.s.sol`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/script/Install.s.sol) calls the processor's `prepareInstallation` with the treasury address, plugin version and encoded recipe. The current script selects release 1, build 1.
The processor calls Capital Tree's setup contract. Setup looks up each component in the registry, deploys separate instances, applies their settings and connects the tree. A buy-and-burn installation creates four contracts: the plugin, Stream budget, Open Fill action and Burn action.
Preparation returns the plugin address, component addresses and permissions to grant. The installer uses these to print the approval calls. The contracts now exist; the next step authorizes them to operate through the `DAO.sol` contract.
### The install proposal
Follow the OSx guide to [install a plugin into an existing contract](/guides/install-a-plugin.md) using the calls printed by the Capital Tree installer.
For a Stream budget, the installer adds `writeCheckpoint()` after installation to start accrual at zero when the proposal executes. Review the flow's settings, role holders and complete permission list before approval.
## Roles and permissions
The supplied buy-and-burn recipe installs these [permissions](/core/permissions.md):
| Holder | Permission and target | Effect |
|---|---|---|
| Plugin | `EXECUTE_PERMISSION_ID` on `DAO.sol` contract | Submits the flow's calls for execution |
| `DAO.sol` contract | `CONFIGURE_PERMISSION_ID` on plugin | Replaces the flow with `setFlow` |
| Any address (`ANY_ADDR`) | `TRIGGER_PERMISSION_ID` on plugin | Makes triggering permissionless |
| Manager | `SET_SETTINGS_PERMISSION_ID` on Stream budget and Open Fill | Changes stream and purchase settings |
| Guardian | `PAUSE_PERMISSION_ID` on plugin | Pauses or resumes runs |
| `DAO.sol` contract | `CHECKPOINT_PERMISSION_ID` on Stream budget | Starts or restarts the stream |
| Open Fill action | `CHECKPOINT_PERMISSION_ID` on Stream budget | Restarts the stream when the demand changes |
The manager controls the flow's economic terms: it can increase the spending rate, raise or remove the budget cap, and reduce the tokens required per fill. A compromised manager can therefore configure exchanges that deplete the treasury's input token for negligible return. Assign this role to governance or a trusted multisig. The supplied recipe requires a nonzero cap at installation, but the manager can subsequently remove it by setting `maxBudget` to zero.
These permissions apply to the configured components. Replacing the tree requires `CONFIGURE_PERMISSION_ID`, held by the `DAO.sol` contract; the manager role alone does not grant arbitrary treasury execution.
## Fund and run
Funds belong in the `DAO.sol` contract. Read `budget()` on the plugin to find its Stream budget, then call `sync()` after depositing USDC. See [operating the stream](/plugins/capital-tree/budgets/stream.md#operate-the-stream) for later deposits and withdrawals.
For buybacks, a [solver](/plugins/capital-tree/examples/buyback/openfill.md) triggers each exchange. The `DAO.sol` contract executes the purchase and burn, and successful completion restarts the offer from zero.
## Uninstalling
Follow the [OSx uninstallation guide](/guides/update-a-plugin.md#uninstalling-the-mirror). For Capital Tree, supply `abi.encode(originalPermissions)` as the uninstall data: the complete [`PermissionLib.MultiTargetPermission[]`](/abi/osx/PermissionLib.md) returned during installation preparation.
# Splitters
Use a splitter to send a [node's output](/plugins/capital-tree/execution.md#inputs-and-outputs) down multiple branches. For example, split purchased tokens between retention and donation. The shares apply to this flow's proceeds, rather than the treasury's whole balance; each [child action](/plugins/capital-tree/concepts.md#nodes-define-the-structure) uses its assigned share.
## Core concepts
- **Output:** the [`Asset`](/plugins/capital-tree/execution.md#inputs-and-outputs) being divided: a token and an amount.
- **Child order:** returned amounts follow the configured child indexes.
- **Child count:** a splitter supports a fixed count or any count. Only nodes with two or more children use one.
## The splitter interface
[`ISplitter`](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/interfaces/ISplitter.sol) is read-only:
```solidity
interface ISplitter {
/// @notice Divides the parent's output without moving funds.
/// @param caller The trigger caller, available for caller-dependent rules.
/// @return amounts One amount per child, in child order, summing to output.amount.
function split(address caller, Asset calldata output, uint256 childCount)
external view returns (uint256[] memory amounts);
/// @return A fixed child count, or zero for any count.
function childCount() external view returns (uint256);
}
```
`childCount()` is checked when configuring the tree; zero means any count. `split()` runs after the parent's output is established and before its children execute. `caller` is the [trigger caller](/plugins/capital-tree/concepts.md#a-trigger-runs-the-flow).
Splitting assigns amounts without moving funds. Returned amounts must sum to `output.amount`. For small outputs, a share may round to zero: that child reverts unless [`skipWhenEmpty`](/plugins/capital-tree/execution.md#inputs-and-outputs) allows its subtree to be skipped.
## Choose a splitter
[Weight Splitter](/plugins/capital-tree/splitters/weight.md) is the supplied implementation, with fixed weights and explicit rounding. Custom caps, top-ups or changing shares need a new implementation behind the same interface. See [composing flows](/guides/compose-capital-tree.md) for how registered implementations become recipe components.
# Weight Splitter
Use fixed percentages to divide a node's output, such as 20% retained and 80% donated. **Weights** express these shares in millionths: 200,000 means 20%. Assign one positive weight per child, in child order, totaling 1,000,000.
## Configuration
The settings are an ABI-encoded `uint32[]`, in child order. For a [recipe node](/guides/compose-capital-tree.md#build-a-custom-recipe) with retention first and donation second, where `node` is a `Setup.RecipeNode`:
```solidity
uint32[] memory weights = new uint32[](2);
weights[0] = 200_000; // 20% to the first child
weights[1] = 800_000; // 80% to the second child
node.splitter.id = bytes32("WeightSplitter@1");
node.splitter.settings = abi.encode(weights);
```
## Small amounts and rounding
The largest share receives any rounding remainder; the first wins a tie. If a small output gives a child zero, the run reverts unless that child has [`skipWhenEmpty`](/plugins/capital-tree/execution.md#inputs-and-outputs). Choose amounts that keep required branches funded.
## Adjust the split
A [manager](/plugins/capital-tree/setup.md#roles-and-permissions) with `SET_SETTINGS_PERMISSION_ID` can call `setWeights(weights)`. The number of weights must stay the same; adding or removing children requires a flow update through `setFlow`. `childCount()` reports that number for the [splitter interface](/plugins/capital-tree/splitters/index.md#the-splitter-interface).
## See also
- [All splitters](/plugins/capital-tree/splitters/index.md)
- [Execution](/plugins/capital-tree/execution.md) and [setup and permissions](/plugins/capital-tree/setup.md)
- [Contract source](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/src/splitters/WeightSplitter.sol) and [settings metadata](https://github.com/aragon/capital-tree/blob/47eb5ef56e8f83822d832e23da49dc76b103d37c/metadata/components/WeightSplitter.json)
# The LockManager
The `LockManager` is the vault used by the [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md). It does two jobs: it **holds locked tokens** (preventing holders from moving them to reuse their voting power), and it is the **sole address allowed to relay votes** into the plugin. Users interact with the LockManager, not the plugin directly.
Each plugin install gets its **own** LockManager, bound to it **1:1 and permanently**: the vault is assigned its plugin exactly once (checked to support the right interfaces) and can never be repointed, and the plugin likewise accepts exactly one LockManager at initialization.
## Locking
After approving the vault to spend your ERC-20, `lock()` (your full available balance) or `lock(amount)` transfers the tokens in and credits `lockedBalances[you]`. That balance determines your participation:
- **Your locked balance isn't "spent" by voting or proposing.** The same locked amount backs your voting power on *every* proposal simultaneously, and keeps proving your eligibility to propose. It's a standing stake, not a per-proposal deposit.
- **Voting power is read live from this balance.** Lock more and your weight goes up immediately, even on proposals already open (subject to the [mode rules](/plugins/lock-to-vote-plugin.md#the-voting-model-and-how-it-differs)).
## Unlocking: the crux
`unlock()` returns your tokens, but it is **gated** and **all-or-nothing** (it releases your *entire* locked balance, there is no partial unlock). Whether you can unlock *early* (while you still have live votes) is the vault's two-regime question, driven by the plugin's [voting mode](/plugins/voting-modes.md). Before releasing, `unlock` walks every proposal the vault knows about and, for each one still open, enforces:
1. **Did you create it?** If you created *any* still-open proposal, unlock reverts, whether or not you voted. This keeps a proposer's stake committed for as long as their proposal lives (otherwise you could lock the minimum, propose, and immediately withdraw).
2. **Did you vote on it?** If you have voting power counted on a still-open proposal, what happens depends on the [voting mode](/plugins/voting-modes.md):
- **Vote Replacement mode, unlock early:** unlock *auto-clears* your vote first (removing your weight from the tally), then releases your tokens. You can leave whenever you want.
- **Standard mode, strict:** a cast vote **cannot** be cleared while the proposal is open, so **unlock is blocked** until every proposal you voted on has ended. Your capital is frozen for the life of those proposals.
So "when can I unlock?" is: only when you have no open proposal you created, and (in Standard mode) no open proposal you voted on. To reduce your locked amount you must clear all obligations, unlock everything, then re-lock the smaller amount.
## Proposal bookkeeping, and a gas gotcha
To know which proposals to check at unlock time, the LockManager keeps its own set of **known proposal ids**: the plugin notifies it on each `createProposal`, and removes an id when a proposal is **executed**. The catch: a proposal that's *defeated or simply expires unexecuted* is **never automatically removed**, it lingers in the set.
Because `unlock()` (and the proposer check) loop over that whole set, an install that accumulates many defeated/expired-but-unexecuted proposals makes unlocking **progressively more expensive for every locker**. `pruneProposals` is the manual cleanup that drops ended proposals, and it's also done opportunistically as unlocks walk past them, but nothing runs it automatically. High-proposal-volume DAOs should prune periodically.
## Trust boundaries
The vault and plugin trust each other through **hard-coded address checks**, as well as DAO permissions: the plugin accepts `vote`/`clearVote` calls only from its LockManager, and the LockManager accepts the proposal notifications only from its plugin. These checks prevent calls between the contracts from being redirected even if a permission is misconfigured. The pairing is fixed in **write-once storage** (set once at install and never repointable, guarded by `SetPluginAddressForbidden` / `LockManagerAlreadyDefined`; these are upgradeable proxies, so the fields are ordinary storage, not the `immutable` keyword).
## Keep in mind
- **Standard-mode voting freezes your capital until the proposal ends**, you cannot un-vote to reclaim it early (only Vote Replacement mode can). Plan liquidity accordingly.
- **No partial unlock**: it's all your locked tokens or none; reduce by fully unlocking and re-locking less.
- **A proposer can't unlock while any proposal they created is still open.**
- **Prune ended proposals.** Defeated/expired proposals linger in the known-proposal set and make every `unlock()` costlier until `pruneProposals` clears them.
## See also
- [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md) — the plugin overview, voting model, and permissions.
- [Voting modes](/plugins/voting-modes.md) — why Standard vs Vote Replacement changes whether you can unlock.
# Multisig membership & eligibility
The [Multisig Plugin](/plugins/multisig-plugin.md)'s member list reuses the shared [Addresslist](/common/membership.md), a checkpointed set of addresses (the plugin adds no membership storage of its own). `isMember` calls `isListed`. Two additional rules govern its use: the **`minApprovals` invariant** and the **two-speed eligibility** model.
## Managing members
Members are added and removed with `addAddresses` / `removeAddresses`, gated by `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID` (held by the DAO, so membership changes go through governance). Because they touch the same permission and interact with `minApprovals`, membership and the threshold are really one coupled setting.
### `minApprovals` and the member count
One invariant holds at all times: **`1 ≤ minApprovals ≤ member count`.** A multisig can never require zero approvals (that would auto-pass everything), nor more approvals than it has members (that would make passing impossible). It's enforced from both directions:
- `updateMultisigSettings` rejects a `minApprovals` below 1 or above the current member count.
- `removeAddresses` rejects a removal that would drop the member count below the current `minApprovals`.
Because `minApprovals` is an **absolute** count, not a percentage, changing the member list changes the share of members needed to pass a proposal. Adding members keeps the same number of approvals needed (a smaller share of the group, so relatively easier to pass), while removing members makes each remaining approval weigh more (relatively harder). That's why only *removal* is threshold-constrained: adding can never breach an absolute floor.
> **Shrinking the multisig takes two actions, in order.** Each function checks against the *current* onchain state, not against other actions queued in the same proposal. So to remove members *and* lower the threshold below where it is now, the proposal's actions must be: **(1) `updateMultisigSettings` to lower `minApprovals` first, then (2) `removeAddresses`.** The reverse order reverts, because the removal is validated against the old, higher threshold. Preserve this order when scripting membership rotations.
## Two-speed eligibility
**Who may *create* a proposal and who may *approve* one are judged at different times.**
- **Approving is snapshot-based.** A proposal fixes a snapshot at the block *before* creation, and approval eligibility is checked against membership *at that snapshot* (`isListedAtBlock`), never against current membership. **A member removed *after* a proposal was created can still approve that already-open proposal**, they were listed at its snapshot, and removal never re-checks. Ejecting a compromised or departed signer does *not* stop them pushing through proposals that were already open when you removed them; only proposals created *after* the removal exclude them. (Symmetrically, a member added after creation cannot approve that proposal.) The snapshot is the *prior* block, not the current one, so nobody can flip membership in the same block they create a proposal to rig who's eligible.
- **Creating is live.** Whether you may open a proposal is checked against *current* membership at call time (see below).
The reason for the split: approvals must be counted against a stable electorate for the whole life of a proposal, but "may I even start one" is naturally a here-and-now question.
### Who can create vs. who can approve
Creation eligibility is enforced by a small [permission condition](/common/permission-conditions.md), `ListedCheckCondition`, wired onto `CREATE_PROPOSAL_PERMISSION_ID` (which is granted broadly to *any address*). The condition simply asks: is `onlyListed` on, and if so, is the caller currently listed? This is the same pattern as the Token Voting Plugin's [`VotingPowerCondition`](/plugins/token-voting-plugin/voting-power.md#who-may-propose), a broad grant narrowed dynamically by a condition.
Because the condition reads `onlyListed` live, it doubles as a useful switch:
> **`onlyListed = false` decouples proposing from passing.** Turn it off and *anyone* can create a proposal, while approving and passing it stays restricted to the member list. This lets the public submit proposals for members to decide. Open proposal creation does not mean open governance: the approvals are still members-only.
## Keep in mind
- **`minApprovals` never exceeds the member count.** To shrink the multisig below the current threshold, lower `minApprovals` *before* removing members in the same proposal.
- **Removing a member doesn't lock them out of *open* proposals.** Their eligibility was frozen at each open proposal's snapshot; only proposals created after the removal exclude them. After ejecting a signer, check what's still open, they can still approve it. (Conversely, a member added later can't approve an already-open proposal.)
- **No double approval.** Each member's approval counts once; approving again reverts.
## See also
- [Multisig Plugin](/plugins/multisig-plugin.md) — the approval model and lifecycle.
- [Membership and the address list](/common/membership.md) — the shared, checkpointed `Addresslist` this builds on.
- [Permission conditions](/common/permission-conditions.md) — how `ListedCheckCondition` gates creation.
# Composing SPP bodies
In [SPP](/plugins/spp-plugin.md), a stage's decision-makers, its **bodies**, are *other* contracts: existing governance plugins, a Safe, even an EOA. A body integrates by reporting its decision to SPP or exposing a proposal interface SPP can read.
**Acting in a body decides the parent, not the actions.** When someone votes or approves inside a body, they're voting on whether to *advance or veto the SPP proposal at that stage*, not on the proposal's underlying actions directly. The body is a gate; SPP owns the actions and the final execution.
## Automatic vs. manual bodies
Every body is one of two kinds ([configured per stage](/plugins/spp-plugin/stages-and-bodies.md#bodies)). The split comes down to **how SPP learns the body's verdict**, which depends on whether the body speaks OSx's proposal interface:
- **Automatic** (`isManual = false`): the body is an OSx-native plugin that reports success through [`IProposal`](/common/proposal.md). So SPP can create a sub-proposal on it when the stage begins (its single action is a callback to `reportProposalResult` pre-filled with the body's verdict), *and* SPP can [poll the body's `hasSucceeded`](/plugins/spp-plugin/lifecycle.md#how-a-stages-results-are-tallied-push-and-pull) directly, no custom wiring either way. Requires ERC-165 `IProposal` support and that SPP holds `CREATE_PROPOSAL_PERMISSION` on the body.
- **Manual** (`isManual = true`): the body is something that *doesn't* implement OSx's proposal interface, a Safe, a vault, an external Governor, an EOA, so there's no `hasSucceeded` for SPP to poll and no sub-proposal to create. Instead the external system **pushes** its verdict in: it calls `reportProposalResult` to *notify* SPP that it has approved or vetoed. Manual mode lets any external address take part in a stage without adopting an Aragon interface. Someone must arrange that reporting; it isn't automated for you.
## Making your plugin an automatic body
Inherit the shared [`Proposal`/`ProposalUpgradeable`](/common/proposal.md) base (it gives you `IProposal` + ERC-165), then honor three rules:
1. **`createProposal` must accept SPP's call and add no extra gatekeeping.** SPP passes standard proposal params (metadata, actions, start/end dates, and a `data` blob for anything plugin-specific, declare its shape with `customProposalParamsABI` so SPP and UIs can encode it). Critically, **do not add bespoke eligibility checks inside `createProposal`** (token-balance requirements, allowlists, etc.). SPP relies purely on the OSx [permission system](/core/permissions.md) to decide whether it may create the sub-proposal; any extra check can make SPP's call fail, and the body then silently drops out of the stage (a `SubProposalNotCreated` event, [no revert](/plugins/spp-plugin/lifecycle.md#advancing-and-executing)).
2. **`hasSucceeded` must be monotonic**, once it returns `true`, it must stay `true` forever. SPP polls it (the [pull tally](/plugins/spp-plugin/lifecycle.md#how-a-stages-results-are-tallied-push-and-pull)) possibly long after your body's own voting window closed, while other bodies in the stage are still deciding. A `hasSucceeded` that reverts to `false` after the window strands the SPP proposal.
3. **`canExecute` is yours to define.** SPP never calls it, so it's free to enforce time windows or other conditions for the body's *own* execution; that doesn't affect SPP.
## Using a manual body (a Safe)
For a body that can't be automatic, register its address with `isManual = true` and report results yourself. The canonical example is a Safe as a veto body:
```solidity
// After the SPP proposal exists, submit this as a Safe transaction:
// to:
// data:
abi.encodeCall(
StagedProposalProcessor.reportProposalResult,
(proposalId, stageId, ResultType.Veto, /* tryAdvance */ false)
);
```
- `stageId` **must be the stage this body sits in.** Reporting for a stage the proposal hasn't reached yet *reverts* (`StageIdInvalid`); a report for the current or an earlier stage from an address that isn't a registered body of it is silently ignored (a wasted-gas no-op). So target the exact stage, and only where you're actually a body.
- Do it **before the stage's `maxAdvance`**, or the proposal [expires](/plugins/spp-plugin/lifecycle.md#the-states) regardless.
- `tryAdvance: true` also advances the proposal in the same transaction *if* the reported result is enough and the caller holds `ADVANCE_PERMISSION_ID`.
## Which plugins can be bodies
Any address can be a *manual* body. For *automatic* bodies, the standard OSx governance plugins already qualify (they inherit the proposal base): [Multisig](/plugins/multisig-plugin.md), [Token Voting](/plugins/token-voting-plugin.md), and [Admin](/plugins/admin-plugin.md). A Safe or an external Governor is the typical manual body. SPP can therefore combine existing plugins into a sequence such as *multisig approves → token holders vote → admin executes*.
## SPP inside SPP
Because SPP implements [`IProposal`](/common/proposal.md), **an SPP instance can be a body of another SPP**, nesting pipelines (a whole sub-pipeline supplies one stage's decision). It integrates like any automatic body, with two requirements: the inner SPP needs its own stages, bodies, and permissions configured, and its verdict reaches the outer SPP only when the inner pipeline is **executed** (execution fires the report callback, and since executing is permissionless anyone can trigger it once it's ready).
The inner SPP's own `hasSucceeded` is strictly monotonic only *after* it executes. A last-stage-advanceable inner proposal that hits `maxAdvance` expires and no longer counts as succeeded, so nesting depends on the inner pipeline being executed, not merely polled.
## Keep in mind
- **Never add custom access control to a body's `createProposal`** beyond OSx permissions, it breaks SPP's automatic sub-proposal creation, and the body silently stops counting.
- **A body's `hasSucceeded` must never go back to false**, or it can permanently stall the SPP proposal.
- **SPP needs `CREATE_PROPOSAL_PERMISSION` on each automatic body**; without it, that body degrades to `SubProposalNotCreated` and contributes nothing.
## See also
- [Lifecycle & state machine](/plugins/spp-plugin/lifecycle.md) — the push/pull tally that consumes `hasSucceeded`.
- [Stages & bodies](/plugins/spp-plugin/stages-and-bodies.md) — where a body's kind and result type are set.
- [Multisig](/plugins/multisig-plugin.md), [Token Voting](/plugins/token-voting-plugin.md), [Admin](/plugins/admin-plugin.md) — the composable bodies.
# SPP lifecycle & state machine
An [SPP](/plugins/spp-plugin.md) proposal moves from creation through each [stage](/plugins/spp-plugin/stages-and-bodies.md) to execution. Its state determines whether it may advance, based on the stage's timing and body results.
## The states
At any moment a proposal is in one of these states, computed live from timestamps and tallies (only `Executed` and `Canceled` are stored flags; even `Expired` is derived, from `maxAdvance`):
- **Active** — exists, but not yet advanceable (too early, or the current stage's thresholds aren't met).
- **Advanceable** — the current stage's thresholds are met, within its timing window; the proposal can advance (or, on the last stage, execute).
- **Executed** — terminal, the actions ran.
- **Canceled** — terminal.
- **Expired** — the stage's `maxAdvance` passed without becoming advanceable. **Terminal and unrecoverable**: nothing un-expires a proposal.
The `state(proposalId)` function decides this, in order (each check short-circuits):
1. executed → **Executed**; canceled → **Canceled** (sticky, checked first).
2. past `maxAdvance` → **Expired**.
3. before `minAdvance` → **Active** (too early, regardless of how many bodies already reported).
4. veto stage and `voteDuration` not yet elapsed → **Active** (the [veto-window floor](/plugins/spp-plugin/stages-and-bodies.md#voteduration-the-field-that-does-two-jobs)).
5. thresholds met → **Advanceable**; otherwise → **Active**.
"Thresholds met" applies the [hard-veto rule](/plugins/spp-plugin/stages-and-bodies.md#vetoes-always-win): enough vetoes → not met; otherwise, enough approvals → met.
From `state`, the rest follows: `canProposalAdvance` is "state is Advanceable"; `canExecute` is "Advanceable *and* on the last stage"; and `hasSucceeded` (the [`IProposal`](/common/proposal.md) signal other plugins poll) is "on the last stage and Advanceable **or** already Executed". It stays true after execution, which matters for [nesting SPP as a body](/plugins/spp-plugin/composing-bodies.md).
## How a stage's results are tallied: push and pull
A stage's tally, how many bodies have approved or vetoed, is computed two ways per body:
- **Push (a body reports).** A body (or anyone acting for it) calls `reportProposalResult`, which records its verdict in storage. Once recorded, that verdict is **cached permanently and trusted**, SPP never re-checks it. This is how [automatic bodies](/plugins/spp-plugin/composing-bodies.md) feed back: the sub-proposal SPP created on them has a single action that calls `reportProposalResult` when the body's own process executes it.
- **Pull (SPP asks).** If a body hasn't reported but is automatic and had a sub-proposal created, SPP does a read-only `hasSucceeded` call on that sub-proposal on the fly; if it succeeded, the body's registered [`resultType`](/plugins/spp-plugin/stages-and-bodies.md#bodies) (approval or veto) is credited. SPP doesn't ask *which way* the body voted, it decided at config time what "this body succeeded" means.
Why both? Push requires someone to actually execute the body's sub-proposal; pull lets SPP treat a stage as decided the moment the body's internal vote passed, without waiting for that extra execution. Whichever happens first wins (a cached push skips the pull). The pull call is deliberately hardened, a body that reverts or returns garbage simply contributes nothing rather than breaking the whole tally.
> This is why an automatic body's `hasSucceeded` **must be monotonic** (true forever once true): SPP may poll it long after the body's own voting window closed, while still waiting on other bodies. A body whose `hasSucceeded` flips back to false would silently strand the SPP proposal. See [composing bodies](/plugins/spp-plugin/composing-bodies.md).
## Reporting a result
```solidity
reportProposalResult(uint256 proposalId, uint16 stageId, ResultType resultType, bool tryAdvance)
```
- **Anyone may call it**, but it's safe: SPP only ever *reads* the recorded verdict for addresses actually registered as bodies in that stage. A report from a non-body is simply never counted (it just wastes the caller's gas, worth a UI guard, not a contract one).
- **A report overwrites.** There's no "first report is final", a body can flip its own verdict (approval ↔ veto) any time before the proposal actually advances past the stage.
- **`tryAdvance: true`** also advances when the proposal is advanceable and the caller has `ADVANCE_PERMISSION_ID`, or `EXECUTE_PROPOSAL_PERMISSION_ID` on the last stage. Missing permission or unsuitable state skips the attempt, so the body's report and other actions in its transaction can still succeed when SPP is not ready. If advancement actually runs, an execution failure can still revert the transaction.
## Advancing and executing
`advanceProposal` moves an advanceable proposal to the next stage (creating that stage's sub-proposals) or, on the last stage, executes it. **Advancing past the last stage *is* executing**; there's no separate "finished" step. Advancing needs `ADVANCE_PERMISSION_ID`; executing needs `EXECUTE_PROPOSAL_PERMISSION_ID`. Both are [granted to anyone by default](/plugins/spp-plugin.md#installation--permissions), so once the state machine says advanceable, anyone can move the proposal forward; the body results, not the caller, determine whether it may advance. Execution runs the proposal's [actions](/core/execution.md) against the snapshotted target, honoring the [failsafe action map](/core/execution.md#failsafe-actions) set at creation (individual actions may be allowed to fail without reverting the batch).
When a stage begins, SPP creates a sub-proposal on each of its automatic bodies through a guarded low-level call (with a gas-griefing check). If a body's `createProposal` reverts, or the body rejects SPP, that body contributes nothing to the tally (a `SubProposalNotCreated` event) instead of blocking the other bodies or the whole pipeline. A misconfigured body therefore doesn't cause sub-proposal creation for the rest of the stage to fail.
## Cancelling and editing
Two optional interventions, each gated *both* by a per-stage flag and a permission:
- **`cancel`** (needs `CANCEL_PERMISSION_ID`, and the current stage's `cancelable`) ends the proposal permanently.
- **`edit`** (needs `EDIT_PERMISSION_ID`, and the current stage's `editable`) replaces the proposal's actions before it advances. If the current stage has bodies, editing is only allowed once the stage is *advanceable* (you can't rewrite what bodies are actively voting on); a bodyless [timelock stage](/plugins/spp-plugin/stages-and-bodies.md#the-three-stage-shapes) can be edited while merely active.
Neither is possible on a terminal proposal (executed, canceled, expired). **Install grants neither permission by default**: a DAO must grant `CANCEL_PERMISSION_ID`/`EDIT_PERMISSION_ID` explicitly for these to work at all, on top of setting the per-stage flags.
## Keep in mind
- **Vetoes trump approvals.** Meeting the veto threshold blocks a stage no matter how many approvals it has. A lone `vetoThreshold = 1` body is an absolute veto.
- **Expired is a dead end.** Miss `maxAdvance` and the proposal is permanently stuck; the only way forward is a fresh proposal. Advance/execute passed proposals in time.
- **`voteDuration` can override `minAdvance`.** On a veto stage the effective floor is `max(minAdvance, voteDuration)` (see [stages](/plugins/spp-plugin/stages-and-bodies.md#voteduration-the-field-that-does-two-jobs)).
- **Reports are overwritable, not final**, until the proposal advances past the stage.
- **Cancel/edit need explicit permission grants** *and* the per-stage flag, both, or they silently can't be used.
## See also
- [Stages & bodies](/plugins/spp-plugin/stages-and-bodies.md) — the thresholds and timings this machine runs on.
- [Composing bodies](/plugins/spp-plugin/composing-bodies.md) — the `hasSucceeded` contract the pull-tally depends on.
- [SPP overview](/plugins/spp-plugin.md).
# SPP stages & bodies
An [SPP](/plugins/spp-plugin.md) pipeline is entirely defined by its list of **stages**, and each stage by its list of **bodies**. These two structures determine the governance process SPP can express.
## A stage
A stage is one step of the pipeline: who weighs in, how many of them it takes, and the timing.
```solidity
struct Stage {
Body[] bodies; // the delegates deciding this stage
uint64 maxAdvance; // deadline: after this, the proposal expires
uint64 minAdvance; // earliest the stage may become advanceable
uint64 voteDuration; // sub-proposal voting length (+ veto window, see below)
uint16 approvalThreshold; // how many bodies must approve to advance
uint16 vetoThreshold; // how many vetoes permanently block advancing
bool cancelable; // may the proposal be cancelled while in this stage?
bool editable; // may its actions be edited while in this stage?
}
```
The thresholds and timings are validated when stages are set (`minAdvance < maxAdvance`, `voteDuration < maxAdvance`, each threshold `<=` the number of bodies, and no address may appear twice in one stage's bodies).
### Thresholds count bodies, not votes
`approvalThreshold` and `vetoThreshold` are **counts of bodies**, not weighted votes. Each body contributes exactly *one* unit to the stage's tally once it reports, regardless of how that body reached its own decision. A 9-signer multisig and a single EOA each count as **1**. Whatever weighting, quorum, or token math happens *inside* a body is invisible to SPP; SPP only asks "did this body approve / veto?" So "3-of-5 bodies must approve" means five bodies, three approvals, not five tokens or five voters.
### Vetoes always win
If a stage has veto bodies, reaching `vetoThreshold` **blocks the proposal outright**, no number of approvals overrides it. A veto is a hard veto, not a counterweight in a tally. A single veto body with `vetoThreshold = 1` can permanently stop a stage.
### `voteDuration`: the field that does two jobs
`voteDuration` controls two timings:
1. It sets the voting length of the sub-proposals SPP creates on [automatic bodies](#bodies) (their `endDate = start + voteDuration`).
2. **Only if the stage has veto bodies (`vetoThreshold > 0`)**, it *also* becomes a floor on advancing: the proposal can't become advanceable until `voteDuration` has elapsed, guaranteeing vetoers a window to react even if approvals arrive instantly. This is what makes an [optimistic stage](#the-three-stage-shapes) safe.
> **Note:** when a stage has vetoes, the *effective* earliest-advance time is `max(minAdvance, voteDuration)`. Setting `minAdvance` alone does not determine the floor: advancement still waits for `voteDuration` if it is longer. For a veto stage, set `voteDuration` to the veto window you want.
## Bodies
A **body** is a delegate that renders a verdict for a stage:
```solidity
struct Body {
address addr; // the plugin/contract/EOA that decides
bool isManual; // does SPP create a sub-proposal for it, or must it report itself?
bool tryAdvance; // should the body's report also try to advance the proposal?
ResultType resultType; // Approval or Veto (a body is configured as one; the enum's 0-value, None = "not yet reported", is the sentinel the tally keys on)
}
```
- **Automatic body** (`isManual = false`): when the proposal enters the stage, SPP creates a sub-proposal on `addr` automatically. This requires the body to support [`IProposal`](/common/proposal.md) (checked via ERC-165). The details of writing such a body are in [composing bodies](/plugins/spp-plugin/composing-bodies.md).
- **Manual body** (`isManual = true`): SPP creates nothing; some external process (a Safe transaction, a Governor, a person) must call `reportProposalResult` itself. Any address qualifies, with no interface required, so bodies without the proposal interface can still participate.
A body's `resultType` is set at configuration. For an **automatic** body it's binding, the auto-generated callback reports exactly that type, so the body counts as the approval or veto it was registered as. For a **manual** body it's only the *expected* type; what actually counts is whatever type the reporter passes to `reportProposalResult` (a manual body registered as Approval that reports a Veto counts as a veto). Either way, the same address can be an approval body in one stage and a veto body in another, and approval and veto bodies can be **mixed in one stage**, e.g. "token holders approve, but a security council can veto", in a single step.
## The three stage shapes
One `Stage` struct expresses three distinct governance patterns:
- **Normal stage** — bodies are `Approval`, `vetoThreshold = 0`. A plain "N of M must approve" gate.
- **Optimistic stage** — bodies are `Veto`, `approvalThreshold = 0`, `vetoThreshold > 0`. The proposal passes *automatically* unless enough bodies veto it within the [`voteDuration`](#voteduration-the-field-that-does-two-jobs) window. Good for "let it through unless someone objects."
- **Timelock stage** — *no bodies at all*. With nothing to decide, the stage becomes advanceable purely once its `minAdvance` elapses: a pure delay. Chain one before execution and you have a governance timelock.
Per stage you also choose whether it's **cancelable** and/or **editable** (a stage where actions can still be revised, or the whole proposal called off, before it advances). Those capabilities also need their [permissions granted](/plugins/spp-plugin.md#installation--permissions), which install does *not* do by default.
## Rules don't move under an in-flight proposal
Each proposal records the **configuration generation** it was created under (`stageConfigIndex`), and follows that generation for its whole life. When a DAO calls `updateStages` to change its governance, in-flight proposals keep the stages they started with; only new proposals use the new configuration. (Past generations stay readable via `getStages(index)`.) The same snapshot applies to the [execution target](/framework/plugins.md#how-a-plugin-makes-the-dao-act), frozen at creation. An existing proposal's rules stay fixed.
## Keep in mind
- **`voteDuration` can override `minAdvance`.** On a veto stage the effective earliest-advance time is `max(minAdvance, voteDuration)`; tune `voteDuration` to the veto window you want, not just `minAdvance`.
- **Thresholds count bodies, not votes.** Each body contributes one unit once it reports; a 9-signer multisig and a lone EOA each count as 1.
- **A manual body counts by what it *reports*, not what it was registered as**, and no address may appear twice in one stage.
## See also
- [Lifecycle & state machine](/plugins/spp-plugin/lifecycle.md) — how these thresholds and timings drive advancement.
- [Composing bodies](/plugins/spp-plugin/composing-bodies.md) — making a plugin work as an automatic or manual body.
- [SPP overview](/plugins/spp-plugin.md).
# Governance tokens
[Token Voting Plugin](/plugins/token-voting-plugin.md) draws voting power from an `IVotes` token, a token with the checkpointed, delegatable balances OpenZeppelin's `ERC20Votes` provides. Choosing that token is the main decision when you install the plugin, and `TokenVotingSetup` handles three paths automatically based on the token settings you pass:
1. **Mint a new token.** Pass no token address and the setup deploys a fresh **`GovernanceERC20`** and mints an initial supply to the receivers you specify. The DAO gets mint rights. Best for a new DAO issuing its own governance token.
2. **Reuse an existing `IVotes` token.** Pass a token that already speaks `IVotes` and it's used as-is, no new deployment. Best when your community already has a governance token.
3. **Wrap a plain ERC-20.** Pass a token that *isn't* `IVotes` and the setup deploys a **`GovernanceWrappedERC20`** around it. Holders lock the original token into the wrapper to receive voting power. The fallback for governing with a token that was never built for it.
(The setup duck-types these: it probes for `IVotes` functions rather than trusting an ERC-165 flag, since many `IVotes` tokens don't advertise support formally.)
## `GovernanceERC20`: a mintable governance token
A full `ERC20Votes` + `ERC20Permit` token, DAO-managed:
- **Minting is DAO-gated.** `mint` is behind `MINT_PERMISSION_ID`, granted to the DAO at install, so new supply is issued through governance, not by an EOA.
- **Supply can be frozen.** `freezeMinting` is a one-way switch a DAO can flip to credibly commit to a fixed supply, visible right on the token.
## `GovernanceWrappedERC20`: retrofitting votes onto an existing token
Wraps an existing ERC-20 to add `IVotes`. It has **no mint of its own**, supply is entirely a function of how much of the underlying token has been deposited:
- `depositFor(account, amount)` locks the underlying token and mints an equal amount of wrapped, voting-enabled token.
- `withdrawTo(account, amount)` reverses it 1:1.
This works, but it adds real friction: holders must actively wrap (lock) their tokens to participate, so turnout suffers. Prefer a native `GovernanceERC20` for a new token; reach for wrapping only when you're committed to an existing non-governance ERC-20.
## Delegation
[Voting power is delegated, not merely held](/plugins/token-voting-plugin/voting-power.md#delegation). The two tokens differ in **when** that first delegation happens, and whether it's automatic:
- **`GovernanceERC20`** delegates **only on mint**, never on a plain transfer, and only when its `ensureDelegationOnMint` option is set (it then self-delegates a recipient who has no delegate yet). Leave the option off and freshly-minted holders have balance but no power until they manually `delegate()`. Include that step when onboarding holders.
- **`GovernanceWrappedERC20`** delegates **on receive**: it auto-self-delegates whenever a receiver has no delegate yet (no flag to disable it, and it won't override an existing delegation), so wrapping grants power without a separate step (it compensates for the friction of wrapping).
> The zkSync variant of the setup (`TokenVotingSetupZkSync`) differs only in *how* it deploys these token contracts (fresh deployment instead of minimal-proxy clones, for zkEVM compatibility); the governance behavior is identical.
## Keep in mind
- **Delegate, or holders have no power.** Unless `ensureDelegationOnMint` is on (or you use the wrapper), a token holder must delegate before they can vote. Expect to guide users through it.
- **Wrapping means locking.** Voting with `GovernanceWrappedERC20` requires depositing the underlying token; that friction depresses turnout. Don't wrap a token you could instead issue natively.
## See also
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — how the plugin reads voting power from the token.
- [Plugin setup](/framework/plugin-setup.md) — the setup mechanism that deploys and wires all this.
# Voting power (Token Voting Plugin)
[Token Voting Plugin](/plugins/token-voting-plugin.md) draws every voter's weight from a token. Snapshots and delegation determine that weight. The token's clock determines the snapshot timepoint, and excluded accounts affect the total supply used for thresholds. Voting power also determines who is allowed to propose.
The plugin itself holds no balances or vote bookkeeping. It reads power from an `IVotes` token (OpenZeppelin's `ERC20Votes` and equivalents) through three functions: `getVotes` (current power), `getPastVotes` (power at a past point), and `getPastTotalSupply` (total at a past point). Everything below follows from those.
## The snapshot
When a proposal is created it fixes a **snapshot** at the timepoint *just before* creation (`block.number - 1`, or `block.timestamp - 1` for timestamp-based tokens). Every vote on that proposal is then weighed by `getPastVotes(voter, snapshot)`, the voter's power *at that fixed point*, no matter when they actually vote.
The snapshot prevents **double voting with the same tokens**. Suppose Alice has 100 self-delegated tokens and Bob has none at the snapshot. Alice votes with 100 power, then transfers the tokens to Bob. Even if Bob self-delegates them, his power for this proposal is still zero: `getPastVotes` reads the earlier checkpoint. Transferring tokens or moving their delegation cannot make the same power count at a second address.
Using a past timepoint also prevents transactions in the proposal's creation block from changing its electorate. Acquiring or delegating tokens in response to a pending proposal is too late if both transactions enter the same block. Prepare holders **before creation**, even if the proposal's voting start is scheduled for later; waiting for that start does not refresh its snapshot.
A proposal with zero effective total supply at its snapshot reverts with `NoVotingPower`; zero delegated power at an individual account instead makes that account unable to vote.
## Delegation
With `IVotes`, **holding tokens grants zero voting power until the balance is delegated** (even to yourself). `getVotes` reflects *delegated* power, not raw balance. A holder who never delegates has tokens but no vote.
How each token type handles this differs, which matters when choosing a token; see [Governance tokens → delegation](/plugins/token-voting-plugin/governance-tokens.md#delegation). A freshly minted `GovernanceERC20` may leave holders undelegated (unless minting auto-delegates), while the wrapped token auto-delegates on receipt.
## Whose supply counts: excluded accounts
The [participation and approval thresholds](/plugins/majority-voting.md#the-three-thresholds) are measured against effective total voting power. The plugin subtracts the historical delegated power of accounts excluded at installation:
```
totalVotingPower(snapshot) = getPastTotalSupply(snapshot) − Σ getPastVotes(excluded, snapshot)
```
Non-circulating holdings, such as a treasury, vesting contract, or the DAO's own tokens, can make quorum harder to reach if their supply counts but they do not participate. The installation can name accounts whose delegated power should be subtracted, for example a treasury that self-delegates those holdings. This subtracts **historical delegated power**, not `balanceOf`: listing an undelegated treasury does not remove its token balance from the denominator.
The exclusion list cannot be changed after installation. The [worst-case support check](/plugins/voting-modes.md#early-execution) reads the effective snapshot supply again; changing the excluded set could change that check for an existing proposal while its participation and approval amounts remain frozen. Choose the list before installing.
Exclusion adjusts the denominator; it does not prevent the listed accounts from voting. Account for their delegation and voting behavior when choosing the list.
## Block-based vs timestamp-based tokens
`ERC20Votes` tokens historically snapshot by **block number**, but some newer tokens snapshot by **timestamp** (per ERC-6372). The plugin detects which at install: it probes the token's `clock()` / `CLOCK_MODE()` and remembers whether it's timestamp-based (a token that doesn't implement ERC-6372 is treated as block-based). Every place that computes the snapshot then uses the matching unit. If a token's two clock signals disagree (it claims one mode but behaves like the other) the plugin refuses it (`TokenClockMismatch`), a guard against a token misrepresenting how its snapshots work. As a builder you don't manage this, but it's why an `IVotes` token must be *consistent* about its clock.
## Who may propose
`minProposerVotingPower` sets a floor on how much power an address needs to open a proposal, and it's enforced *outside* the voting logic, by a small [permission condition](/common/permission-conditions.md). `TokenVotingSetup` grants `CREATE_PROPOSAL_PERMISSION_ID` to *any address* but attaches a `VotingPowerCondition`; the condition reads the plugin's current `minProposerVotingPower` and checks the caller's power at the [snapshot rule](#the-snapshot) above. A floor of zero means anyone may propose.
This is a clean illustration of the [condition](/common/permission-conditions.md) pattern: "anyone above the bar" is expressed as an open grant plus a condition, and the bar can change (via voting settings) without touching the permission wiring.
## Membership
The Token Voting Plugin implements [`IMembership`](/common/membership.md): `isMember` is true for any address that currently holds a balance *or* has voting power, and the token is announced as the membership-defining contract so indexers know where to look. Note that "is a member" and "can meaningfully vote" differ: someone holding but not [delegating](#delegation) is a member with zero power.
## Keep in mind
- **Delegate, or you have no power.** Power is delegated, not held. Expect to guide token holders through delegating (to themselves, at least) before they can vote.
- **Power is fixed at the snapshot.** Buying or delegating more tokens after a proposal opens does nothing for that proposal, only the snapshot balance counts.
- **The token must be consistent about its clock.** An `IVotes` token that misreports block vs timestamp snapshots is rejected at install.
## See also
- [Token Voting Plugin](/plugins/token-voting-plugin.md) — the plugin overview and lifecycle.
- [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md) — how each token type handles delegation.
- [Majority voting](/plugins/majority-voting.md) — the thresholds total voting power feeds.
- [Permission conditions](/common/permission-conditions.md) — the mechanism gating proposal creation.
# Core
The core of Aragon **OSx** consists of the [DAO](/core/dao.md) contract and its authorization model. Source: [`osx`](https://github.com/aragon/osx) `src/core`.
This is the smallest, most fundamental layer: what a DAO *is* and how it decides who may do what. Read it first; everything else builds on it.
**Exact signatures:** the generated [`osx` ABI reference](/abi/osx/index.md) has every public function, event, error and constant of these contracts, with its NatSpec.
- [The DAO contract](/core/dao.md) — one contract that *is* the organization: treasury, executor, permission database, signer.
- [The permission system](/core/permissions.md) — the `(where, who, permissionId)` model that gates every privileged action. **Start here to understand authorization.**
- [Actions and execution](/core/execution.md) — how a DAO acts on the world: the `Action` batch, `execute`, and partial-failure handling.
- [DAO signature validation (EIP-1271)](/core/signature-validation.md) — how a DAO "signs", by delegating to its permissions.
- [DAO metadata](/core/dao-metadata.md) — the name/description/avatar/links JSON and the EIP-4824 `daoURI`, and why the app-facing blob isn't stored onchain.
## The other two layers
The rest of the `osx` repo sits in two sibling areas:
- **[Common](/common/index.md)** — the shared cross-cutting primitives (now within osx at `src/common`, formerly the standalone osx-commons library) that the core, framework, and plugins reuse: conditions, proposals, membership, ratio, auth, and low-level utilities.
- **[Framework](/framework/index.md)** — what a plugin *is* and how it's built and installed: the plugin model, base types, and setup, plus the PluginRepo, the PluginSetupProcessor, the factories, and the registries.
From there, [plugins](/plugins/index.md) are the concrete governance modules built on all three.
# The DAO contract
A DAO in Aragon OSx is **a single smart contract**, one `DAO` contract that *is* the organization, rather than a collection of contracts or an off-chain entity with an onchain treasury. Everything a DAO can do reduces to functionality this contract exposes or delegates.
That contract serves several roles:
- **The treasury.** It holds the organization's assets (native coin and tokens) and receives deposits.
- **The executor.** It performs arbitrary onchain actions on behalf of the organization; see [Actions and execution](/core/execution.md). This is how a passed proposal takes effect.
- **Its own permission database.** `DAO` inherits [`PermissionManager`](/core/permissions.md), so the rules for who may do what live in the DAO contract's own storage. A DAO is self-authorizing.
- **A signer.** It can validate signatures on the organization's behalf via [EIP-1271](/core/signature-validation.md).
- **A discoverable, upgradeable identity.** It implements [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824) (`daoURI`) for off-chain metadata, and is deployed behind a [UUPS proxy](/common/proxies.md) so it can be upgraded.
Holding assets, executing arbitrary actions, and owning the rules for who may do what make the DAO a durable onchain **organization**. Upgradeability through the proxy helps that organization endure. If proxies are new to you, read [Proxy deployment](/common/proxies.md) first, then come back.
Everything else, including governance, membership, and asset management, is added by [plugins](/framework/plugins.md). The DAO itself stays deliberately small: it holds funds, executes actions, and answers "is this allowed?".
## Why one contract holds everything
**The DAO is also its own `PermissionManager`**, so one authorization model governs the DAO's own admin functions, its plugins' functions, and even framework contracts. A plugin doesn't keep its own access-control list; it asks the DAO "does this caller have permission?" (see [Authorizing against a DAO](/common/auth.md)). There is exactly one source of truth for authority per organization, and it is the DAO.
## Deployment and bootstrapping ROOT
A DAO has to *start* with someone holding ROOT: a brand-new DAO has an empty permission database, and someone must make the first grants. Yet the safe *end* state is the DAO holding ROOT over itself, so it self-governs and no outside key can override it. Bootstrapping is getting cleanly from the first to the second, and OSx does it for you in one atomic step (below).
`DAO` is deployed behind a UUPS proxy. The implementation's constructor calls `_disableInitializers()` (so only proxies are ever initialized, the standard OpenZeppelin upgradeable-safety pattern), and each proxy is set up through `initialize`:
```solidity
function initialize(
bytes calldata _metadata,
address _initialOwner,
address _trustedForwarder,
string calldata daoURI_
) external;
```
`initialize` grants `ROOT_PERMISSION_ID` to `_initialOwner`. **ROOT controls the permission table** (see [Permissions](/core/permissions.md)): whoever holds it can grant or revoke any permission. A freshly initialized DAO therefore has its initial owner in total control. That control allows the owner to bootstrap the DAO, but leaving it in place is dangerous.
In the intended lifecycle, the initial owner sets the DAO up, transfers ROOT **to the DAO itself** (so the organization self-governs), and revokes its own ROOT. In practice you never do this by hand: the [DAOFactory](/framework/dao-factory.md) performs the sequence atomically in one transaction. **A DAO where an EOA still holds ROOT is a DAO that EOA fully controls.**
> Granting ROOT to the DAO over itself is what lets a DAO manage its own permissions through governance: a proposal can execute `grant`/`revoke` actions on the DAO.
### Where ROOT ends up
Once bootstrapped, ROOT on a DAO can rest in one of three end states, and the choice sets how mutable the organization is:
- **The DAO itself** (the usual case). The organization self-governs: every permission change, plugin install, update, or uninstall happens only through a passed proposal that executes `grant`/`revoke` **as the DAO**.
- **A parent DAO.** A DAO can grant ROOT to *another* DAO and revoke its own, making itself **subordinate**: the parent now controls its permission setup. This is the building block for sub-DAOs and hierarchical organizations.
- **Nobody, on purpose.** ROOT is an ordinary permission and `revoke` has no floor, so a DAO can revoke ROOT from *every* holder, itself included. With no ROOT anywhere, `grant`, `revoke`, `grantWithCondition`, and the `apply*` batch functions become **permanently uncallable** (all are `auth(ROOT_PERMISSION_ID)`, and [`isGranted`](/core/permissions.md) gives ROOT no bypass). The permission table is **frozen forever**: no new plugins, no updates or uninstalls, no rewiring, ever.
That last option is deliberate: revoking ROOT entirely is how you make a permission setup **immutable**. It freezes the *structure*, not activity: the DAO can still `execute` actions and its installed plugins keep working (those are gated by `EXECUTE` and their own permissions, not ROOT). The DAO can never change who may do what again. It is also irreversible: with no ROOT, nothing can ever grant ROOT back.
## Permissions the DAO defines
Each of the DAO's own privileged functions is gated by a permission (via the `auth` modifier from [`PermissionManager`](/core/permissions.md)):
| Permission | Gates |
|---|---|
| `EXECUTE_PERMISSION_ID` | `execute()`, see [Actions and execution](/core/execution.md). The most consequential permission in the protocol. |
| `UPGRADE_DAO_PERMISSION_ID` | Upgrading the DAO's implementation (UUPS). |
| `SET_METADATA_PERMISSION_ID` | `setMetadata()` and `setDaoURI()`. |
| `SET_TRUSTED_FORWARDER_PERMISSION_ID` | Setting the ERC-2771 meta-transaction forwarder. |
| `REGISTER_STANDARD_CALLBACK_PERMISSION_ID` | Registering new callback handlers (below). |
| `VALIDATE_SIGNATURE_PERMISSION_ID` | Used *inside* [signature validation](/core/signature-validation.md), not a function gate. |
The first five can **never** be granted to the `ANY_ADDR` wildcard (the DAO overrides `isPermissionRestrictedForAnyAddr` to forbid it): letting "anyone" execute arbitrary calls or upgrade the contract would be catastrophic. `VALIDATE_SIGNATURE_PERMISSION_ID` is deliberately *excluded* from that restriction so it can back a generic signature validator. `ROOT_PERMISSION_ID` is always wildcard-restricted, with no override. See [Permissions](/core/permissions.md) for the `ANY_ADDR` model.
## Holding assets
- **`deposit(token, amount, reference)`** is the tracked deposit path. Native coin (`token == address(0)`) requires `msg.value == amount`; an ERC-20 pulls via `safeTransferFrom` and requires `msg.value == 0`. Emits `Deposited`, and is **permissionless**, anyone can fund a DAO.
- **`receive()`** handles plain native-coin transfers and just emits `NativeTokenDeposited`. (It does no bookkeeping. Beware the 2300-gas stipend that `.transfer`/`.send` senders impose: such a transfer to the DAO can run out of gas in `receive`; a sender using a normal `call` is unaffected.)
Assets *leave* the DAO only through [`execute`](/core/execution.md), which is permission-gated, so funding is open while spending is governed.
## Adaptive token callbacks
To receive ERC-721 / ERC-1155 tokens a contract must answer callbacks like `onERC721Received` with a specific magic value. Rather than hard-coding these, the DAO mixes in a `CallbackHandler`: a registry mapping a callback selector to the magic value it must return. The ERC-721/1155 receiver callbacks are registered at `initialize`, and `registerStandardCallback` (gated by `REGISTER_STANDARD_CALLBACK_PERMISSION_ID`) lets a DAO support **future** token/callback standards without a contract upgrade. Unregistered callbacks revert `UnknownCallback`.
## Metadata and discovery
`setMetadata` takes an opaque `bytes` blob (conventionally an IPFS CID) and only *emits* it as the `MetadataSet` event. It is not stored onchain, so reading a DAO's current metadata means indexing that event. `daoURI()` implements EIP-4824 for standardized off-chain DAO discovery. See [DAO metadata](/core/dao-metadata.md) for the JSON shape and the `daoURI`-vs-blob distinction.
## Upgrades across versions
`_authorizeUpgrade` is gated by `UPGRADE_DAO_PERMISSION_ID`. After an implementation upgrade, `initializeFrom(previousVersion, initData)` migrates storage; it refuses to upgrade across a major version (`ProtocolVersionUpgradeNotSupported` if the previous major isn't `1`). This is also where the contract keeps ERC-165 interface IDs and storage layout stable across versions (removed fields become reserved slots like `__removed0`; new state goes in the storage `__gap`). See [Protocol version](/common/protocol-version.md).
## Keep in mind
- **ROOT left with an EOA is total control of the DAO.** After any setup, confirm ROOT sits with the DAO itself, not the deployer. Otherwise, the deployer retains private control over an organization meant to govern itself.
- **Metadata is event-only.** Read a DAO's current metadata by indexing the `MetadataSet` event; it isn't stored onchain.
## See also
- [Permissions](/core/permissions.md), the authorization model the DAO inherits.
- [Actions and execution](/core/execution.md), how the DAO acts on the world.
- [Plugins](/framework/plugins.md), how functionality is added.
- [DAOFactory](/framework/dao-factory.md), how a DAO is actually deployed and bootstrapped.
# The permission system
Every privileged action in Aragon OSx is gated by **one** mechanism: the `PermissionManager`. This includes DAO admin functions, plugin functions, and functions on framework contracts like [PluginRepo](/framework/plugin-repo.md). The same access-control model applies throughout the protocol.
A permission is a triple, optionally guarded by a [condition](/common/permission-conditions.md):
```
(where, who, permissionId) -> allowed? / denied? / ask a condition
```
- **`where`** — the contract the action happens *on* (usually the DAO itself, or a plugin).
- **`who`** — the caller being authorized (an EOA or a contract).
- **`permissionId`** — `keccak256("SOME_PERMISSION")`, naming the capability (e.g. `EXECUTE_PERMISSION_ID`).
The [DAO](/core/dao.md) *is* a `PermissionManager` (it inherits it), so a DAO's permissions live in the DAO contract's own storage. Plugins don't inherit it; they defer to their DAO, see [Authorizing against a DAO](/common/auth.md).
## How a decision is made
The core query is:
```solidity
function isGranted(address _where, address _who, bytes32 _permissionId, bytes _data)
public view returns (bool);
```
`isGranted` *is* the resolver. The DAO's [`IDAO`](/common/auth.md) interface re-exposes the identical query as **`hasPermission`**, a one-line forwarder to it. External callers and every plugin's [`auth`](/common/auth.md) check call `hasPermission`, which calls `isGranted` with the same arguments and returns the same answer. A **condition's** `isGranted` is a different method sharing the signature: it is the *hook* this resolver calls when a grant is [conditional](/common/permission-conditions.md), not the resolver itself.
Internally each grant is stored under a hash of `(where, who, permissionId)` mapping to one of three things:
- **unset** (`address(0)`) — not granted.
- **allow** (`address(2)`) — granted unconditionally.
- **a condition contract address** — ask that [condition](/common/permission-conditions.md) at call time.
(Why an address, not a bool? The slot has to hold a *condition contract address* for the conditional case, so the two non-conditional outcomes reuse the same slot as reserved sentinel addresses: `address(0)` = unset, `address(2)` = allow-without-condition.)
`isGranted` resolves in **three tiers, first match wins**:
1. **Specific:** `(where, who, permissionId)`.
2. **Any caller:** `(where, ANY_ADDR, permissionId)` — "anyone, on this target".
3. **Any target:** `(ANY_ADDR, who, permissionId)` — "this caller, anywhere". Only reachable via a condition (see below).
If none is set, the answer is `false`.
> **The tiers do not merge.** If the *specific* slot is set but its condition returns `false`, `isGranted` returns `false` immediately. It does **not** fall through to a broader tier that might have allowed it. Whichever tier is set first (specific → any-caller → any-target) decides the outcome outright. A wildcard grant and a specific grant coexist as separate entries; they do not override or combine.
## The wildcard: `ANY_ADDR`
`ANY_ADDR` is `address(type(uint160).max)` (all F's) and stands for "any address" in the `who` or `where` slot. The rules that keep it safe:
- A plain `grant` can **never** set `where == ANY_ADDR`, only [`grantWithCondition`](/common/permission-conditions.md) can. ("This caller, on any contract" is only allowed if a condition constrains it.)
- `who` **and** `where` can't both be `ANY_ADDR` at once (that would be "anyone, anywhere").
- `ROOT_PERMISSION_ID` can never go to `ANY_ADDR`, ever, no override.
- Individual contracts blacklist their own sensitive permissions from wildcard grants by overriding `isPermissionRestrictedForAnyAddr` (the [DAO](/core/dao.md) restricts `EXECUTE`, `UPGRADE_DAO`, and three others).
## ROOT: the permission to manage permissions
`ROOT_PERMISSION_ID` gates `grant`, `grantWithCondition`, `revoke`, and the batch apply functions. Holding ROOT on a `where` means you can grant or revoke every permission on that contract.
**ROOT is not a runtime bypass.** It does *not* make you pass *other* permission checks: `isGranted` never consults ROOT, so a ROOT holder who lacks `EXECUTE` still cannot call `execute` directly. What ROOT lets you do is **grant yourself** (or anyone) that permission first, then use it. ROOT controls the permission *table*. For the same reason, a plugin upgrade needs `UPGRADE_PLUGIN_PERMISSION` explicitly; holding ROOT alone does not authorize the upgrade. A condition attached to your ROOT grant constrains that granting power itself; it never enters the `EXECUTE` check, which ignores ROOT regardless.
In a healthy DAO, **ROOT is held by the DAO itself**, so permission changes happen only through governance (a proposal that executes a `grant`/`revoke`). See the [DAO](/core/dao.md#deployment-and-bootstrapping-root) bootstrapping note for how ROOT gets there safely.
## Granting and revoking
All of these require the caller to hold `ROOT_PERMISSION_ID` on the target:
```solidity
grant(where, who, permissionId); // unconditional
grantWithCondition(where, who, permissionId, condition); // guarded, see conditions
revoke(where, who, permissionId);
```
A few semantics:
- **Grants and revocations are idempotent.** Granting an already-granted permission is a silent no-op (no revert, no new event); same for revoking an unset one. In particular, a plain `grant` over a permission that is currently *conditional* is **also** a no-op: it does **not** strip the condition down to unconditional-allow. Trying to "remove a condition" by re-granting plainly leaves the old condition fully in force, silently. To drop or change a condition you must `revoke` first, then re-grant (see the rotation note below).
- **Conditions are immutable once set.** `grantWithCondition` on a permission already granted with a *different* condition **reverts** (`PermissionAlreadyGrantedForDifferentCondition`). To change a condition you must `revoke` first, then re-grant. This stops a second ROOT holder from silently swapping the condition out. That `revoke` drops the entry to *unset*, so, unless a broader [wildcard tier](#the-wildcard-any_addr) still covers that caller, the permission is **denied in the gap between the two calls**. Rotate a condition by putting the `revoke` and the re-`grantWithCondition` in the *same* [action batch](/core/execution.md) (one proposal), never two transactions, to avoid that interruption.
### Batch changes: `PermissionLib`
Setups and factories rarely grant one at a time. `PermissionLib` defines the payload shapes for batch operations, and the [plugin setup](/framework/plugin-setup.md) flow is built entirely on them:
```solidity
enum Operation { Grant, Revoke, GrantWithCondition }
struct SingleTargetPermission { Operation operation; address who; bytes32 permissionId; }
struct MultiTargetPermission { Operation operation; address where; address who; address condition; bytes32 permissionId; }
```
- `applySingleTargetPermissions(where, SingleTargetPermission[])` — many changes on one target; grant/revoke only (no conditions).
- `applyMultiTargetPermissions(MultiTargetPermission[])` — changes across many targets, conditions supported. A conditional grant here **must** use the `GrantWithCondition` op: a plain `Grant` op carrying a non-zero `condition` reverts `GrantWithConditionNotSupported`, rather than silently granting unconditionally. So a hand-built [setup](/framework/plugin-setup.md) array can't accidentally look conditional while granting a wide-open permission.
`MultiTargetPermission[]` is exactly what a [plugin setup](/framework/plugin-setup.md) returns and what the [PluginSetupProcessor](/framework/plugin-setup-processor.md) applies when installing a plugin.
## Checking permissions from your own contract
If your contract inherits `PermissionManager` (or is a DAO), gate a function with the `auth` modifier:
```solidity
function doPrivileged() external auth(DO_PRIVILEGED_PERMISSION_ID) { ... }
```
`auth` calls `isGranted(address(this), msg.sender, permissionId, msg.data)` and reverts `Unauthorized` if false. Because the full `msg.data` is passed through, a [condition](/common/permission-conditions.md) attached to that permission can inspect the exact call arguments. Plugins gate their functions the same way but resolve against their DAO, through a **same-named** `auth` from [`DaoAuthorizable`](/common/auth.md#which-auth-unauthorized-vs-daounauthorized) that reverts **`DaoUnauthorized`** (carrying a `dao` field) instead of this `Unauthorized`.
## Keep in mind
- **The three tiers don't merge.** A specific grant guarded by a condition that returns false is denied outright, it does *not* fall through to a broader wildcard grant that would have said yes. Turn this around and it's a *tool*: a specific grant **carves one caller out** of a wildcard. Grant `(where, ANY_ADDR, perm)` so everyone may act, then add `(where, alice, perm)` with a restrictive condition, and alice alone is held to the stricter rule while everyone else rides the wildcard (or the reverse, a permissive carve-out under a conditioned wildcard).
- **Conditions fail closed.** A condition that reverts or misbehaves counts as "denied", never as an error.
- **ROOT with an EOA is total control.** Whoever holds ROOT can rewrite every permission; in a healthy DAO that is the DAO itself.
- **Grants are idempotent and silent.** Re-granting an existing permission emits no new event; don't rely on `Granted` firing.
- **The permission DB is a public authorization service, not just an internal ACL.** `isGranted` / `hasPermission` are `view` and callable by anyone, so *other* contracts can gate themselves on a DAO's permissions without the DAO's involvement, which is exactly how [EIP-1271 signature validation](/core/signature-validation.md) and every plugin's [`auth`](/common/auth.md) already work. A permission is a queryable fact the whole chain can build on, which is why "who may do what on this DAO" is reusable far beyond the DAO's own functions.
## See also
- [Permission conditions](/common/permission-conditions.md) — dynamic, onchain authorization logic.
- [OSx compared](/osx-compared.md) — this model against OpenZeppelin, Safe + Zodiac and Hats.
- [Authorizing against a DAO](/common/auth.md) — how plugins use this system.
- [The DAO contract](/core/dao.md) — the primary `PermissionManager` instance.
# Actions and execution
A DAO sends funds, calls other contracts, and changes its own permissions by executing **actions**. Everything it does onchain uses these actions. An action is one external call:
```solidity
struct Action {
address to; // the target contract (or EOA)
uint256 value; // native coin to send
bytes data; // calldata: selector + arguments
}
```
A DAO executes a *batch* of actions atomically through [`execute`](#the-execute-function). This is the single channel by which a passed proposal takes effect: a [governance plugin](/framework/plugins.md) holding `EXECUTE_PERMISSION_ID` calls `execute` with the actions the proposal approved.
## The `execute` function
```solidity
function execute(bytes32 _callId, Action[] calldata _actions, uint256 _allowFailureMap)
external
returns (bytes[] memory execResults, uint256 failureMap);
```
On the [DAO](/core/dao.md) this is gated by `EXECUTE_PERMISSION_ID` and is `nonReentrant`. It loops over `_actions` and performs each as a low-level call:
```solidity
(bool success, bytes memory result) = to.call{value: value}(data);
```
Key facts:
- **It's a `call`, not a `delegatecall`.** Actions run *as the DAO*: `msg.sender` at the target is the DAO's address, and value comes from the DAO's balance. This is why a DAO can call *itself* (e.g. an action targeting the DAO's own `grant`) to self-govern.
- **`_callId`** is caller-defined and only echoed in the `Executed` event. Governance plugins typically set it to the proposal id for traceability. The DAO does not interpret it.
- **`MAX_ACTIONS = 256`** per call (bounded by the 256-bit failure bitmap); more reverts `TooManyActions`.
- **`execute` is `nonReentrant`, but self-governance still works.** An action may freely call back into the DAO's *other* functions, and that is exactly how a DAO governs itself: an action targeting the DAO's own `grant`/`revoke` runs as the DAO, which holds ROOT over itself, and succeeds. What an action may *not* do is re-enter `execute`. The guard is a `_reentrancyStatus` flag on the function itself, not tied to the caller or their permissions, so *even a plugin holding `EXECUTE_PERMISSION_ID`* re-enters the same guarded function and reverts `ReentrantCall`. Genuinely nested execution therefore has to run on a *different* executor: target another DAO, or `delegatecall` the standalone [`Executor`](#the-standalone-executor), which keeps its guard in a separate storage slot. The guard scopes to `execute` alone, so permission changes and metadata updates mid-batch are unaffected.
## Failsafe actions
By default, if any action reverts the whole batch reverts. Sometimes you want an action to be **failsafe**: permitted to fail without reverting the rest of the proposal. The `_allowFailureMap` parameter, the **failsafe action map**, is a bitmap where **bit `i` set marks action `i` as failsafe**:
- A failsafe action that reverts is recorded (its bit is set in the returned `failureMap`) and execution continues.
- A *non-failsafe* action that reverts throws `ActionFailed(i)` and rolls back the whole batch.
The returned `failureMap` reports which failsafe actions actually failed. (Bit helpers live in `BitMap`: `hasBit`, `flipBit`.)
```solidity
// Actions 0 and 2 must succeed; action 1 is failsafe (may fail without reverting the batch).
uint256 allowFailureMap = 1 << 1; // set bit 1
(bytes[] memory results, uint256 failures) = dao.execute(callId, actions, allowFailureMap);
// failures now has bit 1 set iff action 1 reverted.
```
> **Security: the 63/64 gas-griefing guard.** When a failsafe action fails, `execute` checks it wasn't merely starved of gas (`gasleft` after the call must be at least 1/64 of before) and reverts `InsufficientGas` otherwise. Without this, an attacker could hand-tune the gas limit so a subcall runs out of gas (EIP-150 keeps 1/64 for the caller), letting `execute` finish and record a *real* failure as a harmless failsafe skip. So a failure recorded in `failureMap` is guaranteed genuine, not gas starvation.
## The standalone `Executor`
`Action` and the `execute` signature are defined in `IExecutor`, and there is a second implementation: `Executor`, a **permissionless, standalone** executor.
- It runs the *same* action-loop (same `MAX_ACTIONS`, same failsafe semantics, same gas guard) but has **no permission check**: anyone can call it.
- It is meant to be used via **`delegatecall`** from another contract, lending its execute-loop logic while running in the caller's context. To stay `delegatecall`-safe it stores its reentrancy guard in a fixed namespaced storage slot (via assembly) rather than a normal state variable, so it never collides with the caller's storage layout.
- OSx deploys **one shared instance** of it per network, known as the **`GlobalExecutor`** (that's its deploy name and the protocol-factory `globalExecutor` field; deployment artifacts key the address as `executor`). A plugin whose [`TargetConfig`](/framework/plugins.md#how-a-plugin-makes-the-dao-act) uses `DelegateCall` borrows *that* instance's loop, so it never ships its own, and the contract itself is just called `Executor` in the source.
`DAO.execute` (permissioned, called directly) and `Executor` (permissionless, delegatecalled) share the `IExecutor` interface but differ in how they are called and authorized. Plugins can target either; see [how plugins execute](/framework/plugins.md#how-a-plugin-makes-the-dao-act).
## Keep in mind
- **Actions run as the DAO** (`call`, not `delegatecall`): at the target, `msg.sender` is the DAO and value comes from its balance. Plan targets and their access control around that.
- **A recorded failsafe failure is genuine.** The 63/64 gas guard means a failure in `failureMap` was a real revert, not gas starvation, so you can trust it.
## See also
- [The DAO contract](/core/dao.md) — holds `EXECUTE_PERMISSION_ID` and the assets actions spend.
- [Permissions](/core/permissions.md) — what gates `execute`.
- [Plugins](/framework/plugins.md) — who calls `execute`, and how a proposal's actions get here.
# DAO signature validation (EIP-1271)
A DAO is a contract, so it has no private key and cannot produce ECDSA signatures. [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271) is the standard by which a contract answers "is this signature valid for me?" via `isValidSignature(hash, signature)`. Many integrations (Safe modules, exchanges, off-chain order books) call it to check whether a smart-contract account approved something.
OSx implements EIP-1271 without any signature logic of its own: **the DAO delegates the decision to its own [permission system](/core/permissions.md).**
## How it works
```solidity
function isValidSignature(bytes32 _hash, bytes memory _signature) external view returns (bytes4) {
if (isGranted(address(this), msg.sender, VALIDATE_SIGNATURE_PERMISSION_ID,
abi.encode(_hash, _signature)))
return 0x1626ba7e; // EIP-1271 "valid" magic value
return 0xffffffff; // invalid
}
```
Read the permission tuple carefully:
- **`where`** is the DAO itself.
- **`who`** is `msg.sender`, the contract *asking* whether the signature is valid (the Safe, the exchange), **not** a signer.
- **`_data`** carries the `(hash, signature)` pair, so a [condition](/common/permission-conditions.md) can actually inspect and verify the signature.
So "the DAO's signature is valid to caller X" is expressed as "X is granted `VALIDATE_SIGNATURE_PERMISSION_ID` on the DAO."
## Configuring it
Three shapes, depending on how much logic you want:
```solidity
// 1. Trust a specific caller unconditionally: any signature it presents is "valid".
dao.grant(dao, someCaller, VALIDATE_SIGNATURE_PERMISSION_ID);
// 2. Caller-specific validation logic: the condition inspects (hash, signature).
dao.grantWithCondition(dao, someCaller, VALIDATE_SIGNATURE_PERMISSION_ID, validator);
// 3. A generic validator usable by ANY caller.
dao.grantWithCondition(dao, ANY_ADDR, VALIDATE_SIGNATURE_PERMISSION_ID, validator);
```
`VALIDATE_SIGNATURE_PERMISSION_ID` is one of the few permissions the DAO deliberately **allows** to be granted to `ANY_ADDR`, so a generic signature validator can serve every caller. A "signature validator plugin" is a [condition](/common/permission-conditions.md) configured in this way.
> Legacy note: older OSx exposed `setSignatureValidator`. It was removed in v1.4.0 (the function now reverts, kept only to preserve the interface id); this permission-based approach replaces it.
## Keep in mind
- **`who` is the asker, not the signer.** Grant `VALIDATE_SIGNATURE_PERMISSION_ID` to the contract that *calls* `isValidSignature` (the Safe, the exchange), not to whoever produced a signature.
- **Validation is fail-closed and silent.** With no matching grant (or a condition that reverts) the DAO returns "invalid"; an incorrectly configured validator rejects everything with no error to explain why.
## See also
- [Permission conditions](/common/permission-conditions.md) — where the actual signature-checking logic lives.
- [The permission system](/core/permissions.md) — the `ANY_ADDR` wildcard and `grantWithCondition`.
# DAO metadata
A DAO's name, description, logo, and links are **not** stored as onchain fields. The [DAO contract](/core/dao.md) uses two pointers to off-chain JSON: one for the Aragon app and one for an interoperability standard. Only one pointer is stored in contract storage; the other must be read from events.
## Surface 1: the Aragon metadata blob (event-only)
`setMetadata(bytes)` (gated by `SET_METADATA_PERMISSION_ID`; also set at `initialize`) takes an opaque `bytes` value. That value is a **pointer, not the metadata itself**: by convention it's the UTF-8 of an `ipfs://` URI (an IPFS content id), and the chain never holds the JSON, only the pointer. On top of that, `setMetadata` **only emits** the value as `MetadataSet(metadata)`; it's *not* written to storage either. So there's no `getMetadata()` on a DAO: read the current pointer by indexing the **latest `MetadataSet` event**, then fetch the `ipfs://…` it names.
That `ipfs://…` resolves to a JSON object in this shape (a real example, the Management DAO):
```json
{
"name": "Aragon Management DAO",
"description": "Aragon OSx includes a group of global smart contracts …",
"avatar": "https://ipfs.eth.aragon.network/ipfs/Qm…/",
"links": [
{ "name": "Web site", "url": "https://www.aragon.org" },
{ "name": "Developer Portal", "url": "https://devs.aragon.org/" }
]
}
```
- `name`, `description` — display text.
- `avatar` — a URL (often IPFS) to the DAO's logo.
- `links` — an array of `{ name, url }` for the DAO's sites/socials.
Nothing onchain validates this shape; the contract treats the CID as opaque. It's a convention that Aragon's app and ecosystem tools read.
## Surface 2: the EIP-4824 `daoURI` (stored, standardized)
Separately, the DAO implements [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824): `daoURI()` returns a **stored** URI (set at `initialize`, updatable via `setDaoURI`, same `SET_METADATA_PERMISSION_ID`) that points to a standardized JSON-LD document. That document fans out into `membersURI`, `proposalsURI`, `activityLogURI`, and `governanceURI`, a cross-tool schema for machine-readable discovery of a DAO's members, proposals, activity, and governance docs.
So a DAO carries **two** metadata surfaces for two audiences: the Aragon blob is app/branding metadata (event-only), and `daoURI` is the interoperable standard any DAO tool can consume (stored, with a getter). Both are gated by the same `SET_METADATA_PERMISSION_ID`, so both change through the DAO's governance.
## A minimal skeleton to copy
```json
{
"name": "My DAO",
"description": "One-line description of the organization.",
"avatar": "ipfs://",
"links": [ { "name": "Website", "url": "https://example.org" } ]
}
```
Pin it with `just ipfs-pin ` (it uploads and returns the `ipfs://` URI), then pass that URI (ABI-encoded as `bytes`) as the `metadata` at the DAO's `initialize` / a factory, or later via `setMetadata`. The `daoURI` is set the same way, pointing at its own EIP-4824 document.
## Keep in mind
- **The Aragon blob is event-only, the `daoURI` is stored.** Read the former by indexing `MetadataSet`; read the latter with `daoURI()`. There is no metadata getter.
- **Both point off-chain (usually IPFS).** The chain stores a CID/URI, not the content, so availability depends on the JSON staying pinned.
- **No onchain schema check.** The DAO never parses the JSON; a malformed blob renders badly in tooling but won't revert anything.
- **No formal schema file, just a convention.** The blob's shape is the de-facto standard shown above; the canonical live example is the Management DAO's `management-dao-metadata.json`. The `daoURI` document, by contrast, follows the published [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824) schema.
## See also
- [The DAO contract](/core/dao.md) — where `setMetadata` / `daoURI` live and how they're permissioned.
- [Plugin metadata](/framework/plugin-metadata.md) — the plugin-side counterpart (version JSON + onchain instance metadata), which *does* store instance metadata.
# Common
The **shared cross-cutting primitives** of Aragon OSx. These were once a separate `osx-commons` library; they now live **within osx itself**, at `src/common` in the [`osx`](https://github.com/aragon/osx) repo. There is no separate osx-commons package to install. In Solidity you import them directly from osx, `@aragon/osx/common/…`. They are the reusable pieces the [core](/core/index.md), the [framework](/framework/index.md), and every [plugin](/plugins/index.md) draw on: authorization, governance primitives, and low-level utilities.
_The base contracts, setup, and plugin model are covered in the [framework](/framework/index.md): a plugin uses that framework to operate a DAO. This area covers the primitives it reuses._
**Exact signatures:** the generated [`osx` ABI reference](/abi/osx/index.md) has every public function, event, error and constant of these contracts, with its NatSpec.
## Authorization building blocks
- [Authorizing against a DAO](/common/auth.md) — `DaoAuthorizable` and the `auth` modifier: how any contract defers access control to a DAO.
- [Permission conditions](/common/permission-conditions.md) — dynamic, onchain authorization logic (`IPermissionCondition`).
- [RuledCondition](/common/ruled-condition.md) — a declarative rule engine for composing conditions.
## Governance primitives
- [Proposals](/common/proposal.md) — the shared proposal shape and lifecycle every governance plugin reuses.
- [Membership and the address list](/common/membership.md) — snapshot-safe membership.
- [Ratio](/common/ratio.md) — fixed-point threshold math (`RATIO_BASE`).
## Low-level utilities
- [Proxy deployment](/common/proxies.md) — UUPS and minimal-proxy mechanics, and the storage-layout discipline they require.
- [Protocol version](/common/protocol-version.md) — the protocol-version convention (distinct from a plugin's release/build).
## Where these are used
The [core](/core/index.md), the [framework](/framework/index.md), and every [plugin](/plugins/index.md) build on these, deferring access control to a DAO, reusing the governance primitives, and wiring conditions from here.
# Authorizing against a DAO
A [plugin](/framework/plugins.md) does **not** keep its own access-control list. It defers every authorization decision to its DAO's [permission system](/core/permissions.md). `DaoAuthorizable` is the small base contract that connects the plugin to its DAO for these checks.
## The pattern
Inherit `DaoAuthorizable` (or its upgradeable variant), store a reference to your DAO, and gate functions with the `auth` modifier:
```solidity
contract MyPlugin is DaoAuthorizableUpgradeable {
bytes32 public constant DO_THING_PERMISSION_ID = keccak256("DO_THING_PERMISSION");
function initialize(IDAO _dao) external initializer {
__DaoAuthorizableUpgradeable_init(_dao);
}
function doThing() external auth(DO_THING_PERMISSION_ID) {
// only callers the DAO has granted DO_THING_PERMISSION_ID on this plugin
}
}
```
The `auth(permissionId)` modifier calls:
```solidity
dao().hasPermission(
address(this), // where = the plugin
_msgSender(), // who = the caller
permissionId,
_msgData() // data = full calldata, available to a condition
);
```
and reverts `DaoUnauthorized` if the DAO says no. So **the plugin is the `where`** and its DAO is the authority. To let Alice call `doThing`, the DAO's ROOT holder grants `(myPlugin, alice, DO_THING_PERMISSION_ID)`; see [granting](/core/permissions.md#granting-and-revoking).
This is also how a governance plugin becomes able to act: the DAO grants the plugin `EXECUTE_PERMISSION_ID` on the DAO, so the plugin may call [`dao.execute(...)`](/core/execution.md).
## Two variants
| | `DaoAuthorizable` | `DaoAuthorizableUpgradeable` |
|---|---|---|
| For | non-upgradeable contracts (`new`) | proxy-based contracts (clones, UUPS) |
| DAO stored as | `immutable`, set in constructor | storage var, set in initializer |
| Wire-up | `constructor(IDAO _dao)` | `__DaoAuthorizableUpgradeable_init(_dao)` |
Pick the one matching your [plugin type](/framework/plugin-types.md). The three plugin base contracts already inherit the right variant, so extending a plugin base normally provides `auth` without additional implementation.
Both are meta-transaction aware (they use OpenZeppelin `Context`'s `_msgSender()`/`_msgData()`), so they work behind an ERC-2771 trusted forwarder.
## Which `auth`? (`Unauthorized` vs `DaoUnauthorized`)
`auth`, and its underscore helper `_auth`, appear in **two** places, and which one you're looking at tells you who the authority is:
- **`DaoAuthorizable.auth` (this page)** — for a contract that defers to a *separate* DAO: plugins, and anything else built on `DaoAuthorizable`. The modifier calls the free function `_auth(dao, where, who, permissionId, data)` in `auth.sol`, which asks `dao.hasPermission(...)` and, on failure, reverts **`DaoUnauthorized(dao, where, who, permissionId)`**. The extra **`dao`** field is there because the reverting contract isn't the DAO, so the error has to say *which* DAO denied the call.
- **`PermissionManager.auth`** ([core](/core/permissions.md#checking-permissions-from-your-own-contract)) — for the DAO, which *is* its own permission manager, gating its **own** privileged functions. Its modifier calls an internal `_auth(permissionId)` that checks `msg.sender` against `address(this)` and reverts **`Unauthorized(where, who, permissionId)`**, no `dao` field, because here the contract *is* the DAO (`where` is it).
It's the same-named modifier and the same `_auth` convention (the underscore version is the implementation the modifier delegates to), on opposite sides of the coupling. As a rule of thumb, **`DaoUnauthorized` comes from a contract authorizing against a DAO elsewhere; `Unauthorized` comes from the permission manager authorizing itself.**
## Keep in mind
- **Forgetting `__DaoAuthorizableUpgradeable_init(_dao)`** in your `initialize` leaves the DAO reference at `address(0)`, so every `auth` check calls `address(0).hasPermission(...)` and reverts. If a freshly installed plugin reverts on every gated call, check the init.
- **The plugin is the `where`.** Permissions on a plugin's functions are keyed to the plugin's address, not the DAO's; grant on the plugin, not on the DAO.
## See also
- [The permission system](/core/permissions.md) — what `hasPermission` resolves.
- [Permission conditions](/common/permission-conditions.md) — the `_msgData()` passed through lets a condition inspect call arguments.
- [Choosing a plugin base](/framework/plugin-types.md) — which variant you inherit.
# Permission conditions
A plain grant allows an action unconditionally. With a **condition**, the [permission system](/core/permissions.md) consults an onchain contract at call time to decide whether to allow the action. That contract can look at the caller, the target, the permission, and the exact call arguments.
Use a condition whenever "who may do this" isn't a fixed address list: spending caps, time windows, per-argument restrictions ("may call this function but only with argument X"), allow-listed targets, or [signature validation](/core/signature-validation.md).
## The interface
A condition is any contract implementing `IPermissionCondition`:
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes calldata _data
) external view returns (bool isPermitted);
```
`_data` is the context the check runs against. When the condition backs an `auth`-gated function, it is the full `msg.data` of the call, so the condition can decode the arguments. Inherit `PermissionCondition` (non-upgradeable) or `PermissionConditionUpgradeable` to get the required ERC-165 support:
```solidity
contract OnlyBeforeDeadline is PermissionCondition {
uint256 public immutable deadline;
constructor(uint256 _deadline) { deadline = _deadline; }
function isGranted(address, address, bytes32, bytes calldata)
external view returns (bool)
{
return block.timestamp <= deadline;
}
}
```
## Attaching a condition
Attach it when granting:
```solidity
dao.grantWithCondition(where, who, permissionId, address(condition));
```
`grantWithCondition` verifies the condition is a contract and advertises `IPermissionCondition` via ERC-165 (else it reverts). Then, during [`isGranted`](/core/permissions.md#how-a-decision-is-made), a grant whose stored value is a condition address defers the decision to that contract.
Because only `grantWithCondition` may set `where == ANY_ADDR`, conditions are also how you express "this caller, on any contract, but only when the condition holds" (the [any-target tier](/core/permissions.md#how-a-decision-is-made)).
## Keep in mind
- **Conditions fail closed.** If a condition reverts, runs out of gas, or returns the wrong type, the permission system treats the result as `false`, not as an error. Throwing is equivalent to "denied." Never rely on a revert to signal something to the caller; it just denies.
- **A condition on a specific grant does not fall through.** If the specific `(where, who)` slot holds a condition and it returns `false`, the answer is `false`, even if a broader wildcard grant exists that would have said yes. See the [non-merging tiers](/core/permissions.md#how-a-decision-is-made).
## Composing conditions without writing Solidity
For conditions that are boolean combinations of simple checks (time, block, delegated sub-conditions, literal comparisons), you often don't need bespoke code: [`RuledCondition`](/common/ruled-condition.md) lets you express the logic as a data-driven rule list. Reusable ready-made conditions live in the [condition library](/helpers/index.md).
## See also
- [The permission system](/core/permissions.md) — where conditions are consulted.
- [RuledCondition](/common/ruled-condition.md) — declarative rule engine for building conditions.
- [Signature validation](/core/signature-validation.md) — a condition-driven use of the same machinery.
# RuledCondition (the rule engine)
Many [permission conditions](/common/permission-conditions.md) are boolean combinations of small checks: "after this timestamp", "the argument equals X", "and this other condition also passes". `RuledCondition` lets you express that logic as **data**, an array of rules, instead of writing and auditing custom Solidity for each one.
It's an abstract base: you inherit it, set the rules, and expose your own `isGranted` that evaluates them. The reusable conditions in the [condition library](/helpers/index.md) are built this way.
## One rule
```solidity
struct Rule {
uint8 id; // where the LEFT operand comes from
uint8 op; // the operator
uint240 value; // the RIGHT operand (its meaning depends on id/op, see below)
bytes32 permissionId; // optional per-rule permission override (delegated conditions)
}
```
A rule computes a **left value** from `id`, then applies `op`: a comparison op compares that left value against `value` (the **right operand**); `RET` just returns whether the left value is truthy. `id` selects where the left value comes from:
| `id` | Left value is… |
|---|---|
| `< 200` | `_compareList[id]` — a runtime operand the subclass decoded from the call `_data` (truncated to 240 bits) |
| `200` `BLOCK_NUMBER_RULE_ID` | `block.number` |
| `201` `TIMESTAMP_RULE_ID` | `block.timestamp` |
| `204` `VALUE_RULE_ID` | the literal in `value` itself (used with `RET`, or as a constant operand) |
| `202` `CONDITION_RULE_ID` | the boolean result of **another** `IPermissionCondition` (its address packed in `value`); the rule then tests whether it passed |
| `203` `LOGIC_OP_RULE_ID` | not a comparison — combines other rules (below) |
`op` is one of `NONE, EQ, NEQ, GT, LT, GTE, LTE, RET, NOT, AND, OR, XOR, IF_ELSE`. The comparison ops (`EQ`…`LTE`) test `leftValue value`; `RET` returns `leftValue > 0`; the rest are logic operators.
## Combining rules
A logic-op rule (`id = LOGIC_OP_RULE_ID`) reads no value. It references **other rules by their array index**, so a flat `Rule[]` encodes a boolean expression tree. The index operands are packed into `value` with the helpers `encodeLogicalOperator(idxA, idxB)` (for `AND`/`OR`/`XOR`; `NOT` uses only `idxA`) and `encodeIfElse(condIdx, thenIdx, elseIdx)`.
Evaluation starts at **rule 0**, the root (usually the top combinator). `AND`/`OR` short-circuit to save gas.
## A worked example
"Allow only while `block.timestamp ≤ deadline` **and** the first decoded argument equals `expected`":
| index | `id` | `op` | `value` |
|---|---|---|---|
| **0** (root) | `LOGIC_OP_RULE_ID` | `AND` | `encodeLogicalOperator(1, 2)` |
| 1 | `TIMESTAMP_RULE_ID` | `LTE` | `deadline` |
| 2 | `0` (i.e. `_compareList[0]`) | `EQ` | `expected` |
The subclass decodes the call's `_data` into `_compareList` (here `[firstArg]`) and evaluates rule 0. Rule 0 is `rule1 AND rule2`; rule 1 is `block.timestamp ≤ deadline`; rule 2 is `_compareList[0] == expected`. Rules are set once via `_updateRules` (emits `RulesUpdated`) and read with `getRules()`.
## Keep in mind
- **`value` is `uint240`, and compare-list entries are truncated to 240 bits** (the source even comments "force lost precision"). Comparing certain `uint256`s or raw `address` values can silently lose the top bits.
- **Delegated conditions fail closed.** A `CONDITION_RULE_ID` rule calls the other condition via a raw `staticcall`; a revert, a non-contract, or a wrong-sized return is treated as `false`, the same fail-closed behavior as the [permission system](/core/permissions.md).
- **A delegated sub-condition does *not* see the original calldata.** `RuledCondition` passes `abi.encode(_compareList)` as the sub-condition's `_data`, the parent's already-decoded operands re-encoded, not the raw `msg.data`. So a [condition](/common/permission-conditions.md) that normally re-parses call arguments can only observe what the parent decoded into the compare list. Feed it every operand it needs; it cannot reach back to the original call.
- **Rules are trusted input.** A malformed rule set (bad indices) can recurse deeply; only set rules you control, via `_updateRules`.
Reach for `RuledCondition` when your logic is a composition of standard comparisons; write a plain [condition](/common/permission-conditions.md) when it's simpler to express directly in Solidity.
## See also
- [Permission conditions](/common/permission-conditions.md) — the interface `RuledCondition` implements.
- [Condition library](/helpers/index.md) — ready-made conditions built on this engine.
# Proposals
A **proposal** is a bundle of [actions](/core/execution.md) that a governance [plugin](/framework/plugins.md) puts up for a decision and, if it passes, executes on the DAO. Token voting, multisig, admin, and staged proposals all differ in *how they decide*, but they share the same proposal shape and lifecycle, defined by the reusable `IProposal` interface and its `Proposal` base. If you're building a governance plugin, inherit this shared implementation.
## The lifecycle interface
```solidity
function createProposal(bytes metadata, Action[] actions,
uint64 startDate, uint64 endDate, bytes data)
external returns (uint256 proposalId);
function canExecute(uint256 proposalId) external view returns (bool);
function hasSucceeded(uint256 proposalId) external view returns (bool);
function execute(uint256 proposalId) external;
```
**`hasSucceeded` must reflect only the *outcome* (did it reach threshold / approval), not the time window.** Whether the voting period is over is a separate check, included in `canExecute`. Keeping "did it win" apart from "is it executable now" allows rules such as early execution. Honor that separation when you implement a governance plugin.
`customProposalParamsABI()` lets a plugin advertise, as a human-readable ABI string, the extra fields it packs into `createProposal`'s `data`, so a UI can render the right form without hard-coding per-plugin knowledge.
## Proposal IDs are derived, not sequential
`Proposal` computes ids like this:
```solidity
proposalId = uint256(keccak256(abi.encode(block.chainid, block.number, address(this), salt)));
```
The id is not an incrementing counter. This is deliberate: it's collision-free across chains (chain id is mixed in) and avoids the storage cost of a counter. There is a trade-off: **if your plugin creates two proposals in the same block, you must vary the `salt` yourself**. The base doesn't track anything to guarantee uniqueness.
> Legacy note: `proposalCount()` is deprecated and now **always reverts** (`FunctionDeprecated`). Don't build on it. The `Proposal` base also answers `supportsInterface` for both the current and an older `IProposal` interface id, for backward compatibility with pre-1.4.0 tooling.
## Keep in mind
- **Identical proposals collide, by plugin convention, not by the base.** The *base* id mixes only chain id, block number, plugin address, and a caller-supplied salt, never the proposal's contents. But concrete governance plugins set that salt to `keccak256(actions, metadata)` (Token Voting does), so a byte-identical proposal in the same block hashes to the same id and reverts as a duplicate. Change the actions, metadata, or salt to resubmit within a block.
- **"Succeeded" isn't "executable".** `hasSucceeded` is outcome-only; timing and the governing plugin's rules decide `canExecute` separately.
## See also
- [Actions and execution](/core/execution.md) — what a proposal carries and how it enacts.
- [Plugins](/framework/plugins.md) — governance plugins implement this interface.
- [Membership](/common/membership.md) — who is eligible to propose/vote.
- The [plugins](/plugins/index.md) area — concrete decision rules (voting, multisig, …).
# Membership and the address list
Most governance [plugins](/framework/plugins.md) need a notion of "who counts": multisig signers, addresslist voters, token holders. Two reusable pieces standardize that.
## `IMembership`: the discovery interface
Any plugin that defines membership should implement `IMembership`, a small interface consisting of `isMember(address)` plus `MembersAdded` / `MembersRemoved` events. It provides **discoverability**: UIs and indexers can query and track membership uniformly across every plugin.
It also allows *delegated* membership via `MembershipContractAnnounced`: a plugin can point at a **different** contract as the authority on membership (e.g. an external token) instead of maintaining a list itself. That's how a token-voting plugin says "membership = holders of this token". The token is the membership source, and the event tells indexers where to look.
## `Addresslist`: a snapshot-safe member list
When a plugin *does* maintain its own member set (multisig, addresslist voting), `Addresslist` is the building block. Its defining feature is that it's **checkpointed**: membership and the total member count are recorded per block, so you can ask "was this address a member *at block N*?" and "how many members were there *at block N*?".
Why that matters: governance must compute eligibility and thresholds against the state **as of a proposal's snapshot block**, not the current block. Otherwise someone could join right before voting, or the member count could shift mid-vote, opening the door to flash-membership manipulation. Checkpointing (the same technique OpenZeppelin's `ERC20Votes` uses) makes those queries historical and therefore tamper-resistant.
```solidity
isListed(account) // member right now
isListedAtBlock(account, blockNumber) // member as of a past block (snapshot)
addresslistLength() // current member count
addresslistLengthAtBlock(blockNumber) // count as of a past block
```
`_addAddresses` / `_removeAddresses` maintain the list (rejecting double-adds and removing non-members). Combined with [`Ratio`](/common/ratio.md) for threshold math, this is the backbone of the addresslist-based voting and multisig plugins.
## Keep in mind
- **Decide against the snapshot block, not "now".** Query membership and counts with the `…AtBlock` variants at a proposal's snapshot; using current state lets membership changes mid-vote distort eligibility or thresholds.
## See also
- [Ratio](/common/ratio.md) — turning a member count into a required threshold.
- [Proposals](/common/proposal.md) — the other half of a governance plugin.
- The [plugins](/plugins/index.md) area — where these are put to use.
# Ratio (threshold math)
Governance thresholds, support percentages, and quorums are fractions, but Solidity has no fractions. OSx represents them as fixed-point integers with a shared base:
```solidity
uint256 constant RATIO_BASE = 10 ** 6; // 1_000_000 == 100%
```
So `500_000` means 50%, and `750_000` means 75%. Every voting/approval threshold in the protocol ([token voting](/plugins/index.md), multisig, …) uses this same unit.
## Applying a ratio, and why it rounds up
```solidity
_applyRatioCeiled(value, ratio); // ceil(value * ratio / RATIO_BASE)
```
The **ceiling** is deliberate. When a ratio expresses a *minimum requirement* ("at least X% must approve"), rounding **up** ensures integer truncation never silently weakens it. For example, 50% of 3 members should require **2** approvals. Floor division would wrongly allow the proposal to pass with 1. Any plugin author computing a required count from a ratio should ceil, never floor.
A ratio above `RATIO_BASE` reverts (`RatioOutOfBounds`).
## Keep in mind
- **Round up, never down, for a minimum requirement.** Use `_applyRatioCeiled`; floor division silently weakens a threshold, letting a proposal pass with fewer approvals than the percentage implies.
## See also
- [Membership and the address list](/common/membership.md) — the member count a ratio is applied to.
- [Proposals](/common/proposal.md) — where thresholds decide `hasSucceeded`.
# Proxy deployment (UUPS & minimal proxies)
OSx deploys almost everything behind a proxy: a contract that is cheap to deploy delegates to a shared logic contract and, for UUPS, can be upgraded. `ProxyLib` is the small library that deploys both proxy types; it's what [plugin setups](/framework/plugin-setup.md) and factories call to instantiate contracts.
```solidity
using ProxyLib for address;
// UUPS proxy (ERC-1967): upgradeable in place.
address p = logic.deployUUPSProxy(abi.encodeCall(MyPlugin.initialize, (dao)));
// Minimal proxy (EIP-1167 clone): cheapest, not individually upgradeable.
address c = logic.deployMinimalProxy(abi.encodeCall(MyPlugin.initialize, (dao)));
```
The two map directly onto the [plugin types](/framework/plugin-types.md):
- **UUPS proxy** — an ERC-1967 proxy that runs `_initCalldata` against the logic during construction. Backs `PluginUUPSUpgradeable`. Upgradeable (the proxy can point at new logic later).
- **Minimal proxy (clone)** — an ~45-byte EIP-1167 proxy hard-wired to one logic address. Backs `PluginCloneable`. Cheapest to deploy, and because that logic address is fixed, a clone's logic can never change. A clone also has no constructor of its own, so, unlike the UUPS proxy above (which initializes *during* construction), it's initialized by a separate **call** right after cloning (see below).
`ProxyFactory` is a thin contract wrapper around the same two functions that additionally emits a `ProxyCreated` event, useful when you want proxy deployments to be indexable off-chain. Setups can use either the library directly or the factory.
## Keep in mind
- **A clone has no constructor.** EIP-1167 minimal proxies can't run constructor logic, so initialization is a *separate call* after cloning. Pass `_initCalldata` so it happens atomically; an uninitialized proxy is deployed but not configured.
- **Clones are not individually upgradeable.** A clone's logic address is fixed forever. "Upgrading" a cloneable plugin means publishing a new version and installing a fresh instance, not changing existing ones.
- **UUPS storage discipline.** New state in an upgradeable implementation must respect the reserved `__gap` (see [protocol version](/common/protocol-version.md)); shifting the layout corrupts every existing proxy.
## See also
- [Choosing a plugin base](/framework/plugin-types.md) — which proxy type each plugin uses.
- [Plugin setup](/framework/plugin-setup.md) — the main caller of `ProxyLib`.
- [Protocol version](/common/protocol-version.md) — the storage-gap discipline upgradeable proxies rely on.
# Protocol version
OSx tracks **two different versions**:
- **Protocol version** — which version of the OSx *protocol* a contract was built against (e.g. `[1, 4, 0]`). Reported by `protocolVersion()`, defined here.
- **Plugin release/build** — which version of a *specific plugin* an install is, tracked by [PluginRepo](/framework/plugin-repo.md) as `release.build`. Unrelated to the protocol version.
## `protocolVersion()`
Contracts across the protocol (every plugin, every plugin setup, the DAO, registries) mix in `ProtocolVersion` and expose:
```solidity
function protocolVersion() external view returns (uint8[3] memory); // e.g. [1, 4, 0]
```
This makes the protocol version discoverable onchain for tooling and compatibility checks. `ProtocolVersion` is intentionally **stateless** (`pure`, zero storage): the source warns not to add storage variables to it, so it can be safely mixed into any inheritance chain, upgradeable or not, without disturbing storage layout or needing its own `__gap`.
`VersionComparisonLib` provides lexicographic comparisons (`eq`, `lt`, `gte`, …) over the `uint8[3]` triple for code that gates on protocol version.
## Why versioning discipline matters
The DAO's [`initializeFrom`](/core/dao.md#upgrades-across-versions) uses the protocol version to decide which storage migrations to run on upgrade, and refuses to cross a major version. More broadly, every upgradeable contract in OSx follows the same storage-safety discipline (reserved `__gap` slots, renamed-not-removed fields) so that a new implementation never corrupts an existing proxy's storage. See [proxies](/common/proxies.md) and [choosing a plugin base](/framework/plugin-types.md).
## See also
- [PluginRepo](/framework/plugin-repo.md) — the *other* versioning axis (release/build).
- [The DAO contract](/core/dao.md) — uses protocol version for upgrade migrations.
# Framework
The **plugin framework** defines what a plugin is, how you build one, and how it's published, installed, updated, and uninstalled on a DAO safely and repeatably. Source: [`osx`](https://github.com/aragon/osx) `src/framework`, plus the plugin base contracts in [common](/common/index.md) (osx `src/common`).
The [core](/core/index.md) DAO is deliberately minimal, and [common](/common/index.md) provides cross-cutting primitives. The framework installs a specific plugin version on a DAO with exactly the required permissions, without leaving anyone with unchecked control. A plugin isn't part of the core; it's a contract that *uses this framework* to operate a DAO.
New to plugins? Read the model, then how you build one, then the publish/install machinery.
**Exact signatures:** the generated [`osx` ABI reference](/abi/osx/index.md) has every public function, event, error and constant of these contracts, with its NatSpec.
## What a plugin is, and building one
- [The plugin model](/framework/plugins.md) — what a plugin *is* and how it acts on a DAO. **Start here.**
- [Choosing a plugin base](/framework/plugin-types.md) — Plugin vs Cloneable vs UUPS, and how to decide.
- [Plugin setup](/framework/plugin-setup.md) — the per-version contract that deploys a plugin and declares its permissions.
- [Plugin metadata](/framework/plugin-metadata.md) — the release/build JSON a version points to (incl. the install-params schema), and onchain instance metadata.
## Publishing and installing
- [PluginRepo](/framework/plugin-repo.md) — per-plugin versioning (`release.build`) and publishing.
- [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md) — the two-step prepare→apply install/update/uninstall engine.
- [DAOFactory](/framework/dao-factory.md) — one-transaction DAO creation and its sequence of permission changes.
- [Registries and ENS names](/framework/registries.md) — how the canonical registries and ENS naming work (overview), covering the [DAO Registry](/framework/dao-registry.md) and [PluginRepo Registry](/framework/plugin-repo-registry.md).
- [Member registry](/framework/member-registry.md) — permissionless member-identity ENS names.
### A note on the word "factory"
OSx reuses "factory" for several distinct things; keep them apart by *what they produce*:
- **[Plugin setup](/framework/plugin-setup.md)** — assembles **one plugin installation** (deploys the plugin + declares its permissions). A "factory" only in the sense of producing a single install.
- **[DAOFactory](/framework/dao-factory.md)** — deploys **one DAO** (optionally with plugins) in a transaction.
- **PluginRepoFactory** (see [PluginRepo](/framework/plugin-repo.md)) — deploys **one plugin repo**.
- **[Protocol Factory](/deployment/protocol-factory.md)** — deploys **the whole OSx stack** onto a new chain.
- The **[DAO Launchpad](/deployment/dao-launchpad.md)**'s one-shot factory — a project-specific contract that deploys **one fully-configured DAO** atomically.
Rule of thumb: *setup* = one install; *DAOFactory* / *launchpad* = one DAO; *PluginRepoFactory* = one repo; *Protocol Factory* = the whole protocol.
### Builds on
Plugins reuse the cross-cutting primitives in [common](/common/index.md) (conditions, proposals, membership, auth, proxies) and act on the [DAO](/core/dao.md) and its [permission system](/core/permissions.md) from the core.
# The plugin model
The [DAO](/core/dao.md) is deliberately minimal: treasury, executor, permission database. **Everything else is a plugin.** Voting, multisig approval, membership, token management, and spending policies are all functionality installed onto a DAO rather than built into it. OSx keeps the core small and stable in purpose, and makes its capabilities modular, versioned, and upgradeable.
A plugin is a smart contract associated with one DAO. It gates its own functions by [authorizing them against that DAO](/common/auth.md) (which resolves through the [permission system](/core/permissions.md)), and it acts on the world by having the DAO [execute](/core/execution.md) actions on its behalf. A governance plugin, for instance, is a contract that (a) decides when a proposal has passed and (b) holds `EXECUTE_PERMISSION_ID` on the DAO so it can enact the result.
## Why a whole framework, not just "deploy a contract"
You could deploy a plugin contract and grant it permissions by hand. The framework is designed to make that process safe, consistent, and repeatable across many DAOs, plugin authors, and versions over time. It answers three questions that would otherwise depend on trust:
- **How is a plugin published and versioned?** → the [PluginRepo](/framework/plugin-repo.md): one per plugin, storing every version as an immutable `release.build` tag pointing at a setup contract.
- **How does a DAO install a specific version, wiring exactly the right permissions, without handing anyone unchecked control?** → the [plugin setup](/framework/plugin-setup.md) contract (which declares what to deploy and which permissions to grant) plus the [PluginSetupProcessor](/framework/plugin-setup-processor.md) (which applies it under a two-step, governance-reviewable flow).
- **How does the ecosystem discover and trust DAOs and plugin repos?** → the [registries](/framework/registries.md) and their ENS names.
These pieces are covered below. If you're building a plugin, the reading order is: this page → [choosing a base](/framework/plugin-types.md) → [plugin setup](/framework/plugin-setup.md) → [PluginRepo](/framework/plugin-repo.md) → [PSP](/framework/plugin-setup-processor.md). If you're installing plugins onto a DAO, [PSP](/framework/plugin-setup-processor.md) and [DAOFactory](/framework/dao-factory.md) are the pages you want.
## What every plugin shares
All plugins implement `IPlugin`, which declares one thing they must answer, `pluginType()`, telling the framework how the plugin is deployed (see [choosing a base](/framework/plugin-types.md)):
```solidity
enum PluginType { UUPS, Cloneable, Constructable }
```
You never implement `IPlugin` directly; you extend one of the three [plugin base contracts](/framework/plugin-types.md), which give you the DAO reference, the [`auth`](/common/auth.md) modifier, ERC-165 support, and the execution helpers below.
## How a plugin makes the DAO act
A plugin doesn't call arbitrary contracts directly; it routes actions through an executor, by default its own DAO. This routing is configurable per plugin via a `TargetConfig`:
```solidity
enum Operation { Call, DelegateCall }
struct TargetConfig { address target; Operation operation; }
```
(This `Operation` enum, `Call` / `DelegateCall`, is unrelated to [`PermissionLib.Operation`](/core/permissions.md#batch-changes-permissionlib) with `Grant` / `Revoke` / `GrantWithCondition`; they only share a name.)
- **`Call`** (the normal case) forwards to `target.execute(callId, actions, allowFailureMap)`, the DAO's [execute](/core/execution.md). Actions run as the DAO.
- **`DelegateCall`** runs the executor's loop in the plugin's *own* context, so the actions run **as the plugin** (`msg.sender` is the plugin and value comes from the plugin's balance), not as the DAO. This is the advanced path: instead of shipping its own executor, the plugin borrows the shared [`GlobalExecutor`](/core/execution.md#the-standalone-executor)'s loop. It's also how a plugin performs [nested execution](/core/execution.md#the-execute-function) in its own context, which re-entering `DAO.execute` would otherwise reject with `ReentrantCall`.
**The `target` defaults to its own DAO.** A `target` of `address(0)` is a sentinel: `getTargetConfig()` resolves it at read time to `TargetConfig(dao(), Call)`, so a plugin that configures nothing acts through its DAO with a plain `call`. This is why install data commonly passes `target: address(0)`: it selects the default without naming the DAO's address (which you may not know yet at install time).
Older OSx hard-wired plugins to always execute on their `dao()`. `TargetConfig` generalizes that so a plugin can target a different [executor](/core/execution.md#the-standalone-executor), for instance to run [nested execution](/core/execution.md#the-execute-function) that `DAO.execute`'s reentrancy guard would otherwise block. Because redirecting where a plugin's actions land is consequential, setting it is gated by `SET_TARGET_CONFIG_PERMISSION_ID`.
> **Safety guard:** you cannot set a `TargetConfig` that both points at a contract implementing `IDAO` **and** uses `DelegateCall`. Delegatecalling *into* a DAO would run DAO code in the plugin's storage and leave the plugin unusable. The base contract rejects that combination (`InvalidTargetConfig`).
## Keep in mind
- **Never `DelegateCall` into a DAO.** A `TargetConfig` pointing at an `IDAO` with `DelegateCall` is rejected (`InvalidTargetConfig`): it would run DAO code in the plugin's storage and leave the plugin unusable.
- **A plugin can only act once granted `EXECUTE_PERMISSION_ID` on its DAO.** A governance plugin that can't enact its results is almost always missing that grant.
## See also
- [Choosing a plugin base](/framework/plugin-types.md) — Plugin vs Cloneable vs UUPS.
- [Plugin setup](/framework/plugin-setup.md) — how a plugin declares its installation.
- [PluginSetupProcessor](/framework/plugin-setup-processor.md) — the install/update/uninstall engine.
- [Proposals](/common/proposal.md) and [membership](/common/membership.md) — the building blocks governance plugins reuse.
# Choosing a plugin base
Every plugin extends one of three base contracts. They give you the same developer-facing interface: a `dao()` reference, the [`auth`](/common/auth.md) modifier, ERC-165, and the [execution helpers](/framework/plugins.md#how-a-plugin-makes-the-dao-act), so your plugin logic reads the same regardless. What differs is **how the plugin is deployed and whether it can be upgraded**. That choice affects gas, trust, and how updates work. Pick deliberately; the choice is fixed in the plugin (`pluginType()`) and determines which [setup base](/framework/plugin-setup.md) you pair with.
## The three options
| | `Plugin` | `PluginCloneable` | `PluginUUPSUpgradeable` |
|---|---|---|---|
| `pluginType()` | `Constructable` | `Cloneable` | `UUPS` |
| Deploy mechanism | `new` (full bytecode) | [EIP-1167 minimal proxy](/common/proxies.md) | [ERC-1967 UUPS proxy](/common/proxies.md) |
| Upgradeable in place | No | No | **Yes** |
| Deploy gas per install | High | Very low | Low (proxy) + one-time logic deploy |
| Extra permission | none | none | `UPGRADE_PLUGIN_PERMISSION_ID` |
| Pair with setup base | [`PluginSetup`](/framework/plugin-setup.md) | [`PluginSetup`](/framework/plugin-setup.md) | [`PluginUpgradeableSetup`](/framework/plugin-setup.md) |
| Stores DAO as | `immutable` (constructor) | initializer | initializer |
## How to choose
**`PluginUUPSUpgradeable`** — the default for most plugins. It's a UUPS proxy, so you can ship bug fixes and compatible features to already-installed instances via the [update flow](/framework/plugin-setup-processor.md) without redeploying and reinstalling. The cost: proxy call overhead, and an upgrade authority. Whoever holds `UPGRADE_PLUGIN_PERMISSION_ID` (normally the DAO itself, acting through the PSP) can replace the plugin's entire logic. Your users must trust that authority.
**`PluginCloneable`** — cheapest to deploy, an [EIP-1167 minimal proxy](/common/proxies.md) pointing at a shared logic contract. Best when a plugin is installed many times and you *don't* want per-instance upgradeability. Existing clones can never change logic; to "upgrade" you publish a new version and users install a fresh instance. This suits simple plugins with many installations that minimize trust in an upgrade authority.
**`Plugin`** — non-upgradeable, deployed with `new` as full bytecode per install. Highest deploy gas, no proxy indirection at call time. Choose it when immutability is a *feature*: for a governance-critical plugin whose code should be provably unchangeable, preventing upgrades removes the need to trust an upgrade authority.
As a rule of thumb, **use UUPS unless you have a specific reason to want immutability (`Plugin`) or very low deployment costs for replaceable instances (`Cloneable`).**
## Initialization
`PluginCloneable` *is* the clone and `PluginUUPSUpgradeable` *is* the UUPS proxy, so the two bases differ exactly as those proxies do (above), in upgradeability and in how the deploy initializes them. The one thing you write **identically** is the `initialize`: both disable initializers on the shared logic contract (in its constructor, so it can't be initialized directly, only through a proxy/clone's own storage) and expose an internal init you call from yours:
```solidity
// UUPS
function initialize(IDAO _dao, /* your params */) external initializer {
__PluginUUPSUpgradeable_init(_dao);
// ...your setup
}
// PluginCloneable, same shape, its own base init (you must call it; it isn't automatic)
function initialize(IDAO _dao, /* your params */) external initializer {
__PluginCloneable_init(_dao);
// ...your setup
}
```
Both proxy bases need this `initialize` (a proxy/clone runs no constructor of its own). What differs is *when the deploy invokes it*: a UUPS proxy initializes during construction; a clone, having no constructor, is initialized by a separate call right after cloning. Both happen atomically within the deploy transaction ([proxy deployment](/common/proxies.md#keep-in-mind)).
`Plugin` (non-upgradeable) instead takes the DAO in its constructor. See [authorizing against a DAO](/common/auth.md) for what the DAO reference is used for.
> If you add storage to an upgradeable plugin, follow the [storage-layout discipline](/common/proxies.md#keep-in-mind) (reserved `__gap`, no reordering), the same rule every UUPS contract in OSx follows.
## See also
- [Plugins](/framework/plugins.md) — the shared plugin model.
- [Plugin setup](/framework/plugin-setup.md) — the matching setup base for each type.
- [Proxies](/common/proxies.md) — the clone vs UUPS deployment mechanics.
# Plugin setup
A plugin setup is a **factory that deploys a plugin on the caller's behalf and configures its dependencies**: the contract, its helper contracts, and the permissions that connect them to the DAO. Given a DAO and some parameters, it produces a complete plugin installation ready to run.
Installing a plugin involves more than deploying one contract. The plugin usually needs **permissions** on its DAO (to execute proposals, for example), sometimes needs **helper contracts** deployed alongside it (a token, a condition), and later needs a way to be updated or uninstalled. A **plugin setup** encapsulates all of that for one plugin version.
You could deploy a plugin and grant its permissions one call at a time. That sequence is order-sensitive: one missed or mis-ordered grant can leave a DAO partially configured, a plugin unable to execute, or an unwanted permission still granted. A setup bundles the **complete, consistent** set of changes for a version so the [PluginSetupProcessor](/framework/plugin-setup-processor.md) applies them as a single atomic step. Either all changes take effect or none do, leaving the DAO fully configured both before and after.
**A setup is declarative.** It does not mutate the DAO. It *deploys* the plugin and its helpers and *returns a description* of the permission changes required, applying nothing itself. Whether and when to apply them is a **governance decision**: a permitted caller (in a healthy DAO, a passed proposal) drives the [PluginSetupProcessor](/framework/plugin-setup-processor.md), which then applies exactly what was prepared, under permission control. The PSP is the mechanism, not the decider. This separation is what makes installation reviewable by governance instead of a blind trust in the plugin author (see [why two steps](/framework/plugin-setup-processor.md#why-prepare-and-apply-are-separate)).
## What a setup implements
A setup implements `IPluginSetup`'s three lifecycle functions plus `implementation()`:
```solidity
function prepareInstallation(address _dao, bytes calldata _data)
external returns (address plugin, PreparedSetupData preparedSetupData);
function prepareUpdate(address _dao, uint16 _fromBuild, SetupPayload calldata _payload)
external returns (bytes memory initData, PreparedSetupData preparedSetupData);
function prepareUninstallation(address _dao, SetupPayload calldata _payload)
external returns (PermissionLib.MultiTargetPermission[] memory permissions);
```
The two structs that flow through the framework:
```solidity
struct PreparedSetupData {
address[] helpers; // auxiliary contracts this version needs
PermissionLib.MultiTargetPermission[] permissions; // what to grant/revoke on the DAO
}
struct SetupPayload {
address plugin; // the already-installed plugin instance
address[] currentHelpers; // helpers from the previous prepare, round-tripped back
bytes data; // operation-specific ABI-encoded input
}
```
- **`prepareInstallation`** deploys the plugin (via `new`, clone, or UUPS proxy, matching the [plugin type](/framework/plugin-types.md)) and returns the [permissions](/core/permissions.md#batch-changes-permissionlib) the DAO must grant. `_data` is your plugin's install parameters, ABI-encoded; its shape is documented in the version's [build metadata](/framework/plugin-metadata.md) (not enforced onchain), so decode it yourself.
- **`prepareUninstallation`** returns the permissions to *revoke*.
- **`prepareUpdate`** (upgradeable plugins only) returns the `initData` the PSP will use when upgrading the proxy, e.g. a call to a re-initializer that migrates from `_fromBuild`.
**Helpers** are the mechanism for stateful, multi-contract plugins. Whatever addresses a `prepareInstallation` returns as `helpers` are tracked by the PSP and handed back (as `currentHelpers`) on the next update/uninstall, so the setup can act on the exact contracts it deployed earlier. Their order matters because it is included in the hash; see [the PSP's bookkeeping](/framework/plugin-setup-processor.md#setup-ids-what-keeps-apply-honest).
## Two setup bases
Match the base to your [plugin type](/framework/plugin-types.md):
- **`PluginSetup`** — for non-upgradeable plugins (`Plugin` / `PluginCloneable`). It pre-implements `prepareUpdate` to always revert `NonUpgradeablePlugin()`, since there's no in-place update path, so you only write install/uninstall.
- **`PluginUpgradeableSetup`** — for `PluginUUPSUpgradeable` plugins. You must implement all three prepares. The convention for an unsupported update path is to revert `InvalidUpdatePath(fromBuild, thisBuild)`.
Both expose `implementation()`, the logic contract this setup deploys from (the UUPS/clone implementation, or, for `new`-deployed plugins, mainly a reference for block-explorer verification).
## The pattern in practice
One setup contract corresponds to one `(release, build)` version in a [PluginRepo](/framework/plugin-repo.md), and it typically owns exactly one immutable logic contract, deployed once in the setup's constructor and reused by every install of that build:
```solidity
contract MyPluginSetup is PluginUpgradeableSetup {
constructor() PluginUpgradeableSetup(address(new MyPlugin())) {}
function prepareInstallation(address _dao, bytes calldata _data)
external returns (address plugin, PreparedSetupData memory prepared)
{
MyInstallParams memory p = abi.decode(_data, (MyInstallParams));
plugin = implementation().deployUUPSProxy( // see /common/proxies.md
abi.encodeCall(MyPlugin.initialize, (IDAO(_dao), p))
);
// Describe (do not apply) the permissions the DAO must grant. `_installPermissions`
// here is a stand-in: it returns a PermissionLib.MultiTargetPermission[] of Grants.
// See "Build a plugin" for that array written out in full.
prepared.permissions = _installPermissions(_dao, plugin);
// prepared.helpers = ...any auxiliary contracts...
}
// prepareUninstallation returns the mirror-image Revoke permissions
// prepareUpdate branches on _fromBuild, or reverts InvalidUpdatePath
}
```
Fresh installs run `initialize`; in-place updates run a re-initializer (`initializeFrom`) with the `initData` your `prepareUpdate` returns. For a complete setup with the permission arrays and `prepareUninstallation` written out (no stand-ins), see the [Build a plugin](/guides/build-a-plugin.md) guide.
## Keep in mind
- **Decode `_data` yourself, correctly.** The install parameters' shape is documented in the version's build metadata, not enforced onchain. Decode exactly what your plugin expects; a mismatch silently misconfigures the install. The pattern to copy: expose public `encodeInstallationParams` / `decodeInstallationParams` helpers on your setup (as the [Token Voting Plugin](/plugins/token-voting-plugin.md) setup does) so off-chain callers and the setup agree on the encoding in one place.
- **Helper order is significant.** Return helpers in a stable order and supply `currentHelpers` in that same order on update/uninstall; the [PSP hashes them as an ordered array](/framework/plugin-setup-processor.md#setup-ids-what-keeps-apply-honest).
## See also
- [PluginSetupProcessor](/framework/plugin-setup-processor.md) — consumes these setups; the two-step apply.
- [PluginRepo](/framework/plugin-repo.md) — where each setup is published as a version.
- [The permission system](/core/permissions.md) — the `MultiTargetPermission[]` a setup returns.
- [Plugin Template (Foundry)](/tooling/plugin-template.md) — the template repo that scaffolds a plugin + setup.
# Plugin metadata
A plugin carries metadata at two levels, for two different audiences, by two different mechanisms:
- **Version metadata** (off-chain JSON) describes a *published version* in a [PluginRepo](/framework/plugin-repo.md): what the plugin is, and, crucially, *how to install it*. Consumed by UIs and install scripts.
- **Instance metadata** (onchain, via `MetadataExtension`) is a *specific installed plugin's* own metadata. Consumed by whoever reads that instance.
Keeping them straight matters because they live in different places and only one is a JSON file you author.
## Version metadata: the JSON a repo version points to
When a version is published with [`createVersion`](/framework/plugin-repo.md), the onchain repo stores a **pointer** to two JSON files, an `ipfs://` URI each, **not** the JSON itself; the documents live off-chain (IPFS) and only their content-addressed URI is onchain.
**`release-metadata.json`** — per *release*, human/UI facing:
```json
{ "name": "Multisig", "description": "", "images": {} }
```
**`build-metadata.json`** — per *build*, declares the **input schema for the [plugin setup](/framework/plugin-setup.md)**:
```json
{
"name": "multisig",
"change": "v1.3\n - Removed an unnecessary permission …",
"pluginSetup": {
"prepareInstallation": {
"description": "The information required for the installation.",
"inputs": [
{ "name": "members", "type": "address[]", "description": "The initial members." },
{ "name": "multisigSettings", "type": "tuple",
"components": [ { "name": "onlyListed", "type": "bool", … },
{ "name": "minApprovals", "type": "uint16", … } ] },
{ "name": "TargetConfig", "type": "tuple", … },
{ "name": "metadata", "type": "bytes", … }
]
},
"prepareUpdate": { "3": { "inputs": [ … ] } },
"prepareUninstallation": { "inputs": [] }
}
}
```
- `change` — this build's changelog.
- `pluginSetup.prepareInstallation.inputs` — the ABI schema, **with a `description` per field**, of exactly the `_data` the setup's [`prepareInstallation`](/framework/plugin-setup.md) decodes. This is the **contract between an off-chain encoder and the setup**: the install `_data` is ABI-encoded and *not* self-describing onchain, so this schema is how a UI or script knows what to encode (and how a reviewer reads what an install will configure). `prepareUpdate` inputs are keyed by the *source build* you're updating from; `prepareUninstallation` likewise.
This is why the [plugin setup](/framework/plugin-setup.md) page says "decode `_data` yourself, its shape is documented in build metadata, not enforced onchain." **Build metadata is that documentation.** If it drifts from what your setup actually decodes, tools build a wrong payload and the install misconfigures silently, so treat the schema as part of the contract, not a description written after the fact.
## Instance metadata: `MetadataExtension`
Separate from the version JSON, each *deployed* plugin carries its **own** metadata for the UI to show, describing *this installation* (this particular multisig's name/notes), not the plugin line. A plugin gets it by mixing in `MetadataExtension`: `setMetadata(bytes)` (gated by `SET_METADATA_PERMISSION_ID`), `getMetadata()`, and a `MetadataSet` event. Unlike the [DAO's metadata](/core/dao-metadata.md) (event-only), `MetadataExtension` **stores** the bytes, so `getMetadata()` returns the current value onchain.
**Where it comes from:** it's the plugin's **`metadata` install parameter**, the `bytes` field you'll see as the last input in the `build-metadata` above (`"The metadata that contains the information about the plugin"`). The setup passes it into the plugin's `initialize`, which stores it via `_setMetadata(...)` (the [Multisig](/plugins/multisig-plugin.md) plugin does exactly this). Like every metadata value in OSx it's an **`ipfs://` pointer**, not inline, resolving to freeform, UI-facing JSON. There's **no enforced schema** (it's whatever your UI reads); conventionally something like:
```json
{ "name": "Core-team multisig", "description": "3-of-5 signers for treasury operations." }
```
Change it any time with `setMetadata` (through governance, since it's `SET_METADATA_PERMISSION_ID`). It's per-instance state, independent of the version JSON that is identical for every install of that build.
## A minimal skeleton to copy
`release-metadata.json` (per release):
```json
{ "name": "My Plugin", "description": "One-line summary of the plugin.", "images": {} }
```
`build-metadata.json` (per build), replace the single input with your own:
```json
{
"ui": {},
"name": "my-plugin",
"description": "What this build does.",
"change": "v1.1 — initial release.",
"pluginSetup": {
"prepareInstallation": {
"description": "Installation parameters.",
"inputs": [
{
"name": "admin",
"type": "address",
"internalType": "address",
"description": "The initial admin address."
}
]
},
"prepareUpdate": {},
"prepareUninstallation": { "description": "No inputs required.", "inputs": [] }
}
}
```
Pin each file with `just ipfs-pin ` (it uploads and returns the `ipfs://` URI); those two URIs are what you hand to [`createVersion`](/framework/plugin-repo.md) when publishing the version.
## Generating `prepareInstallation.inputs` with Foundry
The `inputs` array is the ABI of your install `_data`. Writing it by hand can introduce differences from the code. Keep them consistent by exposing a public helper on your setup whose parameters mirror what `prepareInstallation` `abi.decode`s (the [Token Voting setup](/plugins/token-voting-plugin.md) does this with `encodeInstallationParameters(...)`):
```solidity
function encodeInstallationParameters(MySettings memory s, address admin)
external pure returns (bytes memory) { return abi.encode(s, admin); }
```
Then let Foundry emit that function's ABI and lift its `inputs`:
```sh
forge inspect MyPluginSetup abi --json \
| jq '.[] | select(.name=="encodeInstallationParameters") | .inputs'
```
Paste the result into `build-metadata.json` under `pluginSetup.prepareInstallation.inputs`, then add a human `description` to each field (the ABI doesn't carry those). Because the schema is generated from the same signature the setup encodes and decodes, it can't silently drift from the contract. This prevents the failure described in [plugin setup](/framework/plugin-setup.md).
This helper is a **convention Aragon recommends, not something the framework enforces**. Many setups don't expose one. When it's absent, you hand-write `inputs` to match your `abi.decode` and must keep them consistent yourself. Adding the helper avoids that manual work and its risk of drift.
## Keep in mind
- **`build-metadata.json` defines the installation input schema.** Its `prepareInstallation.inputs` must match what your setup decodes; a mismatch silently misconfigures installs. It's what makes your plugin installable from a UI.
- **Version JSON is off-chain.** The repo stores only its hash/URI; keep the files pinned or the metadata is unresolvable.
- **Instance metadata is stored and readable** (`getMetadata()`), unlike DAO metadata which you read by indexing its event.
- **No standalone schema file, the examples are the format.** Every plugin repo ships its own `release-metadata.json` + `build-metadata.json` (e.g. under `packages/contracts/src/` or `script/metadata/`); `build-metadata` is self-describing, since it embeds the input ABI schema itself.
## See also
- [Plugin setup](/framework/plugin-setup.md) — whose `prepareInstallation` `_data` the build metadata documents.
- [PluginRepo](/framework/plugin-repo.md) — where a version stores these JSON URIs.
- [DAO metadata](/core/dao-metadata.md) — the DAO-side counterpart (and the event-only-vs-stored contrast).
# PluginRepo (versioning & publishing)
A `PluginRepo` stores **one plugin across all its versions** onchain. Every version a plugin author ships is an immutable entry here, mapping a version tag to the [plugin setup](/framework/plugin-setup.md) that installs it plus its metadata. When a DAO installs "MyPlugin v1.3", the [PSP](/framework/plugin-setup-processor.md) resolves that request against MyPlugin's repo. A specific version is named by a **`PluginSetupRef`**, the pair `(pluginSetupRepo, version Tag)`, and that ref is exactly what the [PSP](/framework/plugin-setup-processor.md) and [DAOFactory](/framework/dao-factory.md) take to know which setup to run.
A repo is itself a UUPS proxy, and **it is its own [`PermissionManager`](/core/permissions.md)**: maintainers govern the repo through the same permission model DAOs use, independent of any DAO.
## Release vs build
Versions are `release.build` tags, and the release/build distinction is the core of the versioning model:
```solidity
struct Tag { uint8 release; uint16 build; }
struct Version { Tag tag; address pluginSetup; bytes buildMetadata; }
```
- **`build`** — a *compatible* change: a patch, or a feature that doesn't break existing installs. Builds increment automatically (1, 2, 3, …) within a release. An installed plugin can [update](/framework/plugin-setup-processor.md) to a higher build of the same release in place.
- **`release`** — an *incompatible* change: different interface, storage layout, or behavior. A new release starts its build numbering over.
A version reads as **`release.build`** (`1.4` = release 1, build 4). The recommendation follows from those definitions: **always take the latest *build*** of whatever release you run, since builds provide fixes and compatible features. You may deliberately stay on an **older *release*** if you prefer its feature set or behavior. Moving release is an opt-in migration with breaking changes.
This is why the [PSP forbids updates across releases](/framework/plugin-setup-processor.md#the-three-lifecycles): a release boundary *means* "not a drop-in replacement." An update upgrades the *existing* plugin instance in place (same address and state, new logic). A new release can't be reached that way because it would break the existing instance. Instead you **install a fresh instance** of the new release, a different contract with its own address that starts from empty state (you are responsible for migrating anything from the old one), and uninstall the old one. Every DAO running your plugin relies on you choosing release vs build correctly.
## Publishing versions
`createVersion` (gated by `MAINTAINER_PERMISSION_ID`) adds a version. Its rules encode the model's guarantees:
- The setup must advertise `IPluginSetup` via ERC-165 (`InvalidPluginSetupInterface`).
- Release `0` is not allowed; releases must increase by exactly `1` (`InvalidReleaseIncrement`), no gaps.
- A given setup contract can belong to only one release (`PluginSetupAlreadyInPreviousRelease`).
- Starting a new release requires non-empty release metadata.
The repo's own upgrades are gated by `UPGRADE_REPO_PERMISSION_ID`, and both maintainer and upgrade permissions are blocked from `ANY_ADDR` grants (a compromise would propagate to every DAO consuming the repo).
## Publishing a plugin: `PluginRepoFactory`
You don't deploy a `PluginRepo` by hand. `PluginRepoFactory` does it and registers the repo in the [PluginRepoRegistry](/framework/plugin-repo-registry.md) (which assigns its ENS name):
- **`createPluginRepo(subdomain, initialOwner)`** — an empty repo owned by `initialOwner`, no versions yet.
- **`createPluginRepoWithFirstVersion(subdomain, pluginSetup, maintainer, releaseMetadata, buildMetadata)`** — the common path: deploys the repo, publishes version **1.1** (the first published version is always **1.1**, not 1.0: version **0** is the reserved "nothing published yet" state, and release and build each begin at 1), and hands full ownership (`MAINTAINER`, `UPGRADE_REPO`, `ROOT`) to `maintainer` while the factory relinquishes everything.
An empty subdomain reverts; every repo gets an ENS name (see [registries](/framework/registries.md)).
> **Placeholders.** When migrating a repo to a new chain where only the latest build should be usable, the build-number history still has to be preserved (builds are sequential). A `PlaceholderSetup` (a setup that always reverts if you try to install it) fills the gaps so the real latest build lands on the correct build number.
## Keep in mind
- **Release vs build is a promise to every DAO on your plugin.** A new *build* must be a drop-in for the same release (installable as an in-place update); anything that changes interface, storage, or behavior is a new *release*. Misclassify an incompatible change as a build and you break in-place updates for everyone.
## See also
- [Plugin setup](/framework/plugin-setup.md) — what each version points at.
- [PluginSetupProcessor](/framework/plugin-setup-processor.md) — resolves versions from repos at install time.
- [Registries](/framework/registries.md) — where repos are registered and named.
- [The permission system](/core/permissions.md) — a repo is its own PermissionManager.
# The PluginSetupProcessor (PSP)
The PSP installs, updates, and uninstalls plugins on a DAO. It is the **only** contract that changes a DAO's permissions on behalf of a [plugin setup](/framework/plugin-setup.md). To do that, it must be *temporarily* granted `ROOT_PERMISSION_ID` on the DAO. Controlling how the PSP receives and uses that permission is critical to the framework's security.
## Why prepare and apply are separate
Every lifecycle operation is **two steps**:
1. **`prepare…`** — *permissionless*. Anyone can call it. It runs the setup's [`prepare…`](/framework/plugin-setup.md) function, which deploys the plugin and helpers and returns the requested permission changes. It **does not touch the DAO**; it only records that a specific preparation is now pending.
2. **`apply…`** — *permission-gated*. It calls the DAO's [`applyMultiTargetPermissions`](/core/permissions.md#batch-changes-permissionlib) to actually grant/revoke, which is why the PSP needs ROOT on the DAO here.
Why split them? Because the party who *computes* an installation (permissionless, could be anyone, could be malicious) must not be the party who *authorizes* it. Splitting lets a DAO's governance review the **exact** permission set a preparation would apply, and approve it through a proposal, before any state changes. The preparer can grant themselves nothing; only a DAO-authorized `apply` mutates anything. A [hashing scheme](#setup-ids-what-keeps-apply-honest) binds what gets applied to what was prepared, so nothing can be swapped in between.
This is the core safety property: preparation is **permissionless**, and application is **governed**.
## The apply permissions
Calling an `apply…` requires the caller to hold, *on the PSP*, the matching permission granted by the target DAO (or to be the DAO itself):
- `APPLY_INSTALLATION_PERMISSION_ID`
- `APPLY_UPDATE_PERMISSION_ID`
- `APPLY_UNINSTALLATION_PERMISSION_ID`
## The temporary-ROOT window
Because `apply…` calls the DAO's permission functions, **the PSP must hold `ROOT_PERMISSION_ID` on the DAO for the duration of the apply**, and must not keep it. Leaving the PSP with ROOT is a critical vulnerability (it could then change any permission on the DAO). The safe pattern, which the [DAOFactory](/framework/dao-factory.md) performs atomically in one transaction:
```
grant PSP ROOT on DAO
grant caller APPLY_INSTALLATION on PSP
PSP.applyInstallation(...) // PSP grants the plugin's permissions
revoke caller APPLY_INSTALLATION on PSP
revoke PSP ROOT on DAO
```
### Installing onto a live DAO
Creating a DAO isn't the only time you install a plugin. More often, you add one to a DAO that's already running. The mechanism is the same grant→apply→revoke, but there's no factory to coordinate it, so **governance does.** The install becomes a [proposal](/common/proposal.md) whose [actions](/core/execution.md) are exactly:
1. grant the PSP `ROOT` on the DAO,
2. call `PSP.applyInstallation(...)` (against a preparation someone already made permissionlessly),
3. revoke the PSP's `ROOT`.
When that proposal passes and the DAO [executes](/core/execution.md) it, the plugin is installed, its permission changes applied, and the temporary ROOT revoked, all in the one transaction the DAO's own governance authorized. For every "add a plugin" integration, **the proposal grants ROOT before the apply and revokes it afterward.** Updates and uninstalls work the same way, with the matching `APPLY_*` permission and `apply…` call.
## Setup IDs: what keeps apply honest
The PSP tracks per-plugin state keyed by `pluginInstallationId = keccak256(dao, plugin)`. It uses two hashes:
- **prepared setup id** — fingerprints a *preparation*: the version, the exact permissions, the helpers, the extra data, **and** the operation type (`Installation` / `Update` / `Uninstallation`). Mixing the type in means an install preparation can't be replayed as an update. At `apply`, the PSP recomputes this from the arguments you pass and requires a match, so you must apply *exactly* what was prepared.
- **applied setup id** — fingerprints the *live state*: version + helpers (no permissions). It's what `prepareUpdate`/`prepareUninstallation` recompute from the payload you supply, which is how the PSP verifies you actually know the plugin's true current version and helper set (`InvalidAppliedSetupId` otherwise).
> **The block-number invariant.** A preparation is applicable only if it was prepared *after* the last applied action for that plugin. Every `apply…` records the current block in the plugin's state, which **invalidates all other pending preparations** for that plugin. So if two competing installations are prepared, applying one automatically prevents the other from being applied (`SetupNotApplicable`). This prevents stale or competing preparations from being applied later.
## The three lifecycles
- **Install** — `prepareInstallation` deploys + records; `applyInstallation` grants the permissions. Fails if the plugin is already installed.
- **Update** (UUPS plugins only) — `prepareUpdate` is **release-locked**: the release number must stay the same and the build must strictly increase (`InvalidUpdateVersion` otherwise). `applyUpdate` performs the actual UUPS proxy upgrade (using the `initData` from prepare) and applies any permission diff.
There's a **metadata-only update** fast path, often called "UI-only": only the off-chain [metadata](/framework/plugin-metadata.md), such as display text, docs, or the params schema, has changed. The onchain setup/implementation is identical. The proxy isn't upgraded and nothing is redeployed; only the version pointer changes.
Because it changes no permissions, `applyUpdate` skips the DAO's `applyMultiTargetPermissions` call entirely. It also skips the proxy upgrade, since the implementation is unchanged. A metadata-only update therefore needs only `APPLY_UPDATE_PERMISSION_ID` on the PSP, **not** the [temporary-ROOT window](#the-temporary-root-window) an update that changes permissions or code requires. It is the one lifecycle step that touches neither permissions nor code, which makes it cheap to authorize.
- **Uninstall** — `prepareUninstallation` returns the permissions to revoke; `applyUninstallation` revokes them and clears the plugin's applied-setup id (so it could later be reinstalled).
Because updates can't cross releases, **migrating across a release is an uninstall + reinstall**, by design: a new release signals an incompatible change (see [PluginRepo](/framework/plugin-repo.md#release-vs-build)).
## Keep in mind
- **Helper order matters.** You must pass `currentHelpers` in the exact order a prior prepare returned them, or the applied-setup-id check fails.
- **Preparing is cheap and permissionless**, so a griefer can deploy plugin instances at will, but can never apply them. Don't treat a `…Prepared` event as an installation.
- **Never leave the PSP with ROOT.** If you script installs manually, revoke ROOT in the same transaction.
## See also
- [Plugin setup](/framework/plugin-setup.md) — the setups the PSP runs.
- [The permission system](/core/permissions.md) — `applyMultiTargetPermissions` and ROOT.
- [DAOFactory](/framework/dao-factory.md) — the reference implementation of the temporary-ROOT sequence.
- [PluginRepo](/framework/plugin-repo.md) — where the PSP looks up which setup to run.
# DAOFactory (creating a DAO)
`DAOFactory.createDao` deploys a [DAO](/core/dao.md), registers it, installs an initial set of [plugins](/framework/plugins.md), and leaves the DAO safely self-governing with no external party in control, all in **one transaction**. It is the canonical way to create a DAO safely, and a worked example of the [permission](/core/permissions.md) sequence the whole framework depends on.
## What you pass
```solidity
struct DAOSettings { address trustedForwarder; string daoURI; string subdomain; bytes metadata; }
struct PluginSettings { PluginSetupRef pluginSetupRef; bytes data; }
function createDao(DAOSettings _daoSettings, PluginSettings[] _pluginSettings)
external returns (DAO createdDao, InstalledPlugin[] installedPlugins);
```
Each `PluginSettings` names a plugin version (a [repo](/framework/plugin-repo.md) + version tag) and its install `data`. The factory prepares and applies each one via the [PSP](/framework/plugin-setup-processor.md).
## The permission choreography (why order matters)
The factory follows this [temporary-ROOT sequence](/framework/plugin-setup-processor.md#the-temporary-root-window) when creating a DAO with plugins:
1. **Deploy the DAO proxy**, with the factory as initial owner, so the factory transiently holds `ROOT` on the new DAO.
2. **Register** the DAO in the [DAORegistry](/framework/dao-registry.md) (assigning its ENS subdomain).
3. **Install each plugin through the [PSP temporary-ROOT window](/framework/plugin-setup-processor.md#the-temporary-root-window):** grant the PSP `ROOT` and the factory `APPLY_INSTALLATION`, `prepareInstallation` + `applyInstallation` each plugin, then revoke both temporary grants.
4. **Grant the DAO ROOT and its admin permissions over itself** (`UPGRADE_DAO`, `SET_METADATA`, …), so the organization self-governs.
5. **Revoke the factory's own initial ROOT, last.** After this the factory has zero control.
Because it's one transaction, if any step reverts, the whole transaction rolls back. This atomicity guarantees that no partially configured DAO with an unintended ROOT grant is left behind.
> **With plugins vs without.** If you pass plugins, the caller is *not* granted `EXECUTE_PERMISSION_ID`; governance comes from the installed plugin(s). If you pass **no** plugins, the factory instead grants `EXECUTE` to `msg.sender`; otherwise the DAO would be uncontrollable. So a bare DAO is directly caller-operated until you install governance.
## The takeaway
Two invariants carry over to any custom deployment: **the DAO ends up holding ROOT over itself**, and **no external address (factory, PSP, deployer) retains any elevated permission**. If you ever wire a DAO by hand instead of via the factory, reproduce exactly that end state.
## See also
- [The DAO contract](/core/dao.md) — what gets deployed and how ROOT is bootstrapped.
- [PluginSetupProcessor](/framework/plugin-setup-processor.md) — the install engine and its temporary-ROOT window.
- [Registries](/framework/registries.md) — where the new DAO is registered.
- [Deployment](/deployment/index.md) — deploying the whole protocol, and the DAO launchpad.
# Registries and ENS names
For the ecosystem to enumerate and trust DAOs and plugins, there has to be a canonical onchain list of each. Two registries provide those lists and give every entry a human-readable ENS name:
- **[DAO Registry](/framework/dao-registry.md)** (`DAORegistry`) — the canonical list of every DAO the framework creates. The [DAOFactory](/framework/dao-factory.md) registers each one (optionally as `.dao.eth`); it's the "is this a genuine framework DAO?" index.
- **[PluginRepo Registry](/framework/plugin-repo-registry.md)** (`PluginRepoRegistry`) — the canonical list of every published [plugin repo](/framework/plugin-repo.md). The [PSP](/framework/plugin-setup-processor.md) will only install from a repo registered here, so **registration is the trust boundary.**
## One shared pattern: `InterfaceBasedRegistry`
Both registries extend `InterfaceBasedRegistry`, an abstract base that enforces one rule: **only contracts that advertise the right ERC-165 interface can register**, and none can register twice. `DAORegistry` requires registrants to be `IDAO`; `PluginRepoRegistry` requires `IPluginRepo`. This is what stops arbitrary contracts from masquerading as DAOs or repos in the canonical lists.
The base is a UUPS proxy governed by a **[Management DAO](/deployment/protocol-factory.md)** (via [`DaoAuthorizable`](/common/auth.md)): registration itself is permissioned (`REGISTER_DAO_PERMISSION_ID` / `REGISTER_PLUGIN_REPO_PERMISSION_ID`), held by the [DAOFactory](/framework/dao-factory.md) and [PluginRepoFactory](/framework/plugin-repo.md) respectively, so only the official factories can add entries.
## ENS subdomains
Each registration can claim a subdomain under a protocol-owned ENS parent (e.g. `myorg.dao.eth`, `myplugin.plugin.dao.eth`). The `ENSSubdomainRegistrar` mints these:
- It **keeps ownership of every subnode itself** and only sets the resolver's address record to point at the DAO or repo. Names can't be transferred away from the protocol; they always resolve to the registered contract.
- Subdomain characters are validated (`a-z`, `0-9`, `-`) by `RegistryUtils.isSubdomainValid`.
- It requires off-chain setup: the registrar must be made owner/operator of the ENS parent node before it can mint children.
Whether a name is **required** depends on the registry and the release:
- **DAOs, always optional.** `DAORegistry` registers the DAO whether or not you pass a subdomain; an empty one just skips the ENS step.
- **Plugin repos, version-dependent.** Through **v1.3.0** a subdomain was **required**, an empty one reverts `EmptyPluginRepoSubdomain`. **v1.4.0 relaxed it to optional.** So on older deployments a name is mandatory; treat providing one as the norm regardless. (`PluginRepoFactory` still carries a stale `@dev` comment claiming empty reverts, a leftover from the v1.3.0 rule.)
- **Duplicates always revert** (`AlreadyRegistered`): a subdomain can be claimed once, and a contract can't register twice.
## A third registry, deliberately separate
A [`MemberRegistry`](/framework/member-registry.md) also mints ENS names (Aragon's binds to `aragon.eth`, so `alice.aragon.eth`). It serves a different purpose from the two component registries:
- The **DAO and plugin registries** register **protocol components** (contracts), share the `InterfaceBasedRegistry` base, and are **permissioned**. Only the official factories may add entries, which makes them a trust boundary.
- The **member registry** gives **members an optional, free ENS handle** (a fallback for those who don't want to buy one), is **permissionless** (anyone self-registers), and is built on a different base entirely (no `InterfaceBasedRegistry`). It shares only the ENS subnode-custody pattern.
The two component registries share nearly the same design. For the separate identity registry, see [member registry](/framework/member-registry.md).
## See also
- [DAO Registry](/framework/dao-registry.md) and [PluginRepo Registry](/framework/plugin-repo-registry.md) — the two component registries, each in detail.
- [PluginRepo](/framework/plugin-repo.md) — what `PluginRepoRegistry` indexes.
- [DAOFactory](/framework/dao-factory.md) — holds the register permission and creates the DAOs indexed here.
- [PluginSetupProcessor](/framework/plugin-setup-processor.md) — gates installs on repo registration.
- [Member registry](/framework/member-registry.md) — a separate, member-identity ENS registry.
# DAO Registry
The `DAORegistry` is the canonical onchain list of every DAO the framework has created. It answers "is this address a genuine OSx DAO, and what is it called?"
## What it holds and enables
The [DAOFactory](/framework/dao-factory.md) calls `register(dao, creator, subdomain)` as it creates a DAO, which:
- records the DAO so `entries(dao)` reads true, the onchain membership check other contracts and tools rely on,
- emits a `DAORegistered(dao, creator, subdomain)` event, the signal explorers and indexers use to discover and list DAOs, and
- optionally assigns the DAO a `.dao.eth` ENS subdomain.
Registration is **permissioned** (`REGISTER_DAO_PERMISSION_ID`), and that permission is held only by the DAOFactory, so arbitrary contracts cannot self-register in the canonical list. It's one of the two component registries built on the shared [`InterfaceBasedRegistry`](/framework/registries.md#one-shared-pattern-interfacebasedregistry) pattern: it admits only `IDAO` contracts, and none twice.
## Keep in mind
- **The DAO's ENS name is optional.** `register` skips the ENS step when the subdomain is empty; the DAO is still registered. See the [subdomain rules](/framework/registries.md#ens-subdomains).
- **Only the factory writes here.** There is no self-registration path; being in the registry means the official DAOFactory created the DAO.
## See also
- [Registries and ENS names](/framework/registries.md) — the shared registry pattern and ENS naming (overview).
- [DAOFactory](/framework/dao-factory.md) — creates DAOs and holds the register permission.
- [PluginRepo Registry](/framework/plugin-repo-registry.md) — the sibling registry, for plugin repos.
# PluginRepo Registry
The `PluginRepoRegistry` is the canonical onchain list of every published [plugin repo](/framework/plugin-repo.md). The [PSP](/framework/plugin-setup-processor.md) checks `entries(repo)` before it will install from a repo, so **a plugin is only installable if its repo is registered here.** Registration is the protocol's trust boundary for plugins.
## What it holds and enables
The [PluginRepoFactory](/framework/plugin-repo.md) calls `registerPluginRepo(subdomain, repo)` when a repo is created, which:
- records the repo so `entries(repo)` reads true, exactly what the PSP checks,
- emits `PluginRepoRegistered(subdomain, repo)` for explorers and indexers, and
- optionally assigns a `.plugin.dao.eth` ENS subdomain.
Registration is **permissioned** (`REGISTER_PLUGIN_REPO_PERMISSION_ID`), held only by the PluginRepoFactory, so nothing but the official factory can make a repo installable. Like the [DAO Registry](/framework/dao-registry.md), it's built on the shared [`InterfaceBasedRegistry`](/framework/registries.md#one-shared-pattern-interfacebasedregistry) pattern: it admits only `IPluginRepo` contracts, and none twice.
## Keep in mind
- **Registered = trusted = installable.** The PSP's `entries(repo)` gate is what counts: an unregistered repo can't be installed from, no matter how valid its contracts are.
- **The subdomain requirement is version-dependent.** Through v1.3.0 a name was required (an empty one reverts `EmptyPluginRepoSubdomain`); v1.4.0 made it optional. See the [subdomain rules](/framework/registries.md#ens-subdomains).
## See also
- [Registries and ENS names](/framework/registries.md) — the shared registry pattern and ENS naming (overview).
- [PluginRepo](/framework/plugin-repo.md) — what each entry is (per-plugin versioning).
- [The PluginSetupProcessor](/framework/plugin-setup-processor.md) — gates installs on registration here.
- [DAO Registry](/framework/dao-registry.md) — the sibling registry, for DAOs.
# Member registry
The `MemberRegistry` is a **convenience fallback** for DAO members who want a human-friendly ENS name but would rather not buy one. Instead of registering a name on the open market, any address can claim a **free subdomain** under the parent the registry manages (an `initialize` parameter, not hardcoded; Aragon's deployment binds it to **`aragon.eth`**, so members claim `alice.aragon.eth`) and attach a profile to it (avatar, text records, contenthash).
It's self-service and member-owned: you claim, manage, and give up your own name without someone issuing it to you. Members can be addressed by name rather than a hex address, without buying and managing their own ENS domain. It's the people-facing counterpart to the protocol's component [registries](/framework/registries.md).
> A newer addition to the codebase (authored 2026, on a later compiler), layered onto the v1.4.0 core.
## How it works
- **Self-service, no permission.** Claiming (`register`), giving up (`release`), and renaming (`move`) are open to anyone. The only governed action is `evict` (gated by `EVICT_SUBDOMAIN_PERMISSION_ID`), which lets a DAO reclaim or reassign a name.
- **Members own their records.** The registry keeps ownership of each ENS subnode (the same custody pattern as the [ENSSubdomainRegistrar](/framework/registries.md#ens-subdomains)) but grants each member *per-node resolver approval*, so a member sets their own avatar/text/contenthash directly on the resolver without an intermediary.
- **Name rules.** Subdomains are 3–50 characters, lowercase alphanumeric and dashes, with no leading or trailing dash.
- **Clean handover.** Releasing or moving a name clears its resolver records and address first, so a relinquished name never resolves to stale data.
## See also
- [Registries and ENS names](/framework/registries.md) — the DAO/plugin registries and the shared subnode-custody pattern.
# Helpers
Protocol **helpers**: contracts that support the core and plugins without being either.
- [Condition Library](/helpers/condition-library.md) — ready-made [permission conditions](/common/permission-conditions.md) for common gating patterns (selector allow-lists, Safe-owner gating) so a DAO needn't write bespoke ones (source: `conditions`).
**Exact signatures:** the generated [`conditions` ABI reference](/abi/conditions/index.md) has every public function, event, error and constant of these contracts, with its NatSpec.
## Where to start
Start with [permissions and conditions](/common/permission-conditions.md) before reading about the condition library.
_Helpers are neither core nor plugin, so unrelated contracts can accumulate in this area. If a third unrelated helper is added, give it its own area._
# Condition Library
The Condition Library is a set of **ready-made [permission conditions](/common/permission-conditions.md)** for common gating patterns, so a DAO doesn't have to write and audit a bespoke condition contract every time it wants to constrain a permission. You deploy one (via the [factory](#the-conditionfactory)) and attach it with [`grantWithCondition`](/core/permissions.md#granting-and-revoking); from then on the permission is allowed only when the condition says so. All three are audited.
## The three conditions
Choose a condition by *what it inspects*:
- **[SelectorCondition](/helpers/condition-library/selector-condition.md)** — allow only a set of function **selectors** on the *direct call* being authorized. "This permission, but only to call functions X and Y."
- **[ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md)** — scope the DAO's [`EXECUTE_PERMISSION_ID`](/core/execution.md) by reaching *inside* an `execute()` batch and allow-listing each action's `(target, selector)`. "This plugin may make the DAO execute, but only these calls."
- **[SafeOwnerCondition](/helpers/condition-library/safe-owner-condition.md)** — allow only the current owners of a given [Safe](https://safe.global), a live bridge from a Safe's membership to a DAO permission.
**`SelectorCondition` gates the direct call's own selector; `ExecuteSelectorCondition` gates the selectors of the actions *inside* an `execute()`.** Pick by which call the permission you're guarding actually receives.
## The `ConditionFactory`
`ConditionFactory` deploys instances of the three conditions (`deploySelectorCondition`, `deployExecuteSelectorCondition`, `deploySafeOwnerCondition`) and emits an event for each. It uses plain deployment (no deterministic addresses or clones). This provides a single, audited deployment path: one known factory address per network, with events that let you find and trace every condition instance.
## Using one
The flow is always the same:
1. Deploy the condition (via the factory) with its initial configuration.
2. Grant the permission with it attached: `dao.grantWithCondition(where, who, permissionId, condition)`, often with `who` = [`ANY_ADDR`](/core/permissions.md#the-wildcard-any_addr). What that means depends on the condition: `SafeOwnerCondition` reads `who`, so `ANY_ADDR` + it = "only Safe owners"; the selector conditions **ignore `who`**, so `ANY_ADDR` + them = "anyone, but only these functions/actions" (they gate *what*, not *who*).
3. Manage the allow-list over time (for the selector conditions) via their `MANAGE_SELECTORS_PERMISSION_ID`, typically held by the DAO.
## Keep in mind
- **A selector is not its arguments.** These conditions allow-list *which function/action* may run, not *with what arguments*; for argument-level rules, write a bespoke [condition](/common/permission-conditions.md) or use [RuledCondition](/common/ruled-condition.md).
- **All conditions [fail closed](/common/permission-conditions.md).** A malformed call, or a Safe that doesn't answer, resolves to "denied", never a surfaced error.
## See also
- [SelectorCondition](/helpers/condition-library/selector-condition.md), [ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md), [SafeOwnerCondition](/helpers/condition-library/safe-owner-condition.md) — the three, each in depth.
- [Permission conditions](/common/permission-conditions.md) and [RuledCondition](/common/ruled-condition.md) — what a condition is, and how to build ones these fixed patterns don't cover.
- [The permission system](/core/permissions.md) — `grantWithCondition` and `ANY_ADDR`.
# ExecuteSelectorCondition
`ExecuteSelectorCondition` scopes a DAO's [`EXECUTE_PERMISSION_ID`](/core/execution.md) so the holder can only make the DAO run a **specific set of `(target, function)` calls**. It's the [condition library](/helpers/condition-library.md) member that checks actions *inside* an `execute()` batch. Compare it with [SelectorCondition](/helpers/condition-library/selector-condition.md), which checks the direct call's selector.
## When to use it
You want to grant a plugin (or any address) the ability to make the DAO [execute](/core/execution.md) actions, but **only certain ones**. For example: "this rewards plugin may make the DAO execute, but only `transfer` calls to the USDC contract." Attach this condition to the DAO's `EXECUTE_PERMISSION_ID` grant and a blanket "can move anything" becomes a tightly-scoped "can only do these calls."
## What it checks
Unlike [SelectorCondition](/helpers/condition-library/selector-condition.md), which looks at the *direct call's* selector, this one only fires when the call **is** `execute()`, then **reaches inside the batch**:
```solidity
if (getSelector(_data) != IExecutor.execute.selector) return false; // must be execute()
(, Action[] memory actions,) = abi.decode(_data[4:], ...); // unpack the batch
// for each action: check its (to, selector) against the allow-lists
```
For every [action](/core/execution.md) it checks the target-and-selector pair against a **per-target** allow-list (`allowedSelectors[target][selector]`), plus a separate per-target flag for native-coin movements (`allowedNativeTransfers[target]`). So it constrains *the selectors of the actions the DAO is asked to run*, not the direct call.
There are two rules to get right:
- **All-or-nothing across the batch.** If *any* action's target/selector isn't allowed, the whole `execute` is denied.
- **Value needs clearing, even for a function call.** An action carrying a non-zero `value` is denied unless its target is native-transfer-cleared, *on top of* its selector being allow-listed. Allow-listing a payable `deposit()` but not clearing native transfers to that target still rejects a value-bearing call. A plain transfer (an action with no calldata) likewise needs the target cleared.
## Configuration
| | |
|---|---|
| Constructor | `(IDAO _dao, SelectorTarget[] _initialEntries)` where `SelectorTarget { address where; bytes4[] selectors; }` |
| Manage selectors | `allowSelectors(SelectorTarget)` / `disallowSelectors(SelectorTarget)` |
| Manage native transfers | `allowNativeTransfers(address)` / `disallowNativeTransfers(address)` |
| Managed by | `MANAGE_SELECTORS_PERMISSION_ID` (grant to the DAO) |
| Events | `SelectorAllowed/Disallowed(selector, where)`, `NativeTransfersAllowed/Disallowed(where)` |
**Native transfers use their own switch, not a selector.** A value-bearing action with empty calldata is authorized by `allowNativeTransfers(target)` (the `allowedNativeTransfers` map), never by a zero-selector entry. `isGranted` routes empty-calldata actions there and never reads `allowedSelectors[target][0]`. (The source struct comment suggesting a zero selector is misleading; ignore it.)
This switch has **no constructor path**: `_initialEntries` only seeds selectors, so a condition that must allow native transfers needs a separate governed `allowNativeTransfers` call after deployment. Plan for that extra action if you configure the condition in a one-shot genesis deployment.
## Keep in mind
- **Attach it to the right permission.** It's built for the DAO's `EXECUTE_PERMISSION_ID` (the grant to the executing plugin); on any other permission it denies, since the call won't be `execute()`.
- **Management is idempotent** (a redundant `allowSelectors`/`allowNativeTransfers` is a no-op), unlike [SelectorCondition](/helpers/condition-library/selector-condition.md), which reverts on redundant changes.
- **A selector is not its arguments.** It allow-lists *which* calls, not their arguments; for value/argument caps use a bespoke [condition](/common/permission-conditions.md) or [RuledCondition](/common/ruled-condition.md).
- **A no-op action denies the whole batch.** An action with empty calldata *and* zero value returns `false`. Adding such an action to an otherwise-allowed `execute()` rejects the entire call.
## See also
- [Condition Library](/helpers/condition-library.md) — the library overview and the factory.
- [SelectorCondition](/helpers/condition-library/selector-condition.md) — the direct-call counterpart.
- [Actions and execution](/core/execution.md) — the `execute`/`Action` shape this inspects.
# SafeOwnerCondition
`SafeOwnerCondition` restricts a permission to the **current owners of a given [Safe](https://safe.global)**. Grant a DAO permission to any address with this condition attached, and only that Safe's owners can actually use it. It's part of the [condition library](/helpers/condition-library.md).
## When to use it
When a group already coordinates through a Safe and you want that same group to hold a DAO permission, without re-listing them in the DAO. It **bridges an existing Safe's membership into OSx permissions**: the Safe stays the single source of truth for "who's in the group," and the DAO permission follows it.
## What it checks
Its [`isGranted`](/common/permission-conditions.md) asks the Safe, live, whether the caller is an owner:
```solidity
(bool ok, bytes memory res) = safe.staticcall(isOwner(_who));
return ok && res.length == 32 && abi.decode(res, (bool));
```
- **It's evaluated on every call**, so it always reflects the Safe's *current* owners: add or remove an owner on the Safe and who can use the DAO permission changes immediately, with no action on the DAO side.
- It reads **`who`** (the caller being authorized), so pairing it with an [`ANY_ADDR`](/core/permissions.md#the-wildcard-any_addr) grant yields exactly "any current Safe owner."
- It [fails closed](/common/permission-conditions.md): if the Safe call reverts or returns something malformed, the answer is "not an owner."
## Configuration
| | |
|---|---|
| Constructor | `(IOwnerManager _safe)` — the Safe to read ownership from; validated at deploy by a shape-check that it answers `isOwner` (else `InvalidSafe`) |
| Mutable? | No. `safe` is set once, no setter, no admin permission. To target a different Safe, deploy a new condition. |
It has **no management permission** because there's nothing to configure after deployment; the "list" lives on the Safe.
## Keep in mind
- **The Safe governs this permission.** Whoever can change the Safe's owners can change who holds the DAO permission, with immediate effect and no DAO vote. That's the feature, but be deliberate: you're delegating that authority to the Safe.
- **Immutably bound to one Safe.** Re-targeting means a fresh deployment and re-grant.
- **The shape-check is not an identity proof.** Deploy-time validation only confirms the target answers `isOwner(address)` with 32 bytes; *any* contract with that signature passes. It won't detect a non-Safe contract that answers this call, so point it at a genuine Safe.
## See also
- [Condition Library](/helpers/condition-library.md) — the library overview and the factory.
- [Permission conditions](/common/permission-conditions.md) — how a condition is consulted, and fail-closed semantics.
# SelectorCondition
`SelectorCondition` narrows a permission so it may only be used to call a **specific set of functions**. It holds an allow-list of function selectors and, when consulted, permits the call only if the function being invoked is on that list. It's part of the [condition library](/helpers/condition-library.md).
## When to use it
A single permission often gates several `auth`-protected functions on a contract. When a given holder should be able to reach only *some* of them, attach a `SelectorCondition` allow-listing just those selectors. "You hold this permission, but only for functions X and Y."
## What it checks
Its [`isGranted`](/common/permission-conditions.md) checks one mapping entry:
```solidity
return allowedSelectors[getSelector(_data)];
```
It inspects the **selector of the call being authorized** (the first 4 bytes of that call's calldata) and returns whether it's allow-listed. Two things follow:
- **It gates the *direct* call's own function.** If you instead want to constrain the actions *inside* a DAO `execute()`, that's the sibling [ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md).
- **It ignores who is calling.** The `where`/`who`/`permissionId` are unused; only the selector matters. So granting to [`ANY_ADDR`](/core/permissions.md#the-wildcard-any_addr) with this condition means *anyone may call the allow-listed functions*, the gate is on **what** is called, not **who**.
The allow-list is **global** (a plain `mapping(bytes4 => bool)`, no per-target dimension), so an allowed selector is allowed wherever this condition applies.
## Configuration
| | |
|---|---|
| Constructor | `(IDAO _dao, bytes4[] _initialSelectors)` — the DAO it reads permissions from, and an initial allow-list |
| Manage | `allowSelector(bytes4)` / `disallowSelector(bytes4)` |
| Managed by | `MANAGE_SELECTORS_PERMISSION_ID` (grant it to the DAO so changes go through governance) |
| Events | `SelectorAllowed(selector)` / `SelectorDisallowed(selector)` |
## Keep in mind
- **Redundant updates revert.** `allowSelector` on an already-allowed selector reverts `AlreadyAllowed` (and the mirror for disallow). This differs from [ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md), whose updates are idempotent. Account for this when scripting list changes.
- **A selector is not its arguments.** This allow-lists *which function*, not *with what arguments*; for argument-level rules use a bespoke [condition](/common/permission-conditions.md) or [RuledCondition](/common/ruled-condition.md).
## See also
- [Condition Library](/helpers/condition-library.md) — the library overview and the factory.
- [ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md) — the same idea applied *inside* a DAO `execute()`.
# Deployment
Deploying the protocol itself and the DAOs built on it.
- [Protocol Factory](/deployment/protocol-factory.md) — one-shot deployment of the whole OSx stack (framework + ENS + the governing Management DAO + core plugin repos) onto a new EVM chain (source: `protocol-factory`).
- [DAO Launchpad](/deployment/dao-launchpad.md) — deploy a DAO on top of an existing protocol through an onchain factory that configures it at creation (source: `dao-launchpad`).
Both use a **correct-from-genesis one-shot factory**: everything is configured in a single atomic, verifiable deployment that ends with the factory holding no power. One operates at protocol scale, the other at DAO scale.
### Key pages
- [The deployment checklist](/deployment/deployment-checklist.md) — the guarantees a safe production deployment ceremony enforces, and why each one matters.
## Where to start
Understand the [core](/core/index.md) (what gets deployed and why) before the factory (how it all gets deployed at once). Then read the [Protocol Factory](/deployment/protocol-factory.md) (standing up OSx itself) and the [DAO Launchpad](/deployment/dao-launchpad.md).
# Protocol Factory
The Protocol Factory deploys **OSx itself** on a new EVM chain. Where the [DAO Launchpad](/deployment/dao-launchpad.md) deploys *one DAO* onto an existing protocol, this deploys *the protocol*: the whole framework, its ENS naming, the governing Management DAO, and the core plugin repos, configured together in one deterministic process.
## The problem it solves
OSx is a framework, not a single contract. Before anyone can create a DAO on a chain, that chain needs the entire framework live and correctly cross-permissioned: the [DAO base](/core/dao.md) implementation, the [DAO and plugin registries](/framework/registries.md), the [PluginRepoFactory](/framework/plugin-repo.md), the [PluginSetupProcessor](/framework/plugin-setup-processor.md), the [DAOFactory](/framework/dao-factory.md), an [ENS](/framework/registries.md) setup for `dao.eth` and `plugin.dao.eth`, and the core plugins published so they can be installed. That is a large graph of contracts and permissions; wiring it by hand, transaction by transaction, is both error-prone and dangerous (each intermediate state leaves the protocol's control in flux). The factory makes standing it up a **single, reviewable, deterministic** event, so every chain gets the same canonical, correctly-owned deployment.
## What it stands up
- **OSx framework** — the registries, the `DAOFactory` and `PluginRepoFactory`, the `PluginSetupProcessor`, and the shared executor, deployed as proxies over their base implementations.
- **ENS naming** — a registry + resolver and two subdomain registrars (`dao.eth` for DAOs, `plugin.dao.eth` for plugin repos), so registered DAOs and repos get resolvable names.
- **The Management DAO** — the DAO that governs the protocol (below).
- **The core plugin repos** — Admin, Multisig, Token Voting, SPP, and Lock to Vote, each published into its own [PluginRepo](/framework/plugin-repo.md) owned by the Management DAO.
## The Management DAO governs the protocol
The **Management DAO** is an ordinary OSx [DAO](/core/dao.md), governed by a [Multisig](/plugins/multisig-plugin.md), that *owns the protocol's shared infrastructure*. It holds the permissions to register upgrades on the [registries](/framework/registries.md), operate the ENS subdomain registrars, and maintain the [core plugin repos](/framework/plugin-repo.md) by publishing new versions. The protocol is therefore **self-governed by an Aragon DAO**: changing a registry implementation or publishing a new core-plugin build requires a governance action of the Management DAO rather than a privileged key.
## Deploy once, then read-only forever
The factory is also a permanent, tamper-proof **record of exactly what was deployed**. Its constructor takes and freezes the entire configuration: every implementation address, the ENS domains, each core plugin's `(release, build)` and metadata, and the Management DAO's members and approval threshold. There is **no owner, no admin, and no setter** anywhere on the contract. You run the deployment to completion exactly once, and from then on the factory exposes two reads:
- `getParameters()` — the exact configuration the deployment used.
- `getDeployment()` — every address it produced (the registries, the `DAOFactory`/`PluginRepoFactory`, the PSP, the ENS contracts, the Management DAO and its multisig, and each core plugin repo).
Nobody can change the record afterwards. The factory is the canonical source of truth for that chain's OSx deployment: anyone with its address can read both the settings used and the addresses produced, permanently and without trusting an off-chain manifest. Those records cannot be redirected later.
## Split to fit chain limits
The full graph is too big for one contract in one transaction, so the factory works around two EVM limits, without weakening the deploy-once-then-frozen guarantees:
- **Code size (EIP-170's ~24 KB).** Most deployment logic lives in separate **helper deployer factories**, `DAOHelper`, `ENSHelper`, `PluginRepoHelper`, and `PSPHelper`, passed into the ProtocolFactory's constructor. Embedding it all in one contract would exceed the bytecode cap.
- **Per-transaction gas.** The run is split into **five sequential phases**: the deployer calls `deployPhase()` repeatedly until it reports complete, because doing it in a single transaction would exceed the gas limit on many networks.
Deployment therefore uses multiple contracts *and* transactions. It still produces a frozen record and ends with the factory holding no power; the work is divided into phases to fit chain limits.
## Correct from genesis
During deployment, the factory temporarily holds `ROOT` + `EXECUTE` on the Management DAO. It configures every permission across the registries, registrars, repos, and the DAO's own multisig install, then **revokes both as the final step**. When deployment concludes, the factory has no power over anything it created; the Management DAO's multisig is the sole authority. The deployed bytecode is verified against OSx's audited source, so the running protocol provably matches reviewed code.
Granting temporary power and revoking it at completion is part of the general Aragon factory pattern, alongside one-time, atomic, verifiable onchain deployment. The [DAO Launchpad](/deployment/dao-launchpad.md)'s one-shot factory applies the same pattern to a single DAO.
**Version parity across chains.** When a core plugin's canonical version is a build > 1, the factory publishes placeholder versions for the earlier builds before the real one, so a plugin's `(release, build)` means the *same* thing on every chain.
## A fresh OSx for building plugins
The factory also deploys OSx for a plugin's test suite. A `ProtocolFactoryBuilder` (Foundry) creates a complete, fresh protocol with defaults or selected overrides, and you can read the results:
```solidity
ProtocolFactory factory = new ProtocolFactoryBuilder().build();
// ...run the deployment to completion...
ProtocolFactory.Deployment memory d = factory.getDeployment(); // daoFactory, PSP, repos, …
```
A [plugin author](/tooling/plugin-template.md) can therefore fork-test against the actual framework instead of custom mocks. The same factory deploys OSx on a chain and in CI.
## Keep in mind
- **This deploys the protocol, not a DAO.** To create a DAO on an already-deployed protocol, use the [DAO Launchpad](/deployment/dao-launchpad.md) and the [DAOFactory](/framework/dao-factory.md).
- **The Management DAO governs through its multisig.** Protocol upgrades and new core-plugin versions require that governance; there is no separate admin authority.
- **The factory keeps no power.** Its bootstrap `ROOT`/`EXECUTE` on the Management DAO is revoked as the final step. Deployment is complete only once those permissions are revoked.
## See also
- [DAO Launchpad](/deployment/dao-launchpad.md) — the DAO-scale counterpart (one DAO on an existing protocol).
- [Registries](/framework/registries.md) — the DAO/plugin registries and ENS naming this deploys and hands to the Management DAO.
- [PluginRepo](/framework/plugin-repo.md), [PluginSetupProcessor](/framework/plugin-setup-processor.md), [DAOFactory](/framework/dao-factory.md) — the framework pieces stood up here.
- [The deployment checklist](/deployment/deployment-checklist.md) — the ceremony and guarantees for actually running this deployment safely.
- [Deployment overview](/deployment/index.md).
# DAO Launchpad
The DAO Launchpad is the **deployment workbench** for launching DAOs on top of an already-deployed [OSx protocol](/deployment/index.md). It contains deployment projects with a prescribed structure; each deploys one DAO, its plugins, and any custom contracts the launch needs through a single, auditable onchain factory.
## Where it fits
The Launchpad handles the third of these related deployment jobs:
- **Publishing a plugin** (authoring one and creating a [PluginRepo](/framework/plugin-repo.md) version) makes a plugin *available* to any DAO before a launch.
- **Deploying OSx itself** onto a chain is the [Protocol Factory](/deployment/protocol-factory.md)'s job; it stands up the framework a launch then targets.
- **Standing up one custom DAO** that combines standard plugins, your own customized plugins, standard [conditions](/helpers/condition-library.md) and custom ones, plus any bespoke contracts, into a single organization. This is the Launchpad's role.
Those components come from **different repos**. Assembling them into one DAO with the correct permissions must be **atomic, deterministic, and verifiable**.
## The problem it solves
Deploying a governed DAO takes several steps: create the [DAO](/core/dao.md), [install each plugin](/framework/plugin-setup-processor.md), set every [permission](/core/permissions.md), then hand control to whoever should own it. Separate transactions leave a **partially configured DAO** between steps that someone could exploit, while the deployer **temporarily holds power** over funds and governance. The launchpad makes the whole sequence a single, reviewable, all-or-nothing event.
## Correct from genesis
All deployment logic lives in a **one-shot onchain factory**, a Solidity contract whose `deployOnce()` performs the whole sequence atomically: create the DAO, configure each component, hand governance to its permanent owner, and finally **revoke its own bootstrap power**. Because it's one transaction, the DAO is either deployed with its full configuration and correct permissions or is never deployed at all. There is no window in which it exists but is misconfigured or still under the deployer's control. This also gives the deployment two properties:
- **Verifiable** — what was deployed is auditable from the factory's verified onchain source, without trusting a local script.
- **Idempotent** — a second `deployOnce()` reverts, so a launch can't be run twice by accident.
## One workbench, many projects
The launchpad is a **monorepo** hosting self-contained deployment projects, one per launch. They share a single set of dependencies and one task runner (from [just-foundry](/tooling/just-foundry.md)), so each launch reuses the Foundry setup, remappings, network configs, and secrets handling. Each project owns what's specific to *its* launch: the factory, the custom contracts, and the parameters.
A **template** provides a minimal working DAO that demonstrates the configuration end to end. Use it as a scaffold, replacing its factory, custom contracts, and parameters with those for your launch.
## Keep in mind
- **The factory makes deployment atomic.** The scripts deploy and invoke it; the correctness guarantees come from completing setup onchain in one call.
- **Replace the template with your launch's own contracts.** It is a scaffold for building your deployment.
## See also
- [DAOFactory](/framework/dao-factory.md) and [the PluginSetupProcessor](/framework/plugin-setup-processor.md) — the OSx machinery every launch factory drives.
- [Deployment overview](/deployment/index.md); the [Protocol Factory](/deployment/protocol-factory.md) deploys the protocol a launch targets.
# The deployment checklist
A production deployment of [the protocol](/deployment/protocol-factory.md) or a [DAO launch](/deployment/dao-launchpad.md) follows a **ceremony**: a sequence of checks around `just deploy`. The canonical checklist lives in the [Protocol Factory](/deployment/protocol-factory.md)'s README; other repos adapt it with their own specifics. Deployment is effectively irreversible, so each step verifies a concrete **guarantee** before the result is accepted.
The factory deploys everything atomically and then [freezes into a read-only record](/deployment/protocol-factory.md#deploy-once-then-read-only-forever), making these guarantees checkable onchain after deployment. The off-chain checklist verifies the code, configuration, and procedure used for that deployment.
## The ceremony, step by step
A recommended run, in order, using the [just-foundry](/tooling/just-foundry.md) recipes the repos ship. Each box maps to a [guarantee below](#the-guarantees-it-enforces). This mirrors the canonical checklist in the [Protocol Factory README](/deployment/protocol-factory.md); treat **each repo's README as authoritative** for its exact steps (some, e.g. token-voting, expose the same recipes as `make` targets rather than `just`).
**Prepare, reviewed code + a clean key**
- [ ] Clone the official repo and check out `main`; `git status` reports no local changes and matches `origin/main`.
- [ ] Work inside a **disposable Docker environment** (e.g. `docker run --rm -it -v .:/deployment … debian:trixie-slim`), install `just` + `git` + Foundry, then `just init `.
- [ ] Create a fresh burner wallet with `cast wallet new` and use its key as `DEPLOYER_KEY`; you are the **sole operator**.
- [ ] Set secrets via [`vars`](/tooling/just-foundry.md) (optional, recommended) or the root `.env`: `vars set DEPLOYER_KEY`, `vars set ETHERSCAN_API_KEY`.
- [ ] Set the deployment parameters in the root `.env` (e.g. management-DAO min-approvals, members file, metadata URIs).
- [ ] `just env`, confirm every resolved value and its source is correct.
- [ ] The machine is on a trusted network with **no exposed ports**.
**Rehearse, no surprises at broadcast**
- [ ] `just test`, the suite runs clean.
- [ ] `just predeploy`, the simulation completes with no errors.
- [ ] `just balance`, the wallet holds **≥15% over** the simulated gas estimate.
- [ ] Every member pulls `main` and reports the **same `git log -n 1` commit hash**.
**Broadcast**
- [ ] `just deploy`, runs the tests, broadcasts, verifies, and tees to `logs/` (the factory deploys atomically and revokes its own power as the final step).
**Verify & attest**
- [ ] Contracts are verified on the target network's block explorer.
- [ ] The `logs/deployment--.log`, the console output, and the `artifacts/addresses--.json` manifest **all agree**; every member confirms the addresses.
- [ ] Diff the verified onchain sources against the **exact commit you deployed** (and the audit it corresponds to) with [EVM Mirror](/tooling/evm-mirror.md).
**Close out**
- [ ] `just refund`, return leftover deployer funds to the address that funded the wallet.
- [ ] Publish the log, the address manifest, and the broadcast file to a shared location, and sync the addresses into the per-network config so the ecosystem can find them.
## The guarantees it enforces
- **You deploy exactly the reviewed code.** Deploy from the official repo's `main`, with a clean `git status`, and have every member of the ceremony independently confirm the *same* commit hash. Afterwards, verify the contracts on the block explorer and diff them ([EVM Mirror](/tooling/evm-mirror.md)) against the exact commit you deployed and the audit it corresponds to. These checks prove that the running code matches what was reviewed and audited, including the absence of local modifications.
- **The broadcast is rehearsed, funded, and tested.** Simulate the deployment first (`predeploy`), keep the test suite passing, and fund the wallet with margin over the simulated estimate.
- **The result is recorded and independently attested.** The run is logged, and it emits an address-manifest artifact. Console output, log, and artifact must agree, and every member confirms the values before they're trusted. Together they form a tamper-evident, multi-party record of what was deployed.
- **Clean exit.** Refund leftover deployer funds to their source and sync the new addresses into the canonical per-network config registries. This closes out the deployment and lets the wider ecosystem find it.
## Keep in mind
- **Each item secures a specific property.** Skipping it removes that guarantee: reviewed-code parity, key hygiene, a rehearsed broadcast, or an attested record.
- **The canonical checklist lives with the code.** Treat the [Protocol Factory README](/deployment/protocol-factory.md) as the source of truth for the exact steps. Other repos may require additional checks.
## See also
- [Protocol Factory](/deployment/protocol-factory.md) — what a protocol deployment stands up, and the immutable onchain record the ceremony produces.
- [DAO Launchpad](/deployment/dao-launchpad.md) — DAO-scale launches that follow the same discipline.
- [Deployment overview](/deployment/index.md).
# Tooling
The **tooling** for building on OSx: the scaffolding you start a plugin from, and the shared task runner the repos deploy with. For step-by-step walkthroughs, see the [guides](/guides/index.md).
- [Plugin Template (Foundry)](/tooling/plugin-template.md) — a starting-point repo for writing, testing, publishing, and deploying your own OSx plugin (source: `osx-plugin-template-foundry`).
- [Foundry Task Runner (just-foundry)](/tooling/just-foundry.md) — the shared `just`/Foundry task runner and environment manager the Aragon repos use for building, testing, deploying, and verifying across chains (source: `just-foundry`).
- [EVM Mirror](/tooling/evm-mirror.md) — Aragon's source-verification CLI: checks that a contract's verified onchain code matches the exact commit that was deployed (source: `evm-mirror`).
## Where to start
Read about the [plugin framework](/framework/index.md) and [what a plugin and its setup are](/framework/plugin-types.md) before using the [template](/tooling/plugin-template.md) to scaffold one. Follow the [guides](/guides/index.md) for step-by-step instructions.
# Plugin Template (Foundry)
A GitHub template repository that scaffolds a new OSx plugin, the intended starting point when you set out to [write your own plugin](/framework/index.md). Create a repo from it to start with a tested plugin project ready for publishing and deployment, without assembling the OSx boilerplate by hand.
## Why start from it
Writing a plugin requires more than one contract. You need the right [plugin base type](/framework/plugin-types.md) for your upgradeability choice, a [PluginSetup](/framework/plugin-setup.md) that grants *exactly* the right permissions on install and revokes them on uninstall, tests that exercise it against a real DAO, and scripts to publish and deploy it. Errors in any of these can cause plugin bugs. The template supplies working versions of each, so you can concentrate on your plugin's logic.
## What it gives you
- **Contract starters** for the [plugin base types](/framework/plugin-types.md) (the non-upgradeable, cloneable, and UUPS-upgradeable variants), so you can start from the base that matches your requirements.
- **[PluginSetup](/framework/plugin-setup.md) scaffolding** wired to those contracts, the prepare-install / prepare-uninstall logic that the [PluginSetupProcessor](/framework/plugin-setup-processor.md) drives.
- **Deploy scripts and factories**, including the [one-shot factory](/deployment/dao-launchpad.md#correct-from-genesis) pattern for standing up a custom DAO with your plugin, and scripts for publishing to a [PluginRepo](/framework/plugin-repo.md).
- **A testing environment** for unit tests, fork tests against a live network, and use-case scenarios.
- **Multi-explorer verification** and a self-documenting **`just`** task runner (via [just-foundry](/tooling/just-foundry.md)) covering the whole build/test/deploy workflow. Run `just init` to set up the project.
## Which starter path to take
The template ships **examples of every variant** so each pattern is there to learn from; a real plugin keeps one of each and deletes the rest. Two choices define your path:
**1. The plugin base type** (see [choosing a plugin base](/framework/plugin-types.md)). The repo includes all three, `MyUpgradeablePlugin` (UUPS), `MyCloneablePlugin` (clone), and `MyStaticPlugin` (non-upgradeable). Keep the one you want, point [`MyPluginSetup`](/framework/plugin-setup.md)'s `constructor()` and `prepareInstallation()` at it, and drop the others. If it's upgradeable, inherit `PluginUpgradeableSetup` instead of `PluginSetup` so you can add `prepareUpdate`.
**2. The deployment flow** (set `DEPLOY_SCRIPT` in the `justfile`; it defaults to `DeploySimple`). The template's real output is a **published plugin**, but it ships three starter scripts:
- **Publish the plugin** to a [PluginRepo](/framework/plugin-repo.md) (`DeploySimple`), the main path, what makes your plugin installable by any DAO.
- **Deploy a DAO with your plugin(s) installed** (`DeployDaoWithPlugins`, trusted) or **via a one-shot factory** (`DeployViaFactory`, trustless), included so you can stand up a DAO *to exercise your plugin*: a demo, an end-to-end test, or a simple one-off.
If your goal is **launching a DAO** rather than building a plugin, use the [DAO Launchpad](/deployment/dao-launchpad.md). It assembles a custom DAO from different components, including plugins published with this template. As a rule of thumb, **build/publish a plugin → this template; launch a DAO → the Launchpad.**
For tests, two builders stand up a DAO with your plugin installed: a **SimpleBuilder** (local) and a **ForkBuilder** (against a real deployed protocol, using the configured factory addresses).
## Where it sits
The template is the plugin *author's* starting point. What you build here becomes a versioned entry in a [PluginRepo](/framework/plugin-repo.md); from there any DAO installs it through the [PSP](/framework/plugin-setup-processor.md). The [framework](/framework/index.md) manages this plugin lifecycle.
## Keep in mind
- **It's a scaffold, replace the sample contracts.** The starters exist to be swapped for your plugin; keep the setup/test/deploy structure, change the logic.
- **Choose the base type deliberately.** Your upgradeability and gas trade-offs are set by which [plugin base type](/framework/plugin-types.md) you start from; the template offers all of them for that reason.
- **Template vs [DAO Launchpad](/deployment/dao-launchpad.md).** Building a (core or custom) *plugin* starts here; use the Launchpad for *launching a DAO*. Although the template includes DAO-deploy scripts, their purpose is to exercise your plugin.
## See also
- [Plugin base types](/framework/plugin-types.md) and [plugin setup](/framework/plugin-setup.md) — what the starters implement.
- [PluginRepo](/framework/plugin-repo.md) and [the PluginSetupProcessor](/framework/plugin-setup-processor.md) — where a finished plugin is published and how it's installed.
- [just-foundry](/tooling/just-foundry.md) — the `just`/Foundry task runner this template inits and runs with (`just init`, `just test`, …), shared across the Aragon repos.
- [Build a plugin](/guides/build-a-plugin.md) and [Publish a plugin](/guides/publish-a-plugin.md) — the step-by-step walkthroughs that use this template.
# Foundry Task Runner (just-foundry)
A **task runner and environment manager** for Foundry projects. Add it as a submodule and write a two-line `justfile` to use the same workflow across every supported chain. It turns multi-step Foundry flows (simulate → broadcast → verify → log) into single commands and resolves each network's environment variables: RPC, chain id, verifier, and Aragon OSx addresses. Switching networks selects the corresponding configuration without requiring you to manage those values by hand. It's the shared tooling the Aragon repos build on: the [plugin template](/tooling/plugin-template.md) initializes and runs with it (`just init`), the [DAO Launchpad](/deployment/dao-launchpad.md)'s projects inherit it, and the [Protocol Factory](/deployment/protocol-factory.md) uses it.
## Why it exists
Every repo that deploys something needs to run tests, simulate, broadcast, verify on the right explorer, select the right network, and load secrets without committing them. Maintaining separate implementations lets them drift apart, which can cause costly deployment mistakes. just-foundry centralizes this work so each project imports a shared workflow, as [launch projects do](/deployment/dao-launchpad.md#one-workbench-many-projects).
Even a single project benefits from the shared configuration and commands:
- **Network-specific settings are configured once and reused.** These include the verifier and its flags, EVM-version overrides (Chiliz wants `shanghai`), zkSync's separate toolchain, and RPC requirements. They live in the shared network config, so `just switch ` selects them for each project and deployment.
- **Named recipes replace repetitive Foundry commands.** The flows (simulate → broadcast → verify → log) require long `forge` invocations whose flags can be mistyped. just-foundry wraps them in commands for each task: `just predeploy`, `just deploy`, `just verify`, and `just refund`, all listed by `just help`. You can look up a task's command rather than remember the full invocation.
A deployment project's configuration has three parts. just-foundry supplies the public network parameters; you provide the project-specific values and secrets.
- **Public network parameters** (RPC, chain id, verifier, and the **deployed OSx addresses**: values that change per chain and are *not* secret) — **supplied by just-foundry** for every supported network, so you don't need to assemble or hardcode them. Their public nature lets projects share the configuration.
- **Project-specific parameters** (how many multisig signers, the min-approvals, metadata URIs, and other values your deployment needs) — yours to set for each deployment.
- **Secrets** (deployer key, API keys) — yours to provide. just-foundry resolves them through the `vars` encrypted store or a plain `.env`.
With the project parameters and secrets set, use `just switch ` and `just deploy` to deploy with that network's configuration.
## What it gives a project
- **Network switching** across the many supported chains, each config carrying the RPC, chain id, verifier choice, and canonical **Aragon OSx addresses** for that chain. Projects reference the network instead of hardcoding addresses.
- **Per-network flag resolution** and an `env` view that shows the resolved environment with the *source* of each value, so you can confirm what a deploy will actually use before broadcasting.
- **Secrets management**, kept out of the repo. Optionally integrates with [`vars`](https://github.com/vars-cli/vars): an **encrypted env-var manager** with a central encrypted store. At run time, it reads what a project declares it needs and **injects** the resolved values into the environment. Foundry receives ordinary env vars, and one vault can serve every project. A plain `.env` file is the fallback requiring no extra installation; recipes work the same way with either source.
- **Deploy / test / verify helpers** with logging, available to a project's `justfile` through `import`.
## Keep in mind
- **just-foundry runs other projects' deployments.** It doesn't deploy a protocol of its own.
- **The network config is the single source of Aragon addresses.** Because each chain's addresses live in the shared config, projects switch networks instead of hardcoding, which is what keeps a project portable across chains.
## See also
- [DAO Launchpad](/deployment/dao-launchpad.md) — the workbench whose projects inherit this runner.
- [Plugin Template (Foundry)](/tooling/plugin-template.md) — the plugin-authoring scaffold, which inits and runs with this (`just init`).
- [Protocol Factory](/deployment/protocol-factory.md) — uses this runner to drive protocol deployments.
# EVM Mirror
EVM Mirror is Aragon's in-house CLI for checking **whether code running onchain matches the code that was reviewed**. It fetches a contract's verified sources from the block explorer (Etherscan V2 and compatibles) and diffs them, file by file, against a reference: a local Foundry checkout at a specific commit, or another onchain contract. It's the tool the [deployment ceremony](/deployment/deployment-checklist.md) ends with.
## The gap it closes
Three artifacts can differ: the **audited git commit** (what reviewers read), the **deployed bytecode** (what users interact with), and the **verified source** on a block explorer (what compiles to that bytecode). The audit report names the commit and the explorer names the source, but neither automatically proves all three are the same code. A swapped dependency or a line edited between audit and deployment can create a mismatch. Checking dozens of source files per address across networks by hand is tedious and error-prone. EVM Mirror automates the comparison, checking source parity in seconds.
It grew out of deployment and upgrade work across 15+ chains, where every release and plugin adds another contract set to re-check. Security-council work also needs these checks: reviewing upgrades, validating proposals, or acting as an independent signer requires an assessment of the code actually running onchain.
## What it does
- **`mirror verify`** — diff one or more onchain addresses against a local source of truth (a git checkout, an installed package, a release artifact, any directory; it's agnostic to how you manage the code). It compares the **complete set** of verified source files the explorer returns, imported libraries and dependencies included, not just the root contract. This is the "deployed == reviewed" check.
- **`mirror diff`** — diff two onchain contracts against each other (e.g. the same contract on two chains).
- **`mirror clone`** — download a verified contract's sources into a ready-to-build local Foundry project (it generates `foundry.toml` and `remappings.txt` and rewrites `@openzeppelin/…`-style paths for Foundry).
- **`--follow-proxy`** — on any command, resolve a proxy to its implementation, so you compare the logic, not the proxy shell.
## Why it's built the way it is
- **Foundry-first.** It reads your `remappings.txt` and resolves imports exactly as your project does when verifying a deployment against the repo that produced it.
- **Minimal and secure by default.** It needs no Python, Docker, or GitHub token. Supply a list of addresses and, on some networks, an Etherscan API key. It runs on Deno, whose permission model (network + read-only file access only) blocks supply-chain attacks from transitive dependencies, and it keeps its own dependency set small.
- **Multi-chain on one key.** Uses Etherscan's V2 multi-chain API and auto-detects the endpoint (Etherscan, Routescan) for a given chain id.
Aragon used Lido's DiffyScan extensively, then needed source verification across arbitrary contracts, many chains, and automated pipelines without repo-specific configuration. EVM Mirror implements that approach dependency-free and with Foundry support. The article [*Mind the gap between the audit and deployment*](https://blog.aragon.org/evm-mirror-mind-the-gap-between-audit-and-deployment/) explains the design.
## Keep in mind
- **It proves source parity, not behavior.** A clean diff means the verified onchain sources match your reference. It doesn't judge whether that code is *correct*; that is the role of the audit corresponding to the commit.
- **Same-repo assumption.** Verifying is smoothest against the repo that deployed the contract; comparing against a differently-structured repo needs explicit remappings.
- **Verify against what you deployed.** The reference is the exact commit that produced the deployment (and the audit it maps to), not a generic "latest."
## See also
- [The deployment checklist](/deployment/deployment-checklist.md) — the ceremony's attest step diffs the deployment with EVM Mirror.
- [just-foundry](/tooling/just-foundry.md) — the task runner those deployments run on.
- [Source repositories](/repositories.md) — where EVM Mirror and the rest of the code live.
# OSx compared
Every access-control system on EVM answers the same question: may this caller perform this action? Each system stores its authorization rules in a different place and associates them with a different object. That choice determines much of its behavior.
This page compares OSx with the three systems it most often sits beside, or inside:
- **OpenZeppelin Contracts**: `Ownable`, `AccessControl`, and the newer `AccessManager`. The default for a single contract.
- **Safe + Zodiac**: a Safe account extended with Modules, Guards and Modifiers. The default for an organization that holds assets.
- **Hats Protocol**: roles as non-transferable ERC-1155 tokens in an admin tree.
For the OSx model itself, read [the permission system](/core/permissions.md) first.
## Each model at a glance
### OpenZeppelin: authorization lives in the function
`Ownable` stores a single `address owner`, and the `onlyOwner` modifier checks the caller against it. It provides one admin and one check, with no further rules to configure.
`AccessControl` replaces that single owner with named roles. A role is a `bytes32` constant, conventionally `keccak256("MINTER_ROLE")`, and `onlyRole(MINTER_ROLE)` gates the function. Accounts are added and removed with `grantRole` and `revokeRole`. Every role has an admin role allowed to do that granting, and unless you say otherwise it is `DEFAULT_ADMIN_ROLE`, which is `bytes32(0)`.
Both share one property: the rules are compiled into the contract they protect. Deploy a new version of that contract and you start from an empty table, re-granting everything by hand. There is also nowhere to ask "what can this organization do", because the answer is scattered across however many contracts you deployed.
[`AccessManager`](https://docs.openzeppelin.com/contracts/5.x/access-control), added in Contracts 5.x, breaks that pattern on purpose. The rules move out into one manager contract. A protected contract marks its functions `restricted` and asks the manager, through `canCall`, whether the caller is allowed.
The manager supports more than role membership. Roles are `uint64` numbers rather than hashes. `setTargetFunctionRole(target, selectors, roleId)` says which role may call which functions on which contract. `grantRole(roleId, account, executionDelay)` can give a member a delay, so their calls have to be scheduled and then executed rather than sent directly. `setTargetClosed` shuts a contract off entirely in an emergency.
OpenZeppelin Contracts is a library, not a full product. You inherit from it, and the organization that results is whatever your team designs, deploys and maintains. Nothing is running that you can point at, you own the release lifecycle, and the answer to "who administers this" is only ever the one you built.
### Safe + Zodiac: authorization lives in the call path
A plain Safe has one rule: *m* of *n* owners sign a transaction and `execTransaction` runs it. This involves no roles and no per-function scoping. If you are an owner and enough co-owners agree, the Safe does what you ask.
[Zodiac](https://www.zodiac.eco/) is a set of conventions for extending that. Its word for the account being extended is the **Avatar**, which in practice means the Safe.
A **Module** is a contract you enable on the Safe. Once enabled it can make the Safe act unilaterally by calling `execTransactionFromModule`. It needs no owner signatures to operate: being enabled *is* the authorization. This is why Safe's own documentation warns that a malicious module can take over the account.
A **Guard** is the counterweight. It runs a check before a transaction (`checkTransaction`) and another after it (`checkAfterExecution`), and it can block execution.
A **Modifier** sits between a module and the avatar. It implements the avatar interface itself, so the module thinks it is talking to the Safe while the modifier gets to intercept. The [Roles Modifier](https://github.com/gnosisguild/zodiac-modifier-roles) restricts a role's members to specific target contracts, specific function selectors, conditions on individual call parameters, and which `ExecutionOptions` are permitted (sending ETH, using delegatecall). The Delay modifier is simpler, imposing a timelock.
The rule is not attached to the function being protected. Instead, it lives on the route the call travels to get there.
Note: these are two products from two teams. Safe is maintained by the Safe ecosystem, Zodiac by Gnosis Guild, with separate repositories, audits and release schedules. Day to day that is invisible but anything you assemble across the two, you also upgrade across two roadmaps.
### Hats: authorization is a credential you wear
A [hat](https://docs.hatsprotocol.xyz/) is a token that represents a role. It is ERC-1155 and non-transferable, and holding a balance of 1 makes you its *wearer*. You cannot hand your hat to someone else; only an admin can move it.
Hierarchy is built into the identifier. A hat ID is a 32-byte bitmap that encodes the entire chain of admins above it. A **tophat** sits at the root of a tree, and every other hat is administered by another hat, so authority over a role is itself a role.
Two pluggable modules decide whether a hat currently counts. An **eligibility** module decides who may wear it and whether they are in good standing. A **toggle** module decides whether the hat is active at all. Both are consulted inside `balanceOf`, which means revocation takes effect immediately rather than waiting for someone to send a transaction.
Gating on a hat uses a balance check: `balanceOf(who, hatId) == 1`, or the named helper `isWearerOfHat`. Hats does *not* execute actions. It answers "who holds this role" but leaves enforcement to whatever reads the answer, most often a Safe through Hats Signer Gate.
So Hats is a primitive rather than a complete system. There is no treasury, no execution, no proposals: you pair it with something that acts. That narrowness is on purpose, and it is why Hats composes with everything else on this page, OSx included.
### OSx: authorization is a database the organization owns
A permission in OSx is a triple: `(where, who, permissionId)`. This is, the contract being called, the caller being authorized, and a hashed name for the capability, such as `EXECUTE_PERMISSION_ID`.
Those triples are stored in the [DAO](/core/dao.md)'s own storage, because the DAO is the `PermissionManager`. So individual contracts keep no access lists of their own. A [plugin](/framework/plugins.md) gates a function with `auth(...)`, and that call [resolves against its DAO](/common/auth.md) instead of against anything the plugin controls.
Any grant can carry a [condition](/common/permission-conditions.md): a contract consulted at call time, which receives the full calldata and can answer yes or no based on the logic it implements. That is where time windows, spending caps and per-argument rules live.
What makes the rest governable is the `ROOT_PERMISSION_ID`. The permission to make the DAO grant and revoke permissions is itself an ordinary permission in the same table. So the power to change the rules is handed out the same way as every other power. In a healthy DAO it is held by the DAO itself.
OSx makes a different trade-off from the other three. It is a framework rather than a library or a primitive: the permission database, execution and a versioned install system come together from one team. The trade-off is that you take on the whole model to use any of it. See [Where other options fit better](#where-other-options-fit-better) for its limitations.
## Axis by axis
| | OpenZeppelin | Safe + Zodiac | Hats | OSx |
|---|---|---|---|---|
| **What it is** | a library you inherit from and assemble yourself | two products, two teams, two release schedules | a role primitive, paired with something that executes | a framework you deploy and operate as one piece |
| **State lives** | in each contract (`AccessControl`); in one manager (`AccessManager`) | in the Safe (owners, module list) and in each Modifier | in the Hats singleton, shared by all orgs | in each DAO's own storage |
| **Addressed by** | role → function, per contract | route → target + selector + params | wearer → hat | `(where, who, permissionId)` + calldata |
| **Who may change it** | role admin / `ADMIN_ROLE` | Safe owners | the admin *hat* | whoever holds `ROOT` (tipically the DAO) |
| **Evaluated at call time** | nothing beyond stored membership (`AccessManager` adds delays) | the *call*, on paths through a Guard or Modifier | the *wearer*, via eligibility and toggle | both, via any [condition](/common/permission-conditions.md) contract |
| **Survives the target contract** | `AccessControl` no, dies with it; `AccessManager` yes, lives in the manager | partly; the Safe outlives its modules | yes, hats are external | yes, the DB is the DAO |
| **Readable by third parties** | `hasRole`, per contract | `isOwner`, module list | `isWearerOfHat`, designed for it | `hasPermission`, `view` and public |
### Where the authorization state lives
Everything else follows from this one. With `Ownable` and `AccessControl` the rules sit inside the thing they protect, so replacing the contract means re-establishing them, and there is nowhere to ask what an organization as a whole can do. `AccessManager`, Zodiac's Roles Modifier and the OSx permission DB all pull the rules out into a contract of their own. Hats goes furthest and makes it a shared singleton.
OSx and `AccessManager` are closest here, and the difference is ownership. An `AccessManager` is infrastructure you point contracts at. The OSx permission DB is the organization itself: the same contract that holds the treasury and executes actions. "Who may do what" and "what the DAO owns" are two things that cannot drift apart.
### What can be addressed
`AccessControl` addresses a function on one contract. `AccessManager` addresses a `(target, selector)` pair. The Zodiac Roles Modifier goes finer than either for outbound calls, down to individual parameter conditions and whether delegatecall or value transfer is permitted. Hats is agnostic by design: a hat is a role, and what the role means is up to whoever reads it.
OSx addresses `(where, who, permissionId)`, where `permissionId` names a capability like `EXECUTE_PERMISSION_ID` rather than a function selector. Capability naming is broader than a selector, but the `auth` modifier forwards the complete `msg.data` to any attached condition, so argument-level precision is available if needed. It just isn't the primary axis. `ANY_ADDR` allows wildcards in the `who` or `where` slot, with guardrails: a wildcard on `where` is only reachable through `grantWithCondition`. Permissions like `ROOT` can never be wildcarded, and the [three tiers do not merge](/core/permissions.md#the-wildcard-any_addr).
### Who may change the rules
`AccessControl` has role admins, defaulting to `DEFAULT_ADMIN_ROLE`, which in practice is often a single EOA. A Safe's module and guard list is changed by the owners, so owner quorum is the root of all authority and any Zodiac scoping ultimately rests on it. A hat's admin is another hat, so Hats expresses authority to manage roles through the same primitive as the roles themselves, and delegation is inherent in the ID.
OSx follows a similar approach. `ROOT_PERMISSION_ID` is an ordinary permission in the ordinary table, so the power to grant is granted like everything else. With a few particularities: ROOT is not a runtime bypass: `isGranted` never consults it, so a ROOT holder still cannot `execute` without holding `EXECUTE_PERMISSION_ID`. What they can do is grant it to themselves first. And in a healthy DAO, ROOT is held by the DAO itself, so every permission change has to go through a proposal. Neither Safe owners nor a `DEFAULT_ADMIN_ROLE` holder has that property by construction.
### Dynamic permissions
Every system here lets an administrator take access away by sending a transaction: `revokeRole`, removing a Safe owner, burning a hat or `revoke`. A very different thing is **evaluating a permission when the call is made**.
Where systems do evaluate something, it tends to be one of two things: **who** (is this account still entitled, right now?) or **what** (is this particular call, with these arguments, allowed?).
`AccessControl` evaluates neither. `hasRole` is a mapping lookup, so the answer moves only when `grantRole` or `revokeRole` are used. Membership is mutable, but dynamic checks are not possible. If entitlement should depend on a token balance, a deadline or a slashing event, something off-chain has to notice and send the revocation. `AccessManager` adds time (delays, scheduling, closing a target) but still no logic about the caller or the call.
**Hats is dynamic about who, not about what.** Every read of `balanceOf` consults the hat's eligibility and toggle modules, so an eligibility contract can strip a wearer the instant some onchain fact changes, with nobody sending a revocation transaction. Hats never sees the call: it is not in the execution path, holds no calldata, and does not know which function you are about to invoke. It answers "does this account still hold the role", nothing more.
**Zodiac is dynamic about what, not about who.** Guards and the Roles Modifier inspect the outbound call, down to individual parameters. Role membership itself is a plain list. And the check only happens on calls that actually route through the module or modifier; anything reaching the Safe another way never meets it.
**OSx conditions cover both.** A condition is any contract implementing `IPermissionCondition`, called with `(where, who, permissionId, data)` where `data` is the full calldata of the call being authorized. So it can decide on the caller, on the arguments, on the clock, on a token balance, on another contract's state, or any combination. It runs on every check, because there is only one path and the check is on it.
OSx conditions fail closed, so a revert counts as "denied" rather than surfacing an error. And a condition on a specific grant does not fall through to a broader wildcard that would have allowed the call. [`RuledCondition`](/common/ruled-condition.md) covers the common cases as a rule list, so simple policies need no new Solidity.
### Whether the rule outlives the contract
An `AccessControl` list dies with its contract, and migrating means re-granting everything. `AccessManager` is the exception: its rules live in a separate manager contract, external to each target, so the permission DB survives any single target (it dies only with the manager itself). A Safe outlives its modules, so swapping a module keeps owners and assets intact. Hats are external to every consumer, so a role survives any contract that reads it.
OSx is built around this principle too. Because permissions live in the DAO and plugins are installed against it, capabilities can be [added, updated and removed](/framework/plugin-setup-processor.md) across a DAO's lifetime without redeploying the organization.
### Composition and packaging
This is the one axis where OSx has something the others don't. Everywhere else, wiring a new capability is a sequence of manual steps: deploy the contract, enable the module, set the guard, scope the role, grant the role admin. Each step is separately fallible and separately reviewable, and a half-applied change leaves a security gap to audit.
OSx makes that wiring a declared, atomic artifact. A [plugin setup](/framework/plugin-setup.md) prepares a deployment and returns a list of permission changes requesting what to grant and revoke. The [PluginSetupProcessor](/framework/plugin-setup-processor.md) stored it as a reviewable prepare-then-apply step that the DAO can confirm, and the [PluginRepo](/framework/plugin-repo.md) versions every build. What you review is a permission diff rather than a runbook.
### Who else can read it
`hasRole` is public but per-contract. Safe exposes `isOwner`. Hats is explicitly a shared credential layer.
OSx's `hasPermission` is `view` and callable by anyone, which makes a DAO's permission table a public authorization service. Other contracts could gate themselves on a DAO's permissions with no cooperation from the DAO, which is exactly how [EIP-1271 signature validation](/core/signature-validation.md) works, and why "who may do what on this DAO" is reusable well beyond the DAO's own functions.
## Doing it the OSx way
### Coming from OpenZeppelin
| OpenZeppelin | OSx |
|---|---|
| `Ownable` + `onlyOwner` | `grant(theContract, alice, SOME_PERMISSION_ID)`. Grant it to the DAO instead of to Alice and every use will need a proposal |
| `bytes32 MINTER_ROLE` + `onlyRole` | [`auth(MINT_PERMISSION_ID)`](/common/auth.md) guarding the function |
| `grantRole` / `revokeRole` | `grant` / `revoke`, gated by `ROOT_PERMISSION_ID` |
| `DEFAULT_ADMIN_ROLE` | `ROOT_PERMISSION_ID` |
| `AccessManager` + `restricted` | the DAO's permission DB + [`auth(permissionID)`](/common/auth.md) |
| `setTargetFunctionRole(target, sel, role)` | `grant(where, who, permissionId)`, named by capability rather than selector |
| execution delay / `schedule` | a [condition](/common/permission-conditions.md) reading `block.timestamp`, or a governance plugin that owns timing |
In OSx, a role is not held by an account globally; it applies to a `(where, who)` pair. The closest equivalent to `onlyRole` is `auth`, which looks identical at the call site but resolves in a contract the plugin doesn't own.
### Coming from Safe + Zodiac
| Safe / Zodiac | OSx |
|---|---|
| the Safe (avatar) | the [DAO](/core/dao.md) |
| owners + threshold | the [Multisig plugin](/plugins/multisig-plugin.md), a plugin rather than the root of authority |
| `enableModule` | install a [plugin](/framework/plugins.md) and grant it `EXECUTE_PERMISSION_ID` |
| `execTransactionFromModule` | [`dao.execute(...)`](/core/execution.md) |
| a Guard | a [condition](/common/permission-conditions.md) on the relevant permission |
| Roles Modifier scoping | a condition, often built with [`RuledCondition`](/common/ruled-condition.md) |
| Delay Modifier | a condition on time, or the [SPP plugin](/plugins/spp-plugin.md) |
A Safe module bypasses the owners entirely; an OSx plugin bypasses nothing, because it holds a permission subject to the same check as every other caller. And Safe's original Transaction Guard (1.3.0) covers only the owner `execTransaction` path, leaving module calls unguarded; Module Guards arrived only in Safe 1.5.0, as `setModuleGuard` and `checkModuleTransaction`. OSx has one path and one check, so there is no equivalent gap to keep in mind.
You don't have to choose, either. [`SafeOwnerCondition`](/helpers/condition-library/safe-owner-condition.md) grants a permission that can be used by a current owner of a given Safe, so the Safe stays the source of truth for membership while the DAO governs what that membership may do.
### Coming from Hats
| Hats | OSx |
|---|---|
| a hat | a `permissionId`: a capability rather than a token |
| wearing a hat | holding a grant on a `where` |
| admin hat | `ROOT_PERMISSION_ID` on that target |
| eligibility module | a [condition](/common/permission-conditions.md) |
| toggle module | a condition returning `false` |
| `isWearerOfHat` | `hasPermission(where, who, permissionId)` |
Both models make authority a first-class object with pluggable validity logic. They differ in two places:
- Hats is a shared singleton with a tree, so hierarchy is built in and a hat is portable across organizations, whereas OSx authority is per-DAO and flat, with no inherent hierarchy among permissions.
- Hats stops at "who holds the role" by design, while OSx is wired straight into execution. They compose more easily than they compete: a condition that checks `isWearerOfHat` bridges the two, the same way `SafeOwnerCondition` does for Safe.
## Where other options fit better
- **OSx is a framework, not a mixin.** `Ownable` is one line of inheritance. OSx asks you to deploy a DAO, install a plugin, and grant permissions. To protect a simple contract with one admin the overhead may not be worth it. Consider using `Ownable`.
- **Conditions are code.** A `RuledCondition` rule array is data, but a custom policy is a contract to be written. Guards and eligibility modules cost about the same. Hats and Zodiac ship more ready-made ones today.
- **Existing Safe assets and tooling.** Safe is home to many assets and tooling as of now. Bridging in with `SafeOwnerCondition` is often more sensible than migrating right away.
- **Rules about call arguments take more setting up.** Say you want "this role may call `transfer` on USDC, but only to the treasury, and only under 10,000". Zodiac's Roles Modifier takes that as configuration: you scope the target, the selector and each parameter, and you are done. In OSx, the same rule needs a ready-made [condition](/common/permission-conditions.md) either from the [condition library](/helpers/condition-library.md), or from `RuledCondition`. Otherwise it is a small contract that needs to be written.
## Keep in mind
- **Where authorization lives matters more than the syntax.** Rules inside a contract die with it; rules in a database the organization owns outlive every contract they govern.
- **A Safe module bypasses the owners; an OSx plugin bypasses nothing.** A plugin is authorized by a revocable permission, checked on every call.
- **ROOT is the permission of permissions, not a skeleton key.** It lets the holder rewrite the rules first. In a healthy DAO it only belongs to the DAO.
- **These systems compose more often than they compete.** Bridging an existing Safe or hat into an OSx permission through a condition usually beats migrating membership.
- **Pick the smallest thing that fits.** One contract with one admin wants `Ownable`. A group holding assets with no onchain policy wants a Safe. Organizations that need to outlive any single contract and be governed by evolving policies want OSx.
## See also
- [The permission system](/core/permissions.md) — the OSx model this page compares against.
- [Permission conditions](/common/permission-conditions.md) — the general form of dynamic authorization.
- [The plugin model](/framework/plugins.md) — why capability is modular rather than baked in.
- [SafeOwnerCondition](/helpers/condition-library/safe-owner-condition.md) — bridging an existing Safe into OSx permissions.
- [Why OSx](/guides/why-osx.md) — the short, code-free case.
# ABI reference
The **generated** lookup surface for the protocol's Solidity: every public function, event, error, enum, struct and constant of every contract, with its NatSpec, one page per declaration.
It is a navigation layer of its own, entered here rather than followed from the graph. The hand-written pages under [core](/core/index.md), [framework](/framework/index.md), [plugins](/plugins/index.md) and the rest explain what things *are* and *why*; these pages are where you check an exact signature. Link *into* them from a concept page whenever a reader will want the precise surface; never distil from them by hand.
Generated by `just abi` from the sibling repositories (see [Source repositories](/repositories.md)). **Do not edit these files** — the next run overwrites them.
## Repositories
- [admin-plugin](/abi/admin-plugin/index.md) — 4 entries
- [conditions](/abi/conditions/index.md) — 6 entries
- [lock-to-vote-plugin](/abi/lock-to-vote-plugin/index.md) — 17 entries
- [multisig-plugin](/abi/multisig-plugin/index.md) — 4 entries
- [osx](/abi/osx/index.md) — 65 entries
- [staged-proposal-processor-plugin](/abi/staged-proposal-processor-plugin/index.md) — 6 entries
- [token-voting-plugin](/abi/token-voting-plugin/index.md) — 10 entries
# admin-plugin — ABI reference
Generated from [`admin-plugin`](https://github.com/aragon/admin-plugin) at commit [`ef1727ab`](https://github.com/aragon/admin-plugin/commit/ef1727abafe42022373ef14e933653cdc9a10f05).
4 entries. Regenerate with `just abi`.
## Contracts
- [`Admin`](/abi/admin-plugin/Admin.md) — The admin governance plugin giving execution permission on the DAO to a single address.
- [`AdminSetup`](/abi/admin-plugin/AdminSetup.md) — The setup contract of the `Admin` plugin.
- [`AdminSetupZkSync`](/abi/admin-plugin/AdminSetupZkSync.md) — The setup contract of the `Admin` plugin.
- [`AdminZkSync`](/abi/admin-plugin/AdminZkSync.md) — The admin governance plugin giving execution permission on the DAO to a single address.
# Admin
**Contract** · [`packages/contracts/src/Admin.sol`](https://github.com/aragon/admin-plugin/blob/ef1727abafe42022373ef14e933653cdc9a10f05/packages/contracts/src/Admin.sol)
**Explained in:** [Admin Plugin](/plugins/admin-plugin.md)
**Author:** Aragon X - 2022-2024
**Inherits:** `IMembership`, `PluginCloneable`, `ProposalUpgradeable`
The admin governance plugin giving execution permission on the DAO to a single address.
> **Dev:** v1.2 (Release 1, Build 2)
**security-contact:** sirt@aragon.org
## Functions
### canExecute
```solidity
function canExecute(uint256) external view returns (bool)
```
Selector: `0xcc63604a`
Checks if a proposal can be executed.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | True if the proposal can be executed, false otherwise. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64,
uint64,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `[2]` | `uint64` | |
| `[3]` | `uint64` | |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI 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) external view
```
Selector: `0xfe0d94c1`
Executes a proposal.
> **Dev:** Note that this function will always revert since this contract doesn't store
> proposals and only executes the actions at run-time. This function is still
> necessary to allow compiling the contract as `Admin` inherits from `IProposal`.
### executeProposal
```solidity
function executeProposal(
bytes _metadata,
Action[] _actions,
uint256 _allowFailureMap
) external returns (uint256 proposalId)
```
Selector: `0x61af5ebe`
Creates and executes a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions to be executed. |
| `_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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### hasSucceeded
```solidity
function hasSucceeded(uint256) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns if proposal has been succeeded or not without including time window checks. |
### initialize
```solidity
function initialize(IDAO _dao, IPlugin.TargetConfig _targetConfig) external
```
Selector: `0x22105785`
Initializes the contract.
> **Dev:** This method is required to support [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The associated DAO. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#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 2. |
### 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.
| 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. |
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### MembersAdded
```solidity
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
```solidity
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
```solidity
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. |
### 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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
## Errors
### DaoUnauthorized
```solidity
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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
### FunctionNotSupported
```solidity
error FunctionNotSupported()
```
> **Dev:** Thrown if the `execute` function is called.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### 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 `executeProposal` function.
### SET_TARGET_CONFIG_PERMISSION_ID
_Inherited from `PluginCloneable`._
```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.
## Enums
### Operation
_Inherited from `IPlugin`._
```solidity
enum Operation {
Call,
DelegateCall
}
```
Specifies the type of operation to perform.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### 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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
# AdminSetup
**Contract** · [`packages/contracts/src/AdminSetup.sol`](https://github.com/aragon/admin-plugin/blob/ef1727abafe42022373ef14e933653cdc9a10f05/packages/contracts/src/AdminSetup.sol)
**Explained in:** [Admin Plugin](/plugins/admin-plugin.md)
**AdminAddressSetup**
**Author:** Aragon X - 2022-2024
**Inherits:** `PluginSetup`
The setup contract of the `Admin` plugin.
> **Dev:** v1.2 (Release 1, Build 2)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
The constructor setting the `Admin` implementation contract to clone from.
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external pure returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
> **Dev:** Currently, there is no reliable way to revoke the `ADMIN_EXECUTE_PERMISSION_ID` from all addresses
> it has been granted to. Accordingly, only the `EXECUTE_PERMISSION_ID` is revoked for this uninstallation.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes, IPluginSetup.PreparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Since the underlying plugin is non-upgradeable, this non-virtual function must always revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### AdminAddressInvalid
```solidity
error AdminAddressInvalid(address admin)
```
Thrown if the admin address is zero.
| Parameter | Type | Description |
| --- | --- | --- |
| `admin` | `address` | The admin address. |
### NonUpgradeablePlugin
```solidity
error NonUpgradeablePlugin()
```
Thrown when attempting to prepare an update on a non-upgradeable plugin.
## Constants
_Public, so each is also readable through a generated getter._
### 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 `executeProposal` function.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
# AdminSetupZkSync
**Contract** · [`packages/contracts/src/zkSync/AdminSetupZkSync.sol`](https://github.com/aragon/admin-plugin/blob/ef1727abafe42022373ef14e933653cdc9a10f05/packages/contracts/src/zkSync/AdminSetupZkSync.sol)
**AdminAddressSetup**
**Author:** Aragon X - 2022-2024
**Inherits:** `PluginSetup`
The setup contract of the `Admin` plugin.
> **Dev:** v1.2 (Release 1, Build 2)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
The constructor setting the `Admin` implementation contract to clone from.
> **Dev:** Since this is only ment to be used for zkSync we pass address(0) as implementation
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external pure returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
> **Dev:** Currently, there is no reliable way to revoke the `ADMIN_EXECUTE_PERMISSION_ID` from all addresses
> it has been granted to. Accordingly, only the `EXECUTE_PERMISSION_ID` is revoked for this uninstallation.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes, IPluginSetup.PreparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Since the underlying plugin is non-upgradeable, this non-virtual function must always revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### AdminAddressInvalid
```solidity
error AdminAddressInvalid(address admin)
```
Thrown if the admin address is zero.
| Parameter | Type | Description |
| --- | --- | --- |
| `admin` | `address` | The admin address. |
### NonUpgradeablePlugin
```solidity
error NonUpgradeablePlugin()
```
Thrown when attempting to prepare an update on a non-upgradeable plugin.
## Constants
_Public, so each is also readable through a generated getter._
### 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 `executeProposal` function.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
# AdminZkSync
**Contract** · [`packages/contracts/src/zkSync/AdminZkSync.sol`](https://github.com/aragon/admin-plugin/blob/ef1727abafe42022373ef14e933653cdc9a10f05/packages/contracts/src/zkSync/AdminZkSync.sol)
**Admin**
**Author:** Aragon X - 2022-2024
**Inherits:** `IMembership`, `Plugin`, `Proposal`
The admin governance plugin giving execution permission on the DAO to a single address.
> **Dev:** v1.2 (Release 1, Build 2)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(IDAO _dao, IPlugin.TargetConfig _targetConfig)
```
Initializes the contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The associated DAO. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#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 2. |
## Functions
### canExecute
```solidity
function canExecute(uint256) external view returns (bool)
```
Selector: `0xcc63604a`
Checks if a proposal can be executed.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | True if the proposal can be executed, false otherwise. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64,
uint64,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `[2]` | `uint64` | |
| `[3]` | `uint64` | |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI 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) external view
```
Selector: `0xfe0d94c1`
Executes a proposal.
> **Dev:** Note that this function will always revert since this contract doesn't store
> proposals and only executes the actions at run-time. This function is still
> necessary to allow compiling the contract as `Admin` inherits from `IProposal`.
### executeProposal
```solidity
function executeProposal(
bytes _metadata,
Action[] _actions,
uint256 _allowFailureMap
) external returns (uint256 proposalId)
```
Selector: `0x61af5ebe`
Creates and executes a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions to be executed. |
| `_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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### hasSucceeded
```solidity
function hasSucceeded(uint256) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns if proposal has been succeeded or not without including time window checks. |
### 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.
| 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. |
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### MembersAdded
```solidity
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
```solidity
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
```solidity
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. |
### 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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
## Errors
### DaoUnauthorized
```solidity
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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
### FunctionNotSupported
```solidity
error FunctionNotSupported()
```
> **Dev:** Thrown if the `execute` function is called.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### 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 `executeProposal` function.
### SET_TARGET_CONFIG_PERMISSION_ID
_Inherited from `Plugin`._
```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.
## Enums
### Operation
_Inherited from `IPlugin`._
```solidity
enum Operation {
Call,
DelegateCall
}
```
Specifies the type of operation to perform.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### 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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
# conditions — ABI reference
Generated from [`conditions`](https://github.com/aragon/conditions) at commit [`33918b06`](https://github.com/aragon/conditions/commit/33918b06b95233dd8890bef6cc60da6227fa5af1).
6 entries. Regenerate with `just abi`.
## Contracts
- [`ConditionFactory`](/abi/conditions/ConditionFactory.md) — A factory used to deploy new condition instances
- [`ExecuteSelectorCondition`](/abi/conditions/ExecuteSelectorCondition.md) — A permission that only allows a specified group of function selectors to be invoked within DAO.execute()
- [`SafeOwnerCondition`](/abi/conditions/SafeOwnerCondition.md) — A permission that only allows Safe owners to make use of a granted permission.
- [`SelectorCondition`](/abi/conditions/SelectorCondition.md) — A permission that only allows a specified group of function selectors to be invoked within DAO.execute()
## Interfaces
- [`IOwnerManager`](/abi/conditions/IOwnerManager.md) — Interface for managing Safe owners and a threshold to authorize transactions.
## Functions
- [`getSelector`](/abi/conditions/getSelector.md) — Extracts the selector given the calldata.
# ConditionFactory
**Contract** · [`src/factory/ConditionFactory.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/factory/ConditionFactory.sol)
**Explained in:** [Condition Library](/helpers/condition-library.md)
**Author:** AragonX 2025
A factory used to deploy new condition instances
## Functions
### deployExecuteSelectorCondition
```solidity
function deployExecuteSelectorCondition(
IDAO _dao,
ExecuteSelectorCondition.SelectorTarget[] _initialEntries
) external returns (ExecuteSelectorCondition newContract)
```
Selector: `0x5968851e`
| Returns | Type | Description |
| --- | --- | --- |
| `newContract` | [`ExecuteSelectorCondition`](/abi/conditions/ExecuteSelectorCondition.md) | |
### deploySafeOwnerCondition
```solidity
function deploySafeOwnerCondition(
address _safe
) external returns (SafeOwnerCondition newContract)
```
Selector: `0x1002e8ad`
| Returns | Type | Description |
| --- | --- | --- |
| `newContract` | [`SafeOwnerCondition`](/abi/conditions/SafeOwnerCondition.md) | |
### deploySelectorCondition
```solidity
function deploySelectorCondition(
IDAO _dao,
bytes4[] _initialSelectors
) external returns (SelectorCondition newContract)
```
Selector: `0xa907b318`
| Returns | Type | Description |
| --- | --- | --- |
| `newContract` | [`SelectorCondition`](/abi/conditions/SelectorCondition.md) | |
## Events
### ExecuteSelectorConditionDeployed
```solidity
event ExecuteSelectorConditionDeployed(ExecuteSelectorCondition newContract)
```
| Parameter | Type | Description |
| --- | --- | --- |
| `newContract` | [`ExecuteSelectorCondition`](/abi/conditions/ExecuteSelectorCondition.md) | |
### SafeOwnerConditionDeployed
```solidity
event SafeOwnerConditionDeployed(SafeOwnerCondition newContract)
```
| Parameter | Type | Description |
| --- | --- | --- |
| `newContract` | [`SafeOwnerCondition`](/abi/conditions/SafeOwnerCondition.md) | |
### SelectorConditionDeployed
```solidity
event SelectorConditionDeployed(SelectorCondition newContract)
```
| Parameter | Type | Description |
| --- | --- | --- |
| `newContract` | [`SelectorCondition`](/abi/conditions/SelectorCondition.md) | |
# ExecuteSelectorCondition
**Contract** · [`src/ExecuteSelectorCondition.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/ExecuteSelectorCondition.sol)
**Explained in:** [ExecuteSelectorCondition](/helpers/condition-library/execute-selector-condition.md)
**Author:** AragonX 2025
**Inherits:** `ERC165`, `IPermissionCondition`, `DaoAuthorizable`
A permission that only allows a specified group of function selectors to be invoked within DAO.execute()
## Constructor
### constructor
```solidity
constructor(IDAO _dao, ExecuteSelectorCondition.SelectorTarget[] _initialEntries)
```
Configures a new instance with the given set of allowed selectors
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The address of the DAO where the contract should read the permissions from |
| `_initialEntries` | [`ExecuteSelectorCondition.SelectorTarget[]`](#selectortarget) | The list of allowed selectors and the addresses where they can be invoked |
## Functions
### allowedNativeTransfers
```solidity
function allowedNativeTransfers(address) external view returns (bool)
```
Selector: `0x50093e83`
Stores whether native transfers are allowed to the given target address
### allowedSelectors
```solidity
function allowedSelectors(address, bytes4) external view returns (bool)
```
Selector: `0xbba013aa`
Stores whether the given address and selector are allowed
> **Dev:** allowedSelectors[where][selector]
### allowNativeTransfers
```solidity
function allowNativeTransfers(address _where) external
```
Selector: `0x5e593df6`
Allows actions with a non-zero `value` to pass for the given target address
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The target address |
### allowSelectors
```solidity
function allowSelectors(ExecuteSelectorCondition.SelectorTarget _newEntry) external
```
Selector: `0x32c9ea3e`
Marks the given selectors as allowed on the given where address
| Parameter | Type | Description |
| --- | --- | --- |
| `_newEntry` | [`ExecuteSelectorCondition.SelectorTarget`](#selectortarget) | The new selectors and the address where they can be invoked |
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### disallowNativeTransfers
```solidity
function disallowNativeTransfers(address _where) external
```
Selector: `0x4746831e`
Restricts actions with a non-zero `value` for the given target address
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The target address |
### disallowSelectors
```solidity
function disallowSelectors(ExecuteSelectorCondition.SelectorTarget _entry) external
```
Selector: `0x6cf0ca63`
Marks the given selector(s) as disallowed
| Parameter | Type | Description |
| --- | --- | --- |
| `_entry` | [`ExecuteSelectorCondition.SelectorTarget`](#selectortarget) | The selectors to remove and the address where they can no longer be invoked |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### NativeTransfersAllowed
```solidity
event NativeTransfersAllowed(address where)
```
Emitted when native transfers are allowed to the given address
### NativeTransfersDisallowed
```solidity
event NativeTransfersDisallowed(address where)
```
Emitted when native transfers are disallowed to the given address
### SelectorAllowed
```solidity
event SelectorAllowed(bytes4 selector, address where)
```
Emitted when a new selector is allowed.
### SelectorDisallowed
```solidity
event SelectorDisallowed(bytes4 selector, address where)
```
Emitted when a selector is disallowed.
## Errors
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### MANAGE_SELECTORS_PERMISSION_ID
```solidity
bytes32 public constant MANAGE_SELECTORS_PERMISSION_ID = keccak256("MANAGE_SELECTORS_PERMISSION");
```
Value: `0x485a22b473de7ee3091c71c5ce05019fd1466a1650b1228784a9bcd5b7bed510`
## Structs
### SelectorTarget
```solidity
struct SelectorTarget {
address where;
bytes4[] selectors;
}
```
Contains a list of selectors for the given target (where) address
# SafeOwnerCondition
**Contract** · [`src/SafeOwnerCondition.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/SafeOwnerCondition.sol)
**Explained in:** [SafeOwnerCondition](/helpers/condition-library/safe-owner-condition.md)
**Author:** AragonX 2025
**Inherits:** `ERC165`, `IPermissionCondition`
A permission that only allows Safe owners to make use of a granted permission.
## Constructor
### constructor
```solidity
constructor(IOwnerManager _safe)
```
| Parameter | Type | Description |
| --- | --- | --- |
| `_safe` | [`IOwnerManager`](/abi/conditions/IOwnerManager.md) | |
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the call is permitted. |
### safe
```solidity
function safe() external view returns (IOwnerManager)
```
Selector: `0x186f0354`
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IOwnerManager`](/abi/conditions/IOwnerManager.md) | |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### InvalidSafe
```solidity
error InvalidSafe(address invalidAddress)
```
Thrown when given address is not a compatible Safe.
| Parameter | Type | Description |
| --- | --- | --- |
| `invalidAddress` | `address` | The address received. |
# SelectorCondition
**Contract** · [`src/SelectorCondition.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/SelectorCondition.sol)
**Explained in:** [SelectorCondition](/helpers/condition-library/selector-condition.md)
**Author:** AragonX 2025
**Inherits:** `ERC165`, `IPermissionCondition`, `DaoAuthorizable`
A permission that only allows a specified group of function selectors to be invoked within DAO.execute()
## Constructor
### constructor
```solidity
constructor(IDAO _dao, bytes4[] _initialSelectors)
```
## Functions
### allowedSelectors
```solidity
function allowedSelectors(bytes4) external view returns (bool)
```
Selector: `0x85f168eb`
### allowSelector
```solidity
function allowSelector(bytes4 _selector) external
```
Selector: `0x932b3d68`
Marks the given selector as allowed
| Parameter | Type | Description |
| --- | --- | --- |
| `_selector` | `bytes4` | The function selector to start allowing |
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### disallowSelector
```solidity
function disallowSelector(bytes4 _selector) external
```
Selector: `0x1611ce60`
Marks the given selector as disallowed
| Parameter | Type | Description |
| --- | --- | --- |
| `_selector` | `bytes4` | The function selector to stop allowing |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### SelectorAllowed
```solidity
event SelectorAllowed(bytes4 selector)
```
### SelectorDisallowed
```solidity
event SelectorDisallowed(bytes4 selector)
```
## Errors
### AlreadyAllowed
```solidity
error AlreadyAllowed(bytes4 selector)
```
### AlreadyDisallowed
```solidity
error AlreadyDisallowed(bytes4 selector)
```
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### MANAGE_SELECTORS_PERMISSION_ID
```solidity
bytes32 public constant MANAGE_SELECTORS_PERMISSION_ID = keccak256("MANAGE_SELECTORS_PERMISSION");
```
Value: `0x485a22b473de7ee3091c71c5ce05019fd1466a1650b1228784a9bcd5b7bed510`
# IOwnerManager
**Interface** · [`src/interfaces/IOwnerManager.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/interfaces/IOwnerManager.sol)
**Explained in:** [SafeOwnerCondition](/helpers/condition-library/safe-owner-condition.md)
**Owner Manager Interface**
**Author:** @safe-global/safe-protocol
Interface for managing Safe owners and a threshold to authorize transactions.
## Functions
### addOwnerWithThreshold
```solidity
function addOwnerWithThreshold(address owner, uint256 _threshold) external
```
Selector: `0x0d582f13`
Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.
> **Dev:** This can only be done via a Safe transaction.
> ⚠️⚠️⚠️ A Safe can set itself as an owner which is a valid setup for EIP-7702 delegations.
> However, if address of the accounts is not an EOA and cannot sign for itself, you can
> potentially block access to the account completely. For example, if you have a `n/n`
> Safe (so `threshold == ownerCount`) and one of the owners is the Safe itself and not
> an EIP-7702 delegated account, then it will not be possible to produce a valid
> signature for the Safe. ⚠️⚠️⚠️
| Parameter | Type | Description |
| --- | --- | --- |
| `owner` | `address` | New owner address. |
| `_threshold` | `uint256` | New threshold. |
### changeThreshold
```solidity
function changeThreshold(uint256 _threshold) external
```
Selector: `0x694e80c3`
Changes the threshold of the Safe to `_threshold`.
> **Dev:** This can only be done via a Safe transaction.
| Parameter | Type | Description |
| --- | --- | --- |
| `_threshold` | `uint256` | New threshold. |
### getOwners
```solidity
function getOwners() external view returns (address[])
```
Selector: `0xa0e67e2b`
Returns a list of Safe owners.
### getThreshold
```solidity
function getThreshold() external view returns (uint256)
```
Selector: `0xe75235b8`
Returns the number of required confirmations for a Safe transaction aka the threshold.
### isOwner
```solidity
function isOwner(address owner) external view returns (bool)
```
Selector: `0x2f54bf6e`
Returns if `owner` is an owner of the Safe.
### removeOwner
```solidity
function removeOwner(address prevOwner, address owner, uint256 _threshold) external
```
Selector: `0xf8dc5dd9`
Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.
> **Dev:** This can only be done via a Safe transaction.
| Parameter | Type | Description |
| --- | --- | --- |
| `prevOwner` | `address` | Owner that pointed to the `owner` to be removed in the linked list. If the owner to be removed is the first (or only) element of the list, `prevOwner` MUST be set to the sentinel address `0x1` (referred to as `SENTINEL_OWNERS` in the implementation). |
| `owner` | `address` | Owner address to be removed. |
| `_threshold` | `uint256` | New threshold. |
### swapOwner
```solidity
function swapOwner(address prevOwner, address oldOwner, address newOwner) external
```
Selector: `0xe318b52b`
Replaces the owner `oldOwner` in the Safe with `newOwner`.
> **Dev:** This can only be done via a Safe transaction.
> ⚠️⚠️⚠️ A Safe can set itself as an owner which is a valid setup for EIP-7702 delegations.
> However, if address of the accounts is not an EOA and cannot sign for itself, you can
> potentially block access to the account completely. For example, if you have a `n/n`
> Safe (so `threshold == ownerCount`) and one of the owners is the Safe itself and not
> an EIP-7702 delegated account, then it will not be possible to produce a valid
> signature for the Safe. ⚠️⚠️⚠️
| Parameter | Type | Description |
| --- | --- | --- |
| `prevOwner` | `address` | Owner that pointed to the `oldOwner` to be replaced in the linked list. If the owner to be replaced is the first (or only) element of the list, `prevOwner` MUST be set to the sentinel address `0x1` (referred to as `SENTINEL_OWNERS` in the implementation). |
| `oldOwner` | `address` | Owner address to be replaced. |
| `newOwner` | `address` | New owner address. |
## Events
### AddedOwner
```solidity
event AddedOwner(address indexed owner)
```
An owner was added.
| Parameter | Type | Description |
| --- | --- | --- |
| `owner` | `address` | The address of the new owner. |
### ChangedThreshold
```solidity
event ChangedThreshold(uint256 threshold)
```
The signature threshold changed.
| Parameter | Type | Description |
| --- | --- | --- |
| `threshold` | `uint256` | The new threshold for authorizing Safe transactions. |
### RemovedOwner
```solidity
event RemovedOwner(address indexed owner)
```
An owner was removed.
| Parameter | Type | Description |
| --- | --- | --- |
| `owner` | `address` | The address of the old owner. |
# getSelector
**Function** · [`src/lib/common.sol`](https://github.com/aragon/conditions/blob/33918b06b95233dd8890bef6cc60da6227fa5af1/src/lib/common.sol)
**Explained in:** [Condition Library](/helpers/condition-library.md)
```solidity
function getSelector(bytes memory _data) pure returns (bytes4 selector)
```
Extracts the selector given the calldata. If no calldata is passed, it returns zero
# lock-to-vote-plugin — ABI reference
Generated from [`lock-to-vote-plugin`](https://github.com/aragon/lock-to-vote-plugin) at commit [`5a513e3d`](https://github.com/aragon/lock-to-vote-plugin/commit/5a513e3d9f1aad35d8926de87c408720e8d20a8d).
17 entries. Regenerate with `just abi`.
## Contracts
- [`LockManagerBase`](/abi/lock-to-vote-plugin/LockManagerBase.md) — Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
- [`LockManagerERC20`](/abi/lock-to-vote-plugin/LockManagerERC20.md) — Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
- [`LockToGovernBase`](/abi/lock-to-vote-plugin/LockToGovernBase.md) — LockToGovernBase
- [`LockToVotePlugin`](/abi/lock-to-vote-plugin/LockToVotePlugin.md)
- [`LockToVotePluginSetup`](/abi/lock-to-vote-plugin/LockToVotePluginSetup.md) — The setup contract of the `LockToVotePlugin` contract.
- [`MajorityVotingBase`](/abi/lock-to-vote-plugin/MajorityVotingBase.md) — The abstract implementation of majority voting plugins.
- [`MinVotingPowerCondition`](/abi/lock-to-vote-plugin/MinVotingPowerCondition.md) — Checks if an account's voting power or token balance meets the threshold defined on the given plugin.
- [`PluginUUPSUpgradeable`](/abi/lock-to-vote-plugin/PluginUUPSUpgradeable.md) — An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see…
## Interfaces
- [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) — Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
- [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) — ILockToGovernBase
- [`ILockToVote`](/abi/lock-to-vote-plugin/ILockToVote.md) — Governance plugin allowing token holders to use tokens locked without a snapshot requirement and engage in proposals immediately
- [`IMajorityVoting`](/abi/lock-to-vote-plugin/IMajorityVoting.md) — The interface of majority voting plugin.
## Structs
- [`LockManagerSettings`](/abi/lock-to-vote-plugin/LockManagerSettings.md) — The struct containing the LockManager helper settings.
## Enums
- [`PluginMode`](/abi/lock-to-vote-plugin/PluginMode.md) — Defines wether the accepted plugin types.
## Functions
- [`createProxyAndCall`](/abi/lock-to-vote-plugin/createProxyAndCall.md)
- [`createSaltedProxyAndCall`](/abi/lock-to-vote-plugin/createSaltedProxyAndCall.md)
- [`predictProxyAddress`](/abi/lock-to-vote-plugin/predictProxyAddress.md)
# LockManagerBase
**Abstract contract** · [`src/base/LockManagerBase.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/base/LockManagerBase.sol)
**Explained in:** [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)
**Author:** Aragon X 2025
**Inherits:** [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md)
Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
## Functions
### activeProposalsCreatedBy
```solidity
function activeProposalsCreatedBy(address _creator) external view returns (uint256 _result)
```
Selector: `0x2383ff1e`
Returns how many of the known proposalID's were created by the given address
| Parameter | Type | Description |
| --- | --- | --- |
| `_creator` | `address` | The address to use for filtering |
### 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 be because the proposal - has not started, - has ended, - was executed, or - the voter doesn't have any tokens locked.
> **Dev:** The function assumes that the queried proposal exists.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the account is allowed to vote. |
### getLockedBalance
```solidity
function getLockedBalance(address _account) external view returns (uint256)
```
Selector: `0xc4086893`
Returns the currently locked balance that the given account has on the contract.
### knownProposalIdAt
```solidity
function knownProposalIdAt(uint256 _index) external view returns (uint256)
```
Selector: `0xc110d7b4`
Returns the known proposalID at the given index
| Parameter | Type | Description |
| --- | --- | --- |
| `_index` | `uint256` | The position at which to read the proposalId |
### knownProposalIdCreators
```solidity
function knownProposalIdCreators(uint256) external view returns (address)
```
Selector: `0x81ebbcb0`
Keeps track of who created each known proposalId
### knownProposalIdsLength
```solidity
function knownProposalIdsLength() external view returns (uint256)
```
Selector: `0x4a5b3860`
Returns the number of known proposalID's
### lock()
```solidity
function lock() external
```
Selector: `0xf83d08ba`
Locks the balance currently allowed by msg.sender on this contract NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest. They can only be unlocked when all active proposals with votes have ended.
### lock(uint256)
```solidity
function lock(uint256 _amount) external
```
Selector: `0xdd467064`
Locks the given amount from msg.sender on this contract NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest. They can only be unlocked when all active proposals with votes have ended.
### lockAndVote(uint256,uint8,uint256)
```solidity
function lockAndVote(
uint256 _proposalId,
IMajorityVoting.VoteOption _voteOption,
uint256 _amount
) external
```
Selector: `0x1adb4f63`
Locks the given amount from msg.sender on this contract and registers the given vote on the target plugin
### lockAndVote(uint256,uint8)
```solidity
function lockAndVote(uint256 _proposalId, IMajorityVoting.VoteOption _voteOption) external
```
Selector: `0x98f7aab1`
Locks the balance currently allowed by msg.sender on this contract and registers the given vote on the target plugin
### plugin
```solidity
function plugin() external view returns (ILockToGovernBase)
```
Selector: `0xef01df4f`
The address of the lock to vote plugin to use
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | |
### proposalCreated
```solidity
function proposalCreated(uint256 _proposalId, address _creator) external
```
Selector: `0x6c393965`
Called by the lock to vote plugin whenever a proposal is created. It instructs the manager to start tracking the given proposal.
### proposalSettled
```solidity
function proposalSettled(uint256 _proposalId) external
```
Selector: `0x6689ef0f`
Called by the lock to vote plugin whenever a proposal is executed (or settled). It instructs the manager to remove the proposal from the list of active proposal locks. There's no guarantee that `proposalSettled()` will be reliably called for a proposal ID. Manually checking a proposal's state may be necessary in order to verify that it has ended.
### pruneProposals
```solidity
function pruneProposals(uint256 _count) external
```
Selector: `0xbfadf8f7`
Triggers a manual cleanup of the known proposal ID's that have already ended. Settled proposals are garbage collected when they are executed or when a user unlocks his tokens. Use this method if a long list of unsettled yet ended proposals ever creates a gas bottleneck that discourages users from unlocking.
### setPluginAddress
```solidity
function setPluginAddress(ILockToGovernBase _newPluginAddress) external
```
Selector: `0x587a6b40`
Defines the given plugin address as the target for voting.
| Parameter | Type | Description |
| --- | --- | --- |
| `_newPluginAddress` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | |
### settings
```solidity
function settings() external view returns (PluginMode pluginMode)
```
Selector: `0xe06174e4`
The current LockManager settings
| Returns | Type | Description |
| --- | --- | --- |
| `pluginMode` | [`PluginMode`](/abi/lock-to-vote-plugin/PluginMode.md) | |
### token
```solidity
function token() external view returns (address)
```
Selector: `0xfc0c546a`
Returns the address of the token contract used to determine the voting power.
### unlock
```solidity
function unlock() external
```
Selector: `0xa69df4b5`
If the governance plugin allows it, releases all active locks placed on active proposals and transfers msg.sender's locked balance back. Depending on the current mode, it withdraws only if no locks are being used in active proposals.
### vote
```solidity
function vote(uint256 _proposalId, IMajorityVoting.VoteOption _voteOption) external
```
Selector: `0x943e8216`
Uses the locked balance to vote on the given proposal for the registered plugin
## Events
### BalanceLocked
```solidity
event BalanceLocked(address indexed voter, uint256 amount)
```
Emitted when a token holder locks funds into the LockManager contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `voter` | `address` | The address of the account locking tokens. |
| `amount` | `uint256` | The amount of tokens being added to the existing balance. |
### BalanceUnlocked
```solidity
event BalanceUnlocked(address indexed voter, uint256 amount)
```
Emitted when a token holder unlocks funds from the manager contract
| Parameter | Type | Description |
| --- | --- | --- |
| `voter` | `address` | The address of the account unlocking tokens. |
| `amount` | `uint256` | The amount of tokens being unlocked. |
### ProposalSettled
```solidity
event ProposalSettled(uint256 indexed proposalId)
```
Emitted when the plugin reports a proposal as settled
> **Dev:** The event could be emitted with a delay, compared to the effective proposal endDate
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID the proposal where votes can no longer be submitted or cleared |
## Errors
### InvalidPlugin
```solidity
error InvalidPlugin()
```
Thrown when trying to set an invalid contract as the plugin
### InvalidPluginAddress
```solidity
error InvalidPluginAddress()
```
Thrown when the address calling proposalSettled() is not the plugin's
### LocksStillActive
```solidity
error LocksStillActive()
```
Raised when attempting to unlock while active votes are cast in strict mode
### NoBalance
```solidity
error NoBalance()
```
Raised when the caller holds no tokens or didn't lock any tokens
### ProposalCreatedStillActive
```solidity
error ProposalCreatedStillActive(uint256 proposalId)
```
Thrown when attempting to unlock with a created proposal that is still active
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID the active proposal |
### SetPluginAddressForbidden
```solidity
error SetPluginAddressForbidden()
```
Thrown when trying to define the address of the plugin after it already was
# LockManagerERC20
**Contract** · [`src/LockManagerERC20.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/LockManagerERC20.sol)
**Explained in:** [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)
**Author:** Aragon X 2025
**Inherits:** [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md), [`LockManagerBase`](/abi/lock-to-vote-plugin/LockManagerBase.md)
Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
## Constructor
### constructor
```solidity
constructor(IERC20 _token)
```
| Parameter | Type | Description |
| --- | --- | --- |
| `_token` | `IERC20` | The address of the token contract that users can lock |
## Functions
### activeProposalsCreatedBy
```solidity
function activeProposalsCreatedBy(address _creator) external view returns (uint256 _result)
```
Selector: `0x2383ff1e`
Returns how many of the known proposalID's were created by the given address
| Parameter | Type | Description |
| --- | --- | --- |
| `_creator` | `address` | The address to use for filtering |
### 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 be because the proposal - has not started, - has ended, - was executed, or - the voter doesn't have any tokens locked.
> **Dev:** The function assumes that the queried proposal exists.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the account is allowed to vote. |
### getLockedBalance
```solidity
function getLockedBalance(address _account) external view returns (uint256)
```
Selector: `0xc4086893`
Returns the currently locked balance that the given account has on the contract.
### knownProposalIdAt
```solidity
function knownProposalIdAt(uint256 _index) external view returns (uint256)
```
Selector: `0xc110d7b4`
Returns the known proposalID at the given index
| Parameter | Type | Description |
| --- | --- | --- |
| `_index` | `uint256` | The position at which to read the proposalId |
### knownProposalIdCreators
```solidity
function knownProposalIdCreators(uint256) external view returns (address)
```
Selector: `0x81ebbcb0`
Keeps track of who created each known proposalId
### knownProposalIdsLength
```solidity
function knownProposalIdsLength() external view returns (uint256)
```
Selector: `0x4a5b3860`
Returns the number of known proposalID's
### lock()
```solidity
function lock() external
```
Selector: `0xf83d08ba`
Locks the balance currently allowed by msg.sender on this contract NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest. They can only be unlocked when all active proposals with votes have ended.
### lock(uint256)
```solidity
function lock(uint256 _amount) external
```
Selector: `0xdd467064`
Locks the given amount from msg.sender on this contract NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest. They can only be unlocked when all active proposals with votes have ended.
### lockAndVote(uint256,uint8,uint256)
```solidity
function lockAndVote(
uint256 _proposalId,
IMajorityVoting.VoteOption _voteOption,
uint256 _amount
) external
```
Selector: `0x1adb4f63`
Locks the given amount from msg.sender on this contract and registers the given vote on the target plugin
### lockAndVote(uint256,uint8)
```solidity
function lockAndVote(uint256 _proposalId, IMajorityVoting.VoteOption _voteOption) external
```
Selector: `0x98f7aab1`
Locks the balance currently allowed by msg.sender on this contract and registers the given vote on the target plugin
### plugin
```solidity
function plugin() external view returns (ILockToGovernBase)
```
Selector: `0xef01df4f`
The address of the lock to vote plugin to use
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | |
### proposalCreated
```solidity
function proposalCreated(uint256 _proposalId, address _creator) external
```
Selector: `0x6c393965`
Called by the lock to vote plugin whenever a proposal is created. It instructs the manager to start tracking the given proposal.
### proposalSettled
```solidity
function proposalSettled(uint256 _proposalId) external
```
Selector: `0x6689ef0f`
Called by the lock to vote plugin whenever a proposal is executed (or settled). It instructs the manager to remove the proposal from the list of active proposal locks. There's no guarantee that `proposalSettled()` will be reliably called for a proposal ID. Manually checking a proposal's state may be necessary in order to verify that it has ended.
### pruneProposals
```solidity
function pruneProposals(uint256 _count) external
```
Selector: `0xbfadf8f7`
Triggers a manual cleanup of the known proposal ID's that have already ended. Settled proposals are garbage collected when they are executed or when a user unlocks his tokens. Use this method if a long list of unsettled yet ended proposals ever creates a gas bottleneck that discourages users from unlocking.
### setPluginAddress
```solidity
function setPluginAddress(ILockToGovernBase _newPluginAddress) external
```
Selector: `0x587a6b40`
Defines the given plugin address as the target for voting.
| Parameter | Type | Description |
| --- | --- | --- |
| `_newPluginAddress` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | |
### settings
```solidity
function settings() external view returns (PluginMode pluginMode)
```
Selector: `0xe06174e4`
The current LockManager settings
| Returns | Type | Description |
| --- | --- | --- |
| `pluginMode` | [`PluginMode`](/abi/lock-to-vote-plugin/PluginMode.md) | |
### token
```solidity
function token() external view returns (address _token)
```
Selector: `0xfc0c546a`
Returns the address of the token contract used to determine the voting power.
> **Dev:** Not having `token` as a public variable because the return types would differ (address vs IERC20)
| Returns | Type | Description |
| --- | --- | --- |
| `_token` | `address` | The token used for voting. |
### unlock
```solidity
function unlock() external
```
Selector: `0xa69df4b5`
If the governance plugin allows it, releases all active locks placed on active proposals and transfers msg.sender's locked balance back. Depending on the current mode, it withdraws only if no locks are being used in active proposals.
### vote
```solidity
function vote(uint256 _proposalId, IMajorityVoting.VoteOption _voteOption) external
```
Selector: `0x943e8216`
Uses the locked balance to vote on the given proposal for the registered plugin
## Events
### BalanceLocked
```solidity
event BalanceLocked(address indexed voter, uint256 amount)
```
Emitted when a token holder locks funds into the LockManager contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `voter` | `address` | The address of the account locking tokens. |
| `amount` | `uint256` | The amount of tokens being added to the existing balance. |
### BalanceUnlocked
```solidity
event BalanceUnlocked(address indexed voter, uint256 amount)
```
Emitted when a token holder unlocks funds from the manager contract
| Parameter | Type | Description |
| --- | --- | --- |
| `voter` | `address` | The address of the account unlocking tokens. |
| `amount` | `uint256` | The amount of tokens being unlocked. |
### ProposalSettled
```solidity
event ProposalSettled(uint256 indexed proposalId)
```
Emitted when the plugin reports a proposal as settled
> **Dev:** The event could be emitted with a delay, compared to the effective proposal endDate
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID the proposal where votes can no longer be submitted or cleared |
## Errors
### InvalidPlugin
```solidity
error InvalidPlugin()
```
Thrown when trying to set an invalid contract as the plugin
### InvalidPluginAddress
```solidity
error InvalidPluginAddress()
```
Thrown when the address calling proposalSettled() is not the plugin's
### LocksStillActive
```solidity
error LocksStillActive()
```
Raised when attempting to unlock while active votes are cast in strict mode
### NoBalance
```solidity
error NoBalance()
```
Raised when the caller holds no tokens or didn't lock any tokens
### ProposalCreatedStillActive
```solidity
error ProposalCreatedStillActive(uint256 proposalId)
```
Thrown when attempting to unlock with a created proposal that is still active
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID the active proposal |
### SetPluginAddressForbidden
```solidity
error SetPluginAddressForbidden()
```
Thrown when trying to define the address of the plugin after it already was
# LockToGovernBase
**Abstract contract** · [`src/base/LockToGovernBase.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/base/LockToGovernBase.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X 2024-2025
**Inherits:** [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md), `IMembership`, `ERC165Upgradeable`
## Functions
### 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.
| 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. |
### isProposalEnded
```solidity
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. |
### isProposalOpen
```solidity
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. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | The address of the LockManager contract associated with the plugin. |
### 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.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### token
```solidity
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. |
### usedVotingPower
```solidity
function usedVotingPower(uint256 proposalId, address voter) external view returns (uint256)
```
Selector: `0xeff759a8`
Returns whether the account has voted for the proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The account address to be checked. |
## Events
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `lockManager` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | The address of the LockManager contract |
### MembersAdded
```solidity
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
```solidity
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
```solidity
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. |
## Errors
### LockManagerAlreadyDefined
```solidity
error LockManagerAlreadyDefined()
```
Thrown when attempting to define the address of the LockManager after it was already set.
### NoVotingPower
```solidity
error NoVotingPower()
```
Thrown when creating a proposal without any locked tokens.
# LockToVotePlugin
**Contract** · [`src/LockToVotePlugin.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/LockToVotePlugin.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Inherits:** [`ILockToVote`](/abi/lock-to-vote-plugin/ILockToVote.md), [`MajorityVotingBase`](/abi/lock-to-vote-plugin/MajorityVotingBase.md), [`LockToGovernBase`](/abi/lock-to-vote-plugin/LockToGovernBase.md)
## 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.
| 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
```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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | |
| `_voter` | `address` | |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns 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.
| 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
```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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| 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`](#proposalparameters) | The parameters of the proposal. |
| `tally` | [`MajorityVotingBase.Tally`](#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`](#targetconfig) | Execution 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voter` | `address` | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteEntry`](#voteentry) | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingSettings`](#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.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) 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](https://eips.ethereum.org/EIPS/eip-1822).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The IDAO interface of the associated DAO. |
| `_lockManager` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The voting settings. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#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
```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.
| 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
```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.
| 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
```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.
| 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
```solidity
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
```solidity
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
```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.
| 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
```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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | |
### minApprovalRatio
```solidity
function minApprovalRatio() external view returns (uint256)
```
Selector: `0x0e04be90`
Returns the configured minimum approval ratio.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The minimal approval ratio. |
### minParticipationRatio
```solidity
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
```solidity
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
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportThresholdRatio
```solidity
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
```solidity
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
```solidity
function updateVotingSettings(MajorityVotingBase.VotingSettings _votingSettings) external
```
Selector: `0x3f8b32d9`
Updates the voting settings.
> **Dev:** Requires the `UPDATE_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | |
| `_voter` | `address` | |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | |
| `_newVotingPower` | `uint256` | |
### votingMode
```solidity
function votingMode() external view returns (MajorityVotingBase.VotingMode)
```
Selector: `0x23d07188`
Returns the vote mode stored in the voting settings.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingMode`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `lockManager` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | The address of the LockManager contract |
### MembersAdded
```solidity
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
```solidity
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
```solidity
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
```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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The voter casting the vote. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
### VoteCleared
```solidity
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
```solidity
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`](#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
```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.
| 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
```solidity
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
```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
| Parameter | Type | Description |
| --- | --- | --- |
| `actionIdx` | `uint256` | The index of the action |
| `target` | `address` | The 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`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### ProposalCreationForbidden
```solidity
error ProposalCreationForbidden(address sender)
```
Thrown when a sender is not allowed to create a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The 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).
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint64` | The limit value. |
| `actual` | `uint64` | The actual value. |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### RatioOutOfBounds
```solidity
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
```solidity
error VoteCallForbidden(address caller)
```
Thrown when the address calling vote() is not the LockManager.
| Parameter | Type | Description |
| --- | --- | --- |
| `caller` | `address` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `account` | `address` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The address of the voter. |
### VoteRemovalUnauthorized
```solidity
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
```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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
### VoteOption
_Inherited from `IMajorityVoting`._
```solidity
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`._
```solidity
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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `parameters` | [`MajorityVotingBase.ProposalParameters`](#proposalparameters) | The proposal parameters at the time of the proposal creation. |
| `tally` | [`MajorityVotingBase.Tally`](#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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `targetConfig` | [`IPlugin.TargetConfig`](#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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#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`._
```solidity
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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The 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
| Field | Type | Description |
| --- | --- | --- |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | 1 -> abstain, 2 -> yes, 3 -> no |
| `votingPower` | `uint256` | How 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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#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. |
# LockToVotePluginSetup
**Contract** · [`src/setup/LockToVotePluginSetup.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/setup/LockToVotePluginSetup.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X - 2022-2025
**Inherits:** `PluginSetup`
The setup contract of the `LockToVotePlugin` contract.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
The contract constructor deploying the implementation contracts to use.
## Functions
### decodeInstallationParams
```solidity
function decodeInstallationParams(
bytes _data
) external pure returns (LockToVotePluginSetup.InstallationParameters installationParams)
```
Selector: `0x64e074a5`
Decodes the given byte array into the original installation parameters
| Returns | Type | Description |
| --- | --- | --- |
| `installationParams` | [`LockToVotePluginSetup.InstallationParameters`](#installationparameters) | |
### encodeInstallationParams
```solidity
function encodeInstallationParams(
LockToVotePluginSetup.InstallationParameters installationParams
) external pure returns (bytes)
```
Selector: `0xc65ba11e`
Encodes the given installation parameters into a byte array
| Parameter | Type | Description |
| --- | --- | --- |
| `installationParams` | [`LockToVotePluginSetup.InstallationParameters`](#installationparameters) | |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _installParameters
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_installParameters` | `bytes` | |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external view returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes, IPluginSetup.PreparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Since the underlying plugin is non-upgradeable, this non-virtual function must always revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### NonUpgradeablePlugin
```solidity
error NonUpgradeablePlugin()
```
Thrown when attempting to prepare an update on a non-upgradeable plugin.
### TokenNotContract
```solidity
error TokenNotContract(address token)
```
Thrown if token address is passed which is not a token.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
### TokenNotERC20
```solidity
error TokenNotERC20(address token)
```
Thrown if token address is not ERC20.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
### WrongHelpersArrayLength
```solidity
error WrongHelpersArrayLength(uint256 length)
```
Thrown if passed helpers array is of wrong length.
| Parameter | Type | Description |
| --- | --- | --- |
| `length` | `uint256` | The array length of passed helpers. |
## Structs
### InstallationParameters
```solidity
struct InstallationParameters {
IERC20 token;
MajorityVotingBase.VotingSettings votingSettings;
bytes pluginMetadata;
address createProposalCaller;
address executeCaller;
IPlugin.TargetConfig targetConfig;
}
```
Struct containing all the parameters to set up the plugin, helpers and permissions
| Field | Type | Description |
| --- | --- | --- |
| `token` | `IERC20` | The address of the token that users can lock for voting (staking token in most cases) |
| `votingSettings` | `MajorityVotingBase.VotingSettings` | The voting plugin settings |
| `pluginMetadata` | `bytes` | An IPFS URI pointing to a pinned JSON file with the plugin's details |
| `createProposalCaller` | `address` | The address that can call createProposal (can be ANY_ADDR) |
| `executeCaller` | `address` | The address that can call execute (can be ANY_ADDR) |
| `targetConfig` | `IPlugin.TargetConfig` | Where and how the plugin will execute actions |
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
# MajorityVotingBase
**Abstract contract** · [`src/base/MajorityVotingBase.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/base/MajorityVotingBase.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X - 2022-2025
**Inherits:** [`IMajorityVoting`](/abi/lock-to-vote-plugin/IMajorityVoting.md), `Initializable`, `ERC165Upgradeable`, `MetadataExtensionUpgradeable`, [`PluginUUPSUpgradeable`](/abi/lock-to-vote-plugin/PluginUUPSUpgradeable.md), `ProposalUpgradeable`
The abstract implementation of majority voting plugins.
#### Parameterization
We define 3 parameters:
$$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes} + N_\text{no}} \in [0,1]$$
$$\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.
and
$$\texttt{approval} = \frac{N_\text{yes}}{N_\text{total}} \in [0,1]$$
##### Limit Values: Support Threshold & Minimum Participation
Two limit values are associated with these parameters and decide if a proposal execution should be possible:
$\texttt{supportThresholdRatio} \in [0,1)$ and $\texttt{minParticipationRatio} \in [0,1]$.
For threshold values, $>$ comparison is used. This **does not** include the threshold value.
E.g., for $\texttt{supportThresholdRatio} = 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{minParticipationRatio} = 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{supportThresholdRatio} \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{supportThresholdRatio}) \cdot N_\text{yes} > \texttt{supportThresholdRatio} \cdot N_\text{no}.$$
Note, that the inequality yields the simple majority voting condition for $\texttt{supportThresholdRatio}=\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{minParticipationRatio} \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.
> **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.
| 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. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| 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`](#proposalparameters) | The parameters of the proposal. |
| `tally` | [`MajorityVotingBase.Tally`](#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`](#targetconfig) | Execution 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voter` | `address` | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteEntry`](#voteentry) | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingSettings`](#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.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### 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.
| 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
```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.
| 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. |
### 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.
| 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. |
### minApprovalRatio
```solidity
function minApprovalRatio() external view returns (uint256)
```
Selector: `0x0e04be90`
Returns the configured minimum approval ratio.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The minimal approval ratio. |
### minParticipationRatio
```solidity
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
```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
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportThresholdRatio
```solidity
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. |
### updateVotingSettings
```solidity
function updateVotingSettings(MajorityVotingBase.VotingSettings _votingSettings) external
```
Selector: `0x3f8b32d9`
Updates the voting settings.
> **Dev:** Requires the `UPDATE_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The 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
### votingMode
```solidity
function votingMode() external view returns (MajorityVotingBase.VotingMode)
```
Selector: `0x23d07188`
Returns the vote mode stored in the voting settings.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingMode`](#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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The voter casting the vote. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
### VotingSettingsUpdated
```solidity
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`](#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
```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.
| 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
```solidity
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
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### EmptyDAOAddress
```solidity
error EmptyDAOAddress()
```
Thrown when the given DAO address is empty.
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
### NonexistentProposal
```solidity
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. |
### ProposalAlreadyExists
```solidity
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
```solidity
error ProposalCreationForbidden(address sender)
```
Thrown when a sender is not allowed to create a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The 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).
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint64` | The limit value. |
| `actual` | `uint64` | The actual value. |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### RatioOutOfBounds
```solidity
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
```solidity
error VoteCallForbidden(address caller)
```
Thrown when the address calling vote() is not the LockManager.
| Parameter | Type | Description |
| --- | --- | --- |
| `caller` | `address` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `account` | `address` | The address of the _account. |
## Constants
_Public, so each is also readable through a generated getter._
### 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_SETTINGS_PERMISSION_ID
```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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
### VoteOption
_Inherited from `IMajorityVoting`._
```solidity
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
```solidity
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`._
```solidity
struct MetadataExtensionStorage {
bytes metadata;
}
```
### Proposal
```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.
| Field | Type | Description |
| --- | --- | --- |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `parameters` | [`MajorityVotingBase.ProposalParameters`](#proposalparameters) | The proposal parameters at the time of the proposal creation. |
| `tally` | [`MajorityVotingBase.Tally`](#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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `targetConfig` | [`IPlugin.TargetConfig`](#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
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#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
```solidity
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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The 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
| Field | Type | Description |
| --- | --- | --- |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | 1 -> abstain, 2 -> yes, 3 -> no |
| `votingPower` | `uint256` | How many tokens the account has allocated to `voteOption` |
### VotingSettings
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#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. |
# MinVotingPowerCondition
**Contract** · [`src/conditions/MinVotingPowerCondition.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/conditions/MinVotingPowerCondition.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X - 2024
**Inherits:** `PermissionCondition`
Checks if an account's voting power or token balance meets the threshold defined on the given plugin.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(ILockToGovernBase _plugin)
```
Initializes the contract with the `ILockToGovernBase` plugin address and caches the associated token.
| Parameter | Type | Description |
| --- | --- | --- |
| `_plugin` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | The address of the `ILockToGovernBase` plugin. |
## Functions
### getRequiredLockAmount
```solidity
function getRequiredLockAmount(address _who) external view returns (uint256)
```
Selector: `0x0e14d0d6`
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
> **Dev:** The function checks both the voting power and token balance to ensure `_who` meets the minimum voting
> threshold defined in the `TokenVoting` plugin. Returns `false` if the minimum requirement is unmet.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Constants
_Public, so each is also readable through a generated getter._
### lockManager
```solidity
ILockManager public immutable lockManager;
```
The address of the LockManager used by the plugin.
### plugin
```solidity
ILockToGovernBase public immutable plugin;
```
The address of the `ILockToGovernBase` plugin used to fetch the settings from.
### token
```solidity
IERC20 public immutable token;
```
The `IERC20` token interface used to check token balance.
# PluginUUPSUpgradeable
**Abstract contract** · [`src/lib/PluginUUPSUpgradeable.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/lib/PluginUUPSUpgradeable.sol)
**Author:** Aragon X - 2022-2024
**Inherits:** `IPlugin`, `ERC165Upgradeable`, `UUPSUpgradeable`, `DaoAuthorizableUpgradeable`, `ProtocolVersion`
An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#plugintype) | |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target Config containing the address and operation type. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### 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
## 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.
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## 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.
| 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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_TARGET_CONFIG_PERMISSION_ID
```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.
### UPGRADE_PLUGIN_PERMISSION_ID
```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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### 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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
# ILockManager
**Interface** · [`src/interfaces/ILockManager.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/ILockManager.sol)
**Explained in:** [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)
**Author:** Aragon X 2025
Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
## Functions
### activeProposalsCreatedBy
```solidity
function activeProposalsCreatedBy(address _creator) external view returns (uint256 _result)
```
Selector: `0x2383ff1e`
Returns how many active proposalID's were created by the given address
| Parameter | Type | Description |
| --- | --- | --- |
| `_creator` | `address` | The address to use for filtering |
### 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 be because the proposal
- has not started,
- has ended,
- was executed, or
- the voter doesn't have any tokens locked.
> **Dev:** The function assumes that the queried proposal exists.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal Id. |
| `voter` | `address` | The account address to be checked. |
| `voteOption` | `IMajorityVoting.VoteOption` | The value of the new vote to register. |
### getLockedBalance
```solidity
function getLockedBalance(address account) external view returns (uint256)
```
Selector: `0xc4086893`
Returns the currently locked balance that the given account has on the contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `account` | `address` | The address whose locked balance is returned. |
### lock()
```solidity
function lock() external
```
Selector: `0xf83d08ba`
Locks the balance currently allowed by msg.sender on this contract
NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest.
They can only be unlocked when all active proposals with votes have ended.
### lock(uint256)
```solidity
function lock(uint256 amount) external
```
Selector: `0xdd467064`
Locks the given amount from msg.sender on this contract
NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest.
They can only be unlocked when all active proposals with votes have ended.
| Parameter | Type | Description |
| --- | --- | --- |
| `amount` | `uint256` | How many tokens the contract should lock |
### lockAndVote(uint256,uint8,uint256)
```solidity
function lockAndVote(
uint256 proposalId,
IMajorityVoting.VoteOption vote,
uint256 amount
) external
```
Selector: `0x1adb4f63`
Locks the given amount from msg.sender on this contract and registers the given vote on the target plugin
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal where the vote will be registered |
| `vote` | `IMajorityVoting.VoteOption` | The vote to cast (Yes, No, Abstain) |
| `amount` | `uint256` | How many tokens the contract should lock and use for voting |
### lockAndVote(uint256,uint8)
```solidity
function lockAndVote(uint256 proposalId, IMajorityVoting.VoteOption vote) external
```
Selector: `0x98f7aab1`
Locks the balance currently allowed by msg.sender on this contract and registers the given vote on the target plugin
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal where the vote will be registered |
| `vote` | `IMajorityVoting.VoteOption` | The vote to cast (Yes, No, Abstain) |
### plugin
```solidity
function plugin() external view returns (ILockToGovernBase)
```
Selector: `0xef01df4f`
Returns the address of the voting plugin.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | |
### proposalCreated
```solidity
function proposalCreated(uint256 proposalId, address creator) external
```
Selector: `0x6c393965`
Called by the lock to vote plugin whenever a proposal is created. It instructs the manager to start tracking the given proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal that msg.sender is reporting as created. |
| `creator` | `address` | The address creating the proposal. |
### proposalSettled
```solidity
function proposalSettled(uint256 proposalId) external
```
Selector: `0x6689ef0f`
Called by the lock to vote plugin whenever a proposal is executed (or settled).
It instructs the manager to remove the proposal from the list of active proposal locks.
There's no guarantee that `proposalSettled()` will be reliably called for a proposal ID.
Manually checking a proposal's state may be necessary in order to verify that it has ended.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal that msg.sender is reporting as done. |
### pruneProposals
```solidity
function pruneProposals(uint256 count) external
```
Selector: `0xbfadf8f7`
Triggers a manual cleanup of the known proposal ID's that have already ended.
Settled proposals are garbage collected when they are executed or when a user unlocks his tokens.
Use this method if a long list of unsettled yet ended proposals ever creates a gas bottleneck that discourages users from unlocking.
| Parameter | Type | Description |
| --- | --- | --- |
| `count` | `uint256` | How many proposals should be cleaned up, at most. |
### setPluginAddress
```solidity
function setPluginAddress(ILockToGovernBase plugin) external
```
Selector: `0x587a6b40`
Defines the given plugin address as the target for voting.
| Parameter | Type | Description |
| --- | --- | --- |
| `plugin` | [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md) | The address of the contract to use as the plugin. |
### settings
```solidity
function settings() external view returns (PluginMode pluginMode)
```
Selector: `0xe06174e4`
Returns the current settings of the LockManager.
| Returns | Type | Description |
| --- | --- | --- |
| `pluginMode` | [`PluginMode`](/abi/lock-to-vote-plugin/PluginMode.md) | The plugin mode (currently, voting only) |
### token
```solidity
function token() external view returns (address)
```
Selector: `0xfc0c546a`
Returns the address of the token contract used to determine the voting power.
### unlock
```solidity
function unlock() external
```
Selector: `0xa69df4b5`
If the governance plugin allows it, releases all active locks placed on active proposals and transfers msg.sender's locked balance back. Depending on the current mode, it withdraws only if no locks are being used in active proposals.
### vote
```solidity
function vote(uint256 proposalId, IMajorityVoting.VoteOption vote) external
```
Selector: `0x943e8216`
Uses the locked balance to vote on the given proposal for the registered plugin
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal where the vote will be registered |
| `vote` | `IMajorityVoting.VoteOption` | The vote to cast (Yes, No, Abstain) |
# ILockToGovernBase
**Interface** · [`src/interfaces/ILockToGovernBase.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/ILockToGovernBase.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X 2024-2025
## Functions
### isProposalEnded
```solidity
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. |
### isProposalOpen
```solidity
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. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | |
### 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.
### token
```solidity
function token() external view returns (IERC20)
```
Selector: `0xfc0c546a`
Returns the address of the token contract used to determine the voting power.
### usedVotingPower
```solidity
function usedVotingPower(uint256 proposalId, address voter) external view returns (uint256)
```
Selector: `0xeff759a8`
Returns whether the account has voted for the proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The account address to be checked. |
# ILockToVote
**Interface** · [`src/interfaces/ILockToVote.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/ILockToVote.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X
**Inherits:** [`ILockToGovernBase`](/abi/lock-to-vote-plugin/ILockToGovernBase.md)
Governance plugin allowing token holders to use tokens locked without a snapshot requirement and engage in proposals immediately
## Functions
### 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:** `voteOption`, 1 -> abstain, 2 -> yes, 3 -> no
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal Id. |
| `voter` | `address` | The account address to be checked. |
| `voteOption` | `IMajorityVoting.VoteOption` | The value of the new vote to register. If an existing vote existed, it will be replaced. |
### 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
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The voter's address. |
### isProposalEnded
```solidity
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. |
### isProposalOpen
```solidity
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. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ILockManager`](/abi/lock-to-vote-plugin/ILockManager.md) | |
### 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.
### token
```solidity
function token() external view returns (IERC20)
```
Selector: `0xfc0c546a`
Returns the address of the token contract used to determine the voting power.
### usedVotingPower
```solidity
function usedVotingPower(uint256 proposalId, address voter) external view returns (uint256)
```
Selector: `0xeff759a8`
Returns whether the account has voted for the proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The account address to be checked. |
### vote
```solidity
function vote(
uint256 proposalId,
address voter,
IMajorityVoting.VoteOption voteOption,
uint256 votingPower
) external
```
Selector: `0x483f50f8`
Votes on a proposal and, depending on the mode, executes it.
> **Dev:** `voteOption`, 1 -> abstain, 2 -> yes, 3 -> no
> votingPower updates any prior voting power, it does not add to the existing amount.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal to vote on. |
| `voter` | `address` | The address of the account whose vote will be registered |
| `voteOption` | `IMajorityVoting.VoteOption` | The value of the new vote to register. If an existing vote existed, it will be replaced. |
| `votingPower` | `uint256` | The new balance that should be allocated to the voter. It can only be bigger. |
# IMajorityVoting
**Interface** · [`src/interfaces/IMajorityVoting.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/IMajorityVoting.sol)
**Explained in:** [Lock to Vote Plugin](/plugins/lock-to-vote-plugin.md)
**Author:** Aragon X - 2022-2024
The interface of majority voting plugin.
**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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getVote
```solidity
function getVote(
uint256 _proposalId,
address _account
) 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The account address to be checked. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteEntry`](#voteentry) | |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### minApprovalRatio
```solidity
function minApprovalRatio() external view returns (uint256)
```
Selector: `0x0e04be90`
Returns the configured minimum approval ratio.
### minParticipationRatio
```solidity
function minParticipationRatio() external view returns (uint32)
```
Selector: `0xb9835a17`
Returns the minimum participation parameter stored in the voting settings.
### supportThresholdRatio
```solidity
function supportThresholdRatio() external view returns (uint32)
```
Selector: `0x2e747051`
Returns the support threshold parameter stored in the voting settings.
## Events
### VoteCast
```solidity
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`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
## Enums
### VoteOption
```solidity
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. |
## Structs
### VoteEntry
```solidity
struct VoteEntry {
IMajorityVoting.VoteOption voteOption;
uint256 votingPower;
}
```
Holds the state of an account's vote
| Field | Type | Description |
| --- | --- | --- |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | 1 -> abstain, 2 -> yes, 3 -> no |
| `votingPower` | `uint256` | How many tokens the account has allocated to `voteOption` |
# LockManagerSettings
**Struct** · [`src/interfaces/ILockManager.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/ILockManager.sol)
**Explained in:** [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)
```solidity
struct LockManagerSettings {
PluginMode pluginMode;
}
```
The struct containing the LockManager helper settings. They are immutable after deployed.
| Field | Type | Description |
| --- | --- | --- |
| `pluginMode` | [`PluginMode`](/abi/lock-to-vote-plugin/PluginMode.md) | |
# PluginMode
**Enum** · [`src/interfaces/ILockManager.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/interfaces/ILockManager.sol)
**Explained in:** [The LockManager](/plugins/lock-to-vote-plugin/lock-manager.md)
```solidity
enum PluginMode {
Voting
}
```
Defines wether the accepted plugin types. Currently: voting.
Placeholder for future plugin variants
| Option | Value |
| --- | --- |
| `Voting` | `0` |
# createProxyAndCall
**Function** · [`src/util/proxy.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/util/proxy.sol)
```solidity
function createProxyAndCall(address logic, bytes memory data) returns (address)
```
# createSaltedProxyAndCall
**Function** · [`src/util/proxy.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/util/proxy.sol)
```solidity
function createSaltedProxyAndCall(address logic, bytes memory data, bytes32 salt) returns (address)
```
# predictProxyAddress
**Function** · [`src/util/proxy.sol`](https://github.com/aragon/lock-to-vote-plugin/blob/5a513e3d9f1aad35d8926de87c408720e8d20a8d/src/util/proxy.sol)
```solidity
function predictProxyAddress(address factory, bytes32 salt, address logic, bytes memory data)
pure
returns (address predictedAddress)
```
# multisig-plugin — ABI reference
Generated from [`multisig-plugin`](https://github.com/aragon/multisig-plugin) at commit [`c1b0e049`](https://github.com/aragon/multisig-plugin/commit/c1b0e04919819f8fb1ec110743085dfb0dd7cc02).
4 entries. Regenerate with `just abi`.
## Contracts
- [`ListedCheckCondition`](/abi/multisig-plugin/ListedCheckCondition.md) — A condition contract that checks if an address is listed as a member in the associated Multisig contract.
- [`Multisig`](/abi/multisig-plugin/Multisig.md) — The onchain multisig governance plugin in which a proposal passes if X out of Y approvals are met.
- [`MultisigSetup`](/abi/multisig-plugin/MultisigSetup.md) — The setup contract of the `Multisig` plugin.
## Interfaces
- [`IMultisig`](/abi/multisig-plugin/IMultisig.md) — An interface for an onchain multisig governance plugin in which a proposal passes if X out of Y approvals are met.
# ListedCheckCondition
**Contract** · [`packages/contracts/src/ListedCheckCondition.sol`](https://github.com/aragon/multisig-plugin/blob/c1b0e04919819f8fb1ec110743085dfb0dd7cc02/packages/contracts/src/ListedCheckCondition.sol)
**Explained in:** [Multisig membership & eligibility](/plugins/multisig-plugin/membership.md)
**Author:** Aragon X - 2024
**Inherits:** `PermissionCondition`
A condition contract that checks if an address is listed as a member in the associated Multisig contract.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(address _multisig)
```
Initializes the condition with the address of the Multisig plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_multisig` | `address` | The address of the Multisig plugin that stores listing and other configuration settings. |
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
# Multisig
**Contract** · [`packages/contracts/src/Multisig.sol`](https://github.com/aragon/multisig-plugin/blob/c1b0e04919819f8fb1ec110743085dfb0dd7cc02/packages/contracts/src/Multisig.sol)
**Explained in:** [Create, vote, and execute a proposal](/guides/create-vote-execute.md), [Multisig membership & eligibility](/plugins/multisig-plugin/membership.md), [Multisig Plugin](/plugins/multisig-plugin.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IMultisig`](/abi/multisig-plugin/IMultisig.md), `IMembership`, `MetadataExtensionUpgradeable`, `PluginUUPSUpgradeable`, `ProposalUpgradeable`, `Addresslist`
The onchain multisig governance plugin in which a proposal passes if X out of Y approvals are met.
> **Dev:** v1.3 (Release 1, Build 3). For each upgrade, if the reinitialization step is required,
> increment the version numbers in the modifier for both the initialize and initializeFrom functions.
**security-contact:** sirt@aragon.org
## Functions
### addAddresses
```solidity
function addAddresses(address[] _members) external
```
Selector: `0x3628731c`
Adds new members to the address list. Previously, it checks if the new address list length would be greater than `type(uint16).max`, the maximal number of approvals.
> **Dev:** Requires the `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_members` | `address[]` | The addresses of the members to be added. |
### addresslistLength
```solidity
function addresslistLength() external view returns (uint256)
```
Selector: `0x27f1608d`
Returns the current length of the address list.
### addresslistLengthAtBlock
```solidity
function addresslistLengthAtBlock(uint256 _blockNumber) external view returns (uint256)
```
Selector: `0x6a6b2d86`
Returns the length of the address list at a specific block number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_blockNumber` | `uint256` | The specific block to get the count from. If `0`, then the latest checkpoint value is returned. |
### approve
```solidity
function approve(uint256 _proposalId, bool _tryExecution) external
```
Selector: `0x747442d3`
Records an approval for a proposal and, if specified, attempts execution if certain conditions are met.
> **Dev:** If `_tryExecution` is `true`, the function attempts execution after recording the approval.
> Execution will only proceed if the proposal is no longer open, the minimum approval requirements are met,
> and the caller has been granted execution permission. If execution conditions are not met,
> the function does not revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to approve. |
| `_tryExecution` | `bool` | If `true`, attempts execution of the proposal after approval, without reverting on failure. |
### canApprove
```solidity
function canApprove(uint256 _proposalId, address _account) external view returns (bool)
```
Selector: `0x29245f56`
Checks if an account is eligible to participate in a proposal vote. Confirms that the proposal is open, the account is listed as a member, and the account has not previously voted or approved this proposal.
> **Dev:** Reverts if the proposal with the given `_proposalId` does not exist.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The address of the account to check. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | True if the account is eligible to vote. |
### 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.
| 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. |
### createProposal(bytes,(address,uint256,bytes)[],uint256,bool,bool,uint64,uint64)
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint256 _allowFailureMap,
bool _approveProposal,
bool _tryExecution,
uint64 _startDate,
uint64 _endDate
) external returns (uint256 proposalId)
```
Selector: `0xfbd56e41`
Creates a new multisig proposal.
> **Dev:** Requires the `CREATE_PROPOSAL_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after 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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `_approveProposal` | `bool` | If `true`, the sender will approve the proposal. |
| `_tryExecution` | `bool` | If `true`, execution is tried after the vote cast. The call does not revert if execution is not possible. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
> **Dev:** Calls a public function that requires the `CREATE_PROPOSAL_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI 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 if all execution conditions are met.
> **Dev:** Requires the `EXECUTE_PROPOSAL_PERMISSION_ID` permission.
> Reverts if the proposal is still open or if the minimum approval threshold has not been met.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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 executed, uint16 approvals, Multisig.ProposalParameters parameters, 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 |
| --- | --- | --- |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `approvals` | `uint16` | The number of approvals casted. |
| `parameters` | [`Multisig.ProposalParameters`](#proposalparameters) | The parameters of the proposal. |
| `actions` | `Action[]` | The actions to be executed to the `target` contract address. |
| `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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | Execution 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### hasApproved
```solidity
function hasApproved(uint256 _proposalId, address _account) external view returns (bool)
```
Selector: `0x2358d5a8`
Returns whether the account has approved the proposal.
> **Dev:** May return false if the `_proposalId` or `_account` do not exist,
> as the function does not verify their existence.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The account address to be checked. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | The 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:** Note that this must not include time window checks and only make a decision based on the thresholds.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### initialize
```solidity
function initialize(
IDAO _dao,
address[] _members,
Multisig.MultisigSettings _multisigSettings,
IPlugin.TargetConfig _targetConfig,
bytes _pluginMetadata
) external
```
Selector: `0xdc119aac`
Initializes Release 1, Build 3.
> **Dev:** This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The IDAO interface of the associated DAO. |
| `_members` | `address[]` | The addresses of the initial members to be added. |
| `_multisigSettings` | [`Multisig.MultisigSettings`](#multisigsettings) | The multisig settings. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | Configuration for the execution target, specifying the target address and operation type(either `Call` or `DelegateCall`). Defined by `TargetConfig` in the `IPlugin` interface of `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. |
### initializeFrom
```solidity
function initializeFrom(uint16 _fromBuild, bytes _initData) external
```
Selector: `0x10c83f4e`
Reinitializes the Multisig after an upgrade from a previous build version. For each
reinitialization step, use the `_fromBuild` version to decide which internal functions to call
for reinitialization.
> **Dev:** WARNING: The contract should only be upgradeable through PSP to ensure that _fromBuild is not
> incorrectly passed, and that the appropriate permissions for the upgrade are properly configured.
| Parameter | Type | Description |
| --- | --- | --- |
| `_fromBuild` | `uint16` | The build version number of the previous implementation contract this upgrade is transitioning from. |
| `_initData` | `bytes` | The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)). |
### isListed
```solidity
function isListed(address _account) external view returns (bool)
```
Selector: `0xf794062e`
Checks if an account is currently on the address list.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The account address being checked. |
### isListedAtBlock
```solidity
function isListedAtBlock(address _account, uint256 _blockNumber) external view returns (bool)
```
Selector: `0xb1bb8d26`
Checks if an account is on the address list at a specific block number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The account address being checked. |
| `_blockNumber` | `uint256` | The block number. |
### 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.
| 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. |
### lastMultisigSettingsChange
```solidity
function lastMultisigSettingsChange() external view returns (uint64)
```
Selector: `0xbc208302`
Keeps track at which block number the multisig settings have been changed the last time.
> **Dev:** This variable prevents a proposal from being created in the same block in which the multisig
> settings change.
### multisigSettings
```solidity
function multisigSettings() external view returns (bool onlyListed, uint16 minApprovals)
```
Selector: `0xe097b3ff`
The current plugin settings.
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### removeAddresses
```solidity
function removeAddresses(address[] _members) external
```
Selector: `0xa84eb999`
Removes existing members from the address list. Previously, it checks if the new address list length is at least as long as the minimum approvals parameter requires. Note that `minApprovals` is must be at least 1 so the address list cannot become empty.
> **Dev:** Requires the `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_members` | `address[]` | The addresses of the members to be removed. |
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `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
```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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### updateMultisigSettings
```solidity
function updateMultisigSettings(Multisig.MultisigSettings _multisigSettings) external
```
Selector: `0x303f4336`
Updates the plugin settings.
> **Dev:** Requires the `UPDATE_MULTISIG_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_multisigSettings` | [`Multisig.MultisigSettings`](#multisigsettings) | The new 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
## Events
### AdminChanged
```solidity
event AdminChanged(address previousAdmin, address newAdmin)
```
> **Dev:** Emitted when the admin account has changed.
### Approved
```solidity
event Approved(uint256 indexed proposalId, address indexed approver)
```
Emitted when a proposal is approve by an approver.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `approver` | `address` | The approver casting the approve. |
### 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.
### MembersAdded
```solidity
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
```solidity
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
```solidity
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
```solidity
event MetadataSet(bytes metadata)
```
Emitted when metadata is updated.
### MultisigSettingsUpdated
```solidity
event MultisigSettingsUpdated(bool onlyListed, uint16 indexed minApprovals)
```
Emitted when the plugin settings are set.
| Parameter | Type | Description |
| --- | --- | --- |
| `onlyListed` | `bool` | Whether only listed addresses can create a proposal. |
| `minApprovals` | `uint16` | The minimum amount of approvals needed to pass a proposal. |
### 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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### AddresslistLengthOutOfBounds
```solidity
error AddresslistLengthOutOfBounds(uint16 limit, uint256 actual)
```
Thrown if the address list length is out of bounds.
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint16` | The limit value. |
| `actual` | `uint256` | The actual value. |
### AlreadyInitialized
```solidity
error AlreadyInitialized()
```
Thrown when initialize is called after it has already been executed.
### ApprovalCastForbidden
```solidity
error ApprovalCastForbidden(uint256 proposalId, address sender)
```
Thrown if an approver is not allowed to cast an approve. This can be because the proposal
- is not open,
- was executed, or
- the approver is not on the address list
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `sender` | `address` | The address of the sender. |
### DaoUnauthorized
```solidity
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
```solidity
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
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
### InvalidAddresslistUpdate
```solidity
error InvalidAddresslistUpdate(address member)
```
Thrown when the address list update is invalid, which can be caused by the addition of an existing member or removal of a non-existing member.
| Parameter | Type | Description |
| --- | --- | --- |
| `member` | `address` | The array of member addresses to be added or removed. |
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
### MinApprovalsOutOfBounds
```solidity
error MinApprovalsOutOfBounds(uint16 limit, uint16 actual)
```
Thrown if the minimal approvals value is out of bounds (less than 1 or greater than the number of
members in the address list).
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint16` | The maximal value. |
| `actual` | `uint16` | The actual value. |
### NonexistentProposal
```solidity
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. |
### ProposalAlreadyExists
```solidity
error ProposalAlreadyExists(uint256 proposalId)
```
Thrown if the proposal with the same id already exists.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### ProposalCreationForbidden
```solidity
error ProposalCreationForbidden(address sender)
```
Thrown when a sender is not allowed to create a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The sender address. |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
## 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` function.
### 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_MULTISIG_SETTINGS_PERMISSION_ID
```solidity
bytes32 public constant UPDATE_MULTISIG_SETTINGS_PERMISSION_ID =
keccak256("UPDATE_MULTISIG_SETTINGS_PERMISSION");
```
Value: `0xb1750e46d35a0069c8465b8643e7838d2149a842a2db8ee233d9835590040cad`
The ID of the permission required to call the
`addAddresses`, `removeAddresses` and `updateMultisigSettings` functions.
### 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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### MetadataExtensionStorage
_Inherited from `MetadataExtensionUpgradeable`._
```solidity
struct MetadataExtensionStorage {
bytes metadata;
}
```
### MultisigSettings
```solidity
struct MultisigSettings {
bool onlyListed;
uint16 minApprovals;
}
```
A container for the plugin settings.
| Field | Type | Description |
| --- | --- | --- |
| `onlyListed` | `bool` | Whether only listed addresses can create a proposal or not. |
| `minApprovals` | `uint16` | The minimal number of approvals required for a proposal to pass. |
### Proposal
```solidity
struct Proposal {
bool executed;
uint16 approvals;
Multisig.ProposalParameters parameters;
mapping(address => bool) approvers;
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. |
| `approvals` | `uint16` | The number of approvals casted. |
| `parameters` | [`Multisig.ProposalParameters`](#proposalparameters) | The proposal-specific approve settings at the time of the proposal creation. |
| `approvers` | `mapping(address => bool)` | The approves casted by the approvers. |
| `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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `targetConfig` | [`IPlugin.TargetConfig`](#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
```solidity
struct ProposalParameters {
uint16 minApprovals;
uint64 snapshotBlock;
uint64 startDate;
uint64 endDate;
}
```
A container for the proposal parameters.
| Field | Type | Description |
| --- | --- | --- |
| `minApprovals` | `uint16` | The number of approvals required. |
| `snapshotBlock` | `uint64` | The number of the block prior to the proposal creation. |
| `startDate` | `uint64` | The timestamp when the proposal starts. |
| `endDate` | `uint64` | The timestamp when the proposal expires. |
### 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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
# MultisigSetup
**Contract** · [`packages/contracts/src/MultisigSetup.sol`](https://github.com/aragon/multisig-plugin/blob/c1b0e04919819f8fb1ec110743085dfb0dd7cc02/packages/contracts/src/MultisigSetup.sol)
**Explained in:** [Deploy your first DAO](/guides/deploy-a-dao.md), [Install a plugin into a live DAO](/guides/install-a-plugin.md), [Multisig Plugin](/plugins/multisig-plugin.md)
**Author:** Aragon X - 2022-2024
**Inherits:** `PluginUpgradeableSetup`
The setup contract of the `Multisig` plugin.
> **Dev:** v1.3 (Release 1, Build 3)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
The contract constructor, that deploys the `Multisig` plugin logic contract.
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external view returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Revoke the upgrade plugin permission to the DAO for all builds prior the current one (3).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### InvalidUpdatePath
```solidity
error InvalidUpdatePath(uint16 fromBuild, uint16 thisBuild)
```
Thrown when an update path is not available, for example, if this is the initial build.
| Parameter | Type | Description |
| --- | --- | --- |
| `fromBuild` | `uint16` | The build number to update from. |
| `thisBuild` | `uint16` | The build number of this setup to update to. |
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
# IMultisig
**Interface** · [`packages/contracts/src/IMultisig.sol`](https://github.com/aragon/multisig-plugin/blob/c1b0e04919819f8fb1ec110743085dfb0dd7cc02/packages/contracts/src/IMultisig.sol)
**Explained in:** [Multisig Plugin](/plugins/multisig-plugin.md)
**Author:** Aragon X - 2022-2024
An interface for an onchain multisig governance plugin in which a proposal passes
if X out of Y approvals are met.
**security-contact:** sirt@aragon.org
## Functions
### addAddresses
```solidity
function addAddresses(address[] _members) external
```
Selector: `0x3628731c`
Adds new members to the address list. Previously, it checks if the new address
list length would be greater than `type(uint16).max`, the maximal number of approvals.
| Parameter | Type | Description |
| --- | --- | --- |
| `_members` | `address[]` | The addresses of the members to be added. |
### approve
```solidity
function approve(uint256 _proposalId, bool _tryExecution) external
```
Selector: `0x747442d3`
Records an approval for a proposal and, if specified, attempts execution if certain conditions are met.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to approve. |
| `_tryExecution` | `bool` | If `true`, attempts execution of the proposal after approval, without reverting on failure. |
### canApprove
```solidity
function canApprove(uint256 _proposalId, address _account) external view returns (bool)
```
Selector: `0x29245f56`
Checks if an account is eligible to participate in a proposal vote.
Confirms that the proposal is open, the account is listed as a member,
and the account has not previously voted or approved this proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The address of the account to check. |
### canExecute
```solidity
function canExecute(uint256 _proposalId) external view returns (bool)
```
Selector: `0xcc63604a`
Checks if a proposal can be executed.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal if all execution conditions are met.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### hasApproved
```solidity
function hasApproved(uint256 _proposalId, address _account) external view returns (bool)
```
Selector: `0x2358d5a8`
Returns whether the account has approved the proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The account address to be checked. |
### removeAddresses
```solidity
function removeAddresses(address[] _members) external
```
Selector: `0xa84eb999`
Removes existing members from the address list. Previously, it checks if the
new address list length is at least as long as the minimum approvals parameter requires.
Note that `minApprovals` is must be at least 1 so the address list cannot become empty.
| Parameter | Type | Description |
| --- | --- | --- |
| `_members` | `address[]` | The addresses of the members to be removed. |
# osx — ABI reference
Generated from [`osx`](https://github.com/aragon/core) at commit [`f7c7508f`](https://github.com/aragon/core/commit/f7c7508f4ceb2b685ee037ffe87df17340fc4aef).
65 entries. Regenerate with `just abi`.
## Contracts
- [`Addresslist`](/abi/osx/Addresslist.md) — The majority voting implementation using a list of member addresses.
- [`CallbackHandler`](/abi/osx/CallbackHandler.md) — This contract handles callbacks by registering a magic number together with the callback function's selector.
- [`DAO`](/abi/osx/DAO.md) — This contract is the entry point to the Aragon DAO framework and provides our users a simple and easy to use public interface.
- [`DaoAuthorizable`](/abi/osx/DaoAuthorizable.md) — An abstract contract providing a meta-transaction compatible modifier for non-upgradeable contracts instantiated via the `new` keyword to authorize function…
- [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md) — An abstract contract providing a meta-transaction compatible modifier for upgradeable or cloneable contracts to authorize function calls through an associated…
- [`DAOFactory`](/abi/osx/DAOFactory.md) — This contract is used to create a DAO.
- [`DAORegistry`](/abi/osx/DAORegistry.md) — This contract provides the possibility to register a DAO.
- [`ENSSubdomainRegistrar`](/abi/osx/ENSSubdomainRegistrar.md) — This contract registers ENS subdomains under a parent domain specified in the initialization process and maintains ownership of the subdomain since only the…
- [`Executor`](/abi/osx/Executor.md) — Simple Executor that loops through the actions and executes them.
- [`InterfaceBasedRegistry`](/abi/osx/InterfaceBasedRegistry.md) — An [ERC-165](https://eips.ethereum.org/EIPS/eip-165)-based registry for contracts.
- [`MemberRegistry`](/abi/osx/MemberRegistry.md) — Permissionless member self-registration via ENS subdomain claims.
- [`MetadataExtension`](/abi/osx/MetadataExtension.md) — An abstract, non upgradeable contract for managing and retrieving metadata associated with a plugin.
- [`MetadataExtensionUpgradeable`](/abi/osx/MetadataExtensionUpgradeable.md) — An abstract, upgradeable contract for managing and retrieving metadata associated with a plugin.
- [`PermissionCondition`](/abi/osx/PermissionCondition.md) — An abstract contract for non-upgradeable contracts instantiated via the `new` keyword to inherit from to support customary permissions depending on arbitrary…
- [`PermissionConditionUpgradeable`](/abi/osx/PermissionConditionUpgradeable.md) — An abstract contract for upgradeable or cloneable contracts to inherit from and to support customary permissions depending on arbitrary onchain state.
- [`PermissionManager`](/abi/osx/PermissionManager.md) — The abstract permission manager used in a DAO, its associated plugins, and other framework-related components.
- [`PlaceholderSetup`](/abi/osx/PlaceholderSetup.md) — A placeholder setup contract for outdated plugin builds.
- [`Plugin`](/abi/osx/Plugin.md) — An abstract, non-upgradeable contract to inherit from when creating a plugin being deployed via the `new` keyword.
- [`PluginCloneable`](/abi/osx/PluginCloneable.md) — An abstract, non-upgradeable contract to inherit from when creating a plugin being deployed via the minimal clones pattern (see…
- [`PluginRepo`](/abi/osx/PluginRepo.md) — The plugin repository contract required for managing and publishing different plugin versions within the Aragon DAO framework.
- [`PluginRepoFactory`](/abi/osx/PluginRepoFactory.md) — This contract creates `PluginRepo` proxies and registers them on a `PluginRepoRegistry` contract.
- [`PluginRepoRegistry`](/abi/osx/PluginRepoRegistry.md) — This contract maintains an address-based registry of plugin repositories in the Aragon App DAO framework.
- [`PluginSetup`](/abi/osx/PluginSetup.md) — An abstract contract to inherit from to implement the plugin setup for non-upgradeable plugins, i.e, - `Plugin` being deployed via the `new` keyword -…
- [`PluginSetupProcessor`](/abi/osx/PluginSetupProcessor.md) — This contract processes the preparation and application of plugin setups (installation, update, uninstallation) on behalf of a requesting DAO.
- [`PluginUpgradeableSetup`](/abi/osx/PluginUpgradeableSetup.md) — An abstract contract to inherit from to implement the plugin setup for upgradeable plugins, i.e, `PluginUUPSUpgradeable` being deployed via the UUPS pattern…
- [`PluginUUPSUpgradeable`](/abi/osx/PluginUUPSUpgradeable.md) — An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see…
- [`Proposal`](/abi/osx/Proposal.md) — An abstract contract containing the traits and internal functionality to create and execute proposals that can be inherited by non-upgradeable DAO plugins.
- [`ProposalUpgradeable`](/abi/osx/ProposalUpgradeable.md) — An abstract contract containing the traits and internal functionality to create and execute proposals that can be inherited by upgradeable DAO plugins.
- [`ProtocolVersion`](/abi/osx/ProtocolVersion.md) — An abstract, stateless, non-upgradeable contract providing the current Aragon OSx protocol version number.
- [`ProxyFactory`](/abi/osx/ProxyFactory.md) — A factory to deploy proxies via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) and minimal proxy pattern (see…
- [`RuledCondition`](/abi/osx/RuledCondition.md) — An abstract contract to create conditional permissions using rules.
## Interfaces
- [`IDAO`](/abi/osx/IDAO.md) — The interface required for DAOs within the Aragon App DAO framework.
- [`IEIP4824`](/abi/osx/IEIP4824.md) — See https://eips.ethereum.org/EIPS/eip-4824
- [`IExecutor`](/abi/osx/IExecutor.md) — The interface required for Executors within the Aragon App DAO framework.
- [`IMemberRegistry`](/abi/osx/IMemberRegistry.md) — Permissionless member self-registration via ENS subdomain claims.
- [`IMembership`](/abi/osx/IMembership.md) — An interface to be implemented by DAO plugins that define membership.
- [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) — An interface to be implemented to support custom permission logic.
- [`IPlugin`](/abi/osx/IPlugin.md) — An interface defining the traits of a plugin.
- [`IPluginRepo`](/abi/osx/IPluginRepo.md) — The interface required for a plugin repository.
- [`IPluginSetup`](/abi/osx/IPluginSetup.md) — The interface required for a plugin setup contract to be consumed by the `PluginSetupProcessor` for plugin installations, updates, and uninstallations.
- [`IProposal`](/abi/osx/IProposal.md) — An interface to be implemented by DAO plugins that create and execute proposals.
- [`IProtocolVersion`](/abi/osx/IProtocolVersion.md) — An interface defining the semantic Aragon OSx protocol version number.
- [`IResolver`](/abi/osx/IResolver.md) — Minimal resolver interface for MemberRegistry.
## Libraries
- [`ENSDomain`](/abi/osx/ENSDomain.md) — Pure-string utilities for working with ENS domain names: namehash (EIP-137) and splitting at the first dot.
- [`PermissionLib`](/abi/osx/PermissionLib.md) — A library containing objects for permission processing.
- [`ProxyLib`](/abi/osx/ProxyLib.md) — A library containing methods for the deployment of proxies via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) and minimal proxy…
- [`VersionComparisonLib`](/abi/osx/VersionComparisonLib.md) — A library containing methods for [semantic version number](https://semver.org/spec/v2.0.0.html) comparison.
## Structs
- [`Action`](/abi/osx/Action.md)
- [`PluginSetupRef`](/abi/osx/PluginSetupRef.md)
## Enums
- [`PreparationType`](/abi/osx/PreparationType.md)
## Errors
- [`DaoUnauthorized`](/abi/osx/DaoUnauthorized.md) — Thrown if a call is unauthorized in the associated DAO.
- [`RatioOutOfBounds`](/abi/osx/RatioOutOfBounds.md) — Thrown if a ratio value exceeds the maximal value of `10**6`.
## Constants
- [`RATIO_BASE`](/abi/osx/RATIO_BASE.md)
## Functions
- [`_applyRatioCeiled`](/abi/osx/_applyRatioCeiled.md) — Applies a ratio to a value and ceils the remainder.
- [`_auth`](/abi/osx/_auth.md) — A free function checking if a caller is granted permissions on a target contract via a permission identifier that redirects the approval to a…
- [`_getAppliedSetupId`](/abi/osx/_getAppliedSetupId.md) — Returns an identifier for applied installations.
- [`_getPluginInstallationId`](/abi/osx/_getPluginInstallationId.md) — Returns an ID for plugin installation by hashing the DAO and plugin address.
- [`_getPreparedSetupId`](/abi/osx/_getPreparedSetupId.md) — Returns an ID for prepared setup obtained from hashing characterizing elements.
- [`_uncheckedAdd`](/abi/osx/_uncheckedAdd.md) — Adds two unsigned integers without checking the result for overflow errors (using safe math).
- [`_uncheckedSub`](/abi/osx/_uncheckedSub.md) — Subtracts two unsigned integers without checking the result for overflow errors (using safe math).
- [`flipBit`](/abi/osx/flipBit.md)
- [`hasBit`](/abi/osx/hasBit.md)
- [`hashHelpers`](/abi/osx/hashHelpers.md) — Returns a hash of an array of helper addresses (contracts or EOAs).
- [`hashPermissions`](/abi/osx/hashPermissions.md) — Returns a hash of an array of multi-targeted permission operations.
- [`isSubdomainValid`](/abi/osx/isSubdomainValid.md) — Validates that a subdomain name is composed only from characters in the allowed character set: - the lowercase letters `a-z` - the digits `0-9` - the hyphen `-`
# Addresslist
**Abstract contract** · [`src/common/plugin/extensions/governance/Addresslist.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/extensions/governance/Addresslist.sol)
**Explained in:** [Membership and the address list](/common/membership.md)
**Author:** Aragon X - 2021-2023
The majority voting implementation using a list of member addresses.
> **Dev:** This contract inherits from `MajorityVotingBase` and implements the `IMajorityVoting` interface.
**security-contact:** sirt@aragon.org
## Functions
### addresslistLength
```solidity
function addresslistLength() external view returns (uint256)
```
Selector: `0x27f1608d`
Returns the current length of the address list.
### addresslistLengthAtBlock
```solidity
function addresslistLengthAtBlock(uint256 _blockNumber) external view returns (uint256)
```
Selector: `0x6a6b2d86`
Returns the length of the address list at a specific block number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_blockNumber` | `uint256` | The specific block to get the count from. If `0`, then the latest checkpoint value is returned. |
### isListed
```solidity
function isListed(address _account) external view returns (bool)
```
Selector: `0xf794062e`
Checks if an account is currently on the address list.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The account address being checked. |
### isListedAtBlock
```solidity
function isListedAtBlock(address _account, uint256 _blockNumber) external view returns (bool)
```
Selector: `0xb1bb8d26`
Checks if an account is on the address list at a specific block number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The account address being checked. |
| `_blockNumber` | `uint256` | The block number. |
## Errors
### InvalidAddresslistUpdate
```solidity
error InvalidAddresslistUpdate(address member)
```
Thrown when the address list update is invalid, which can be caused by the addition of an existing member or removal of a non-existing member.
| Parameter | Type | Description |
| --- | --- | --- |
| `member` | `address` | The array of member addresses to be added or removed. |
# CallbackHandler
**Abstract contract** · [`src/core/utils/CallbackHandler.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/core/utils/CallbackHandler.sol)
**Explained in:** [The DAO contract](/core/dao.md)
**Author:** Aragon X - 2022-2023
This contract handles callbacks by registering a magic number together with the callback function's selector. It provides the `_handleCallback` function that inheriting contracts have to call inside their `fallback()` function (`_handleCallback(msg.callbackSelector, msg.data)`). This allows to adaptively register ERC standards (e.g., [ERC-721](https://eips.ethereum.org/EIPS/eip-721), [ERC-1115](https://eips.ethereum.org/EIPS/eip-1155), or future versions of [ERC-165](https://eips.ethereum.org/EIPS/eip-165)) and returning the required magic numbers for the associated callback functions for the inheriting contract so that it doesn't need to be upgraded.
> **Dev:** This callback handling functionality is intended to be used by executor contracts (i.e., `DAO.sol`).
**security-contact:** sirt@aragon.org
## Events
### CallbackReceived
```solidity
event CallbackReceived(address sender, bytes4 indexed sig, bytes data)
```
Emitted when `_handleCallback` is called.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | Who called the callback. |
| `sig` | `bytes4` | The function signature. |
| `data` | `bytes` | The calldata. |
## Errors
### UnknownCallback
```solidity
error UnknownCallback(bytes4 callbackSelector, bytes4 magicNumber)
```
Thrown if the callback function is not registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `callbackSelector` | `bytes4` | The selector of the callback function. |
| `magicNumber` | `bytes4` | The magic number to be registered for the callback function selector. |
# DAO
**Contract** · [`src/core/dao/DAO.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/core/dao/DAO.sol)
**Explained in:** [A hands-on tour of OSx](/guides/hands-on-tour.md), [Actions and execution](/core/execution.md), [Create, vote, and execute a proposal](/guides/create-vote-execute.md), [DAO metadata](/core/dao-metadata.md), [DAO signature validation (EIP-1271)](/core/signature-validation.md), [Manage permissions through governance](/guides/manage-permissions.md), [The DAO contract](/core/dao.md)
**Author:** Aragon X - 2021-2024
**Inherits:** [`IEIP4824`](/abi/osx/IEIP4824.md), `Initializable`, `IERC1271`, `ERC165StorageUpgradeable`, [`IDAO`](/abi/osx/IDAO.md), [`IExecutor`](/abi/osx/IExecutor.md), `UUPSUpgradeable`, [`ProtocolVersion`](/abi/osx/ProtocolVersion.md), [`PermissionManager`](/abi/osx/PermissionManager.md), [`CallbackHandler`](/abi/osx/CallbackHandler.md)
This contract is the entry point to the Aragon DAO framework and provides our users a simple and easy to use public interface.
> **Dev:** Public API of the Aragon DAO framework.
**security-contact:** sirt@aragon.org
## Constructor
### ()
```solidity
constructor()
```
Disables the initializers on the implementation contract to prevent it from being left uninitialized.
**oz-upgrades-unsafe-allow:** constructor
### ()
```solidity
fallback() external
```
### ()
```solidity
receive() external payable
```
## Functions
### applyMultiTargetPermissions
```solidity
function applyMultiTargetPermissions(PermissionLib.MultiTargetPermission[] _items) external
```
Selector: `0xe978afe5`
Applies an array of permission operations on multiple target contracts `items[i].where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_items` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to apply. |
### applySingleTargetPermissions
```solidity
function applySingleTargetPermissions(
address _where,
PermissionLib.SingleTargetPermission[] items
) external
```
Selector: `0x22844d04`
Applies an array of permission operations on a single target contracts `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the single target contract. |
| `items` | `PermissionLib.SingleTargetPermission[]` | The array of single-targeted permission operations to apply. |
### daoURI
```solidity
function daoURI() external view returns (string)
```
Selector: `0x7034731b`
A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the "EIP-4824 DAO JSON-LD Schema". This JSON file splits into four URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI should point to a JSON file that conforms to the "EIP-4824 Members JSON-LD Schema". The proposalsURI should point to a JSON file that conforms to the "EIP-4824 Proposals JSON-LD Schema". The activityLogURI should point to a JSON file that conforms to the "EIP-4824 Activity Log JSON-LD Schema". The governanceURI should point to a flatfile, normatively a .md file. Each of the JSON files named above can be statically hosted or dynamically-generated.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | The DAO URI. |
### deposit
```solidity
function deposit(address _token, uint256 _amount, string _reference) external payable
```
Selector: `0xbfe07da6`
Deposits (native) tokens to the DAO contract with a reference string.
| Parameter | Type | Description |
| --- | --- | --- |
| `_token` | `address` | The address of the token or address(0) in case of the native token. |
| `_amount` | `uint256` | The amount of tokens to deposit. |
| `_reference` | `string` | The reference describing the deposit reason. |
### execute
```solidity
function execute(
bytes32 _callId,
Action[] _actions,
uint256 _allowFailureMap
) external returns (bytes[] execResults, uint256 failureMap)
```
Selector: `0xc71bf324`
Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_callId` | `bytes32` | The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions. |
| `_allowFailureMap` | `uint256` | A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| Returns | Type | Description |
| --- | --- | --- |
| `execResults` | `bytes[]` | The array of results obtained from the executed actions in `bytes`. |
| `failureMap` | `uint256` | The resulting failure map containing the actions have actually failed. |
### getTrustedForwarder
```solidity
function getTrustedForwarder() external view returns (address)
```
Selector: `0xce1b815f`
Getter for the trusted forwarder verifying the meta transaction.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The trusted forwarder address. |
### grant
```solidity
function grant(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd68bad2c`
Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
### grantWithCondition
```solidity
function grantWithCondition(
address _where,
address _who,
bytes32 _permissionId,
IPermissionCondition _condition
) external
```
Selector: `0xc9dbc2a4`
Grants permission to an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier if the referenced condition permits it.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier. |
### hasPermission
```solidity
function hasPermission(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0xfdef9106`
Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the contract. |
| `_who` | `address` | The address of a EOA or contract to give the permissions. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | The optional data passed to the `PermissionCondition` registered. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the address has permission, false if not. |
### initialize
```solidity
function initialize(
bytes _metadata,
address _initialOwner,
address _trustedForwarder,
string daoURI_
) external
```
Selector: `0xeafb8b06`
Initializes the DAO by
- setting the reentrancy status variable to `_NOT_ENTERED`
- registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID
- setting the trusted forwarder for meta transactions
- giving the `ROOT_PERMISSION_ID` permission to the initial owner (that should be revoked and transferred to the DAO after setup).
> **Dev:** This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | IPFS hash that points to all the metadata (logo, description, tags, etc.) of a DAO. |
| `_initialOwner` | `address` | The initial owner of the DAO having the `ROOT_PERMISSION_ID` permission. |
| `_trustedForwarder` | `address` | The trusted forwarder responsible for verifying meta transactions. |
| `daoURI_` | `string` | The DAO URI required to support [ERC-4824](https://eips.ethereum.org/EIPS/eip-4824). |
### initializeFrom
```solidity
function initializeFrom(uint8[3] _previousProtocolVersion, bytes _initData) external
```
Selector: `0x42d8e99e`
Initializes the DAO after an upgrade from a previous protocol version.
| Parameter | Type | Description |
| --- | --- | --- |
| `_previousProtocolVersion` | `uint8[3]` | The semantic protocol version number of the previous DAO implementation contract this upgrade is transitioning from. |
| `_initData` | `bytes` | The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)). |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if the caller address has permission on the target contract via a permission identifier and relays the answer to a condition contract if this was declared during the granting process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) for which the permission is checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data to be passed to the set `PermissionCondition`. |
### isValidSignature
```solidity
function isValidSignature(bytes32 _hash, bytes _signature) external view returns (bytes4)
```
Selector: `0x1626ba7e`
Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).
> **Dev:** Relays the validation logic determining who is allowed to sign on behalf of the DAO to its permission manager.
> Caller specific bypassing can be set direct granting (i.e., `grant({_where: dao, _who: specificErc1271Caller, _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID})`).
> Caller specific signature validation logic can be set by granting with a `PermissionCondition` (i.e., `grantWithCondition({_where: dao, _who: specificErc1271Caller, _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID, _condition: yourConditionImplementation})`)
> Generic signature validation logic can be set for all calling contracts by granting with a `PermissionCondition` to `PermissionManager.ANY_ADDR()` (i.e., `grantWithCondition({_where: dao, _who: PermissionManager.ANY_ADDR(), _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID, _condition: yourConditionImplementation})`).
| Parameter | Type | Description |
| --- | --- | --- |
| `_hash` | `bytes32` | The hash of the data to be signed. |
| `_signature` | `bytes` | The signature byte array associated with `_hash`. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes4` | Returns the `bytes4` magic value `0x1626ba7e` if the signature is valid and `0xffffffff` if not. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### registerStandardCallback
```solidity
function registerStandardCallback(
bytes4 _interfaceId,
bytes4 _callbackSelector,
bytes4 _magicNumber
) external
```
Selector: `0xc4a50145`
Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
| `_callbackSelector` | `bytes4` | The selector of the callback function. |
| `_magicNumber` | `bytes4` | The magic number to be registered for the function signature. |
### revoke
```solidity
function revoke(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd96054c4`
Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` loses permission. |
| `_who` | `address` | The address (EOA or contract) losing the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
### setDaoURI
```solidity
function setDaoURI(string newDaoURI) external
```
Selector: `0x1080f99b`
Updates the set DAO URI to a new value.
| Parameter | Type | Description |
| --- | --- | --- |
| `newDaoURI` | `string` | The new DAO URI to be set. |
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `0xee57e36f`
Updates the DAO metadata (e.g., an IPFS hash).
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The IPFS hash of the new metadata object. |
### setSignatureValidator
```solidity
function setSignatureValidator(address) external pure
```
Selector: `0x3e2ab0d9`
Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.
> **Dev:** Introduced in v1.0.0. Removed in v1.4.0.
### setTrustedForwarder
```solidity
function setTrustedForwarder(address _newTrustedForwarder) external
```
Selector: `0xda742228`
Setter for the trusted forwarder verifying the meta transaction.
### supportsInterface
```solidity
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
> **Dev:** See {IERC165-supportsInterface}.
### 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
## 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.
### CallbackReceived
```solidity
event CallbackReceived(address sender, bytes4 indexed sig, bytes data)
```
Emitted when `_handleCallback` is called.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | Who called the callback. |
| `sig` | `bytes4` | The function signature. |
| `data` | `bytes` | The calldata. |
### Deposited
```solidity
event Deposited(
address indexed sender,
address indexed token,
uint256 amount,
string _reference
)
```
Emitted when a token deposit has been made to the DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The address of the sender. |
| `token` | `address` | The address of the deposited token. |
| `amount` | `uint256` | The amount of tokens deposited. |
| `_reference` | `string` | The reference describing the deposit reason. |
### Executed
```solidity
event Executed(
address indexed actor,
bytes32 callId,
Action[] actions,
uint256 allowFailureMap,
uint256 failureMap,
bytes[] execResults
)
```
Emitted when a proposal is executed.
> **Dev:** The value of `callId` is defined by the component/contract calling the execute function.
> A `Plugin` implementation can use it, for example, as a nonce.
| Parameter | Type | Description |
| --- | --- | --- |
| `actor` | `address` | The address of the caller. |
| `callId` | `bytes32` | The ID of the call. |
| `actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions executed. |
| `allowFailureMap` | `uint256` | The allow failure map encoding which actions are allowed to fail. |
| `failureMap` | `uint256` | The failure map encoding which actions have failed. |
| `execResults` | `bytes[]` | The array with the results of the executed actions. |
### Granted
```solidity
event Granted(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who,
address condition
)
```
Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is granted. |
| `where` | `address` | The address of the target contract for which `_who` receives permission. |
| `who` | `address` | The address (EOA or contract) receiving the permission. |
| `condition` | `address` | The address `ALLOW_FLAG` for regular permissions or, alternatively, the `IPermissionCondition` contract implementation to be used. |
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### MetadataSet
```solidity
event MetadataSet(bytes metadata)
```
Emitted when the DAO metadata is updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `metadata` | `bytes` | The IPFS hash of the new metadata object. |
### NativeTokenDeposited
```solidity
event NativeTokenDeposited(address sender, uint256 amount)
```
Emitted when a native token deposit has been made to the DAO.
> **Dev:** This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The address of the sender. |
| `amount` | `uint256` | The amount of native tokens deposited. |
### NewURI
```solidity
event NewURI(string daoURI)
```
Emitted when a new DAO URI is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `daoURI` | `string` | The new URI. |
### Revoked
```solidity
event Revoked(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who
)
```
Emitted when a permission `permission` is revoked in the context `here` from the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is revoked. |
| `where` | `address` | The address of the target contract for which `_who` loses permission. |
| `who` | `address` | The address (EOA or contract) losing the permission. |
### StandardCallbackRegistered
```solidity
event StandardCallbackRegistered(
bytes4 interfaceId,
bytes4 callbackSelector,
bytes4 magicNumber
)
```
Emitted when a standard callback is registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `interfaceId` | `bytes4` | The ID of the interface. |
| `callbackSelector` | `bytes4` | The selector of the callback function. |
| `magicNumber` | `bytes4` | The magic number to be registered for the callback function selector. |
### TrustedForwarderSet
```solidity
event TrustedForwarderSet(address forwarder)
```
Emitted when a new TrustedForwarder is set on the DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `forwarder` | `address` | the new forwarder address. |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### ActionFailed
```solidity
error ActionFailed(uint256 index)
```
Thrown if action execution has failed.
| Parameter | Type | Description |
| --- | --- | --- |
| `index` | `uint256` | The index of the action in the action array that failed. |
### AlreadyInitialized
```solidity
error AlreadyInitialized()
```
Thrown when initialize is called after it has already been executed.
### AnyAddressDisallowedForWhoAndWhere
```solidity
error AnyAddressDisallowedForWhoAndWhere()
```
Thrown for permission grants where `who` and `where` are both `ANY_ADDR`.
### ConditionInterfaceNotSupported
```solidity
error ConditionInterfaceNotSupported(IPermissionCondition condition)
```
Thrown if a condition contract does not support the `IPermissionCondition` interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### ConditionNotAContract
```solidity
error ConditionNotAContract(IPermissionCondition condition)
```
Thrown if a condition address is not a contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### FunctionRemoved
```solidity
error FunctionRemoved()
```
Thrown when a function is removed but left to not corrupt the interface ID.
### GrantWithConditionNotSupported
```solidity
error GrantWithConditionNotSupported()
```
Thrown if `Operation.GrantWithCondition` is requested as an operation but the method does not support it.
### InsufficientGas
```solidity
error InsufficientGas()
```
Thrown if an action has insufficient gas left.
### NativeTokenDepositAmountMismatch
```solidity
error NativeTokenDepositAmountMismatch(uint256 expected, uint256 actual)
```
Thrown if there is a mismatch between the expected and actually deposited amount of native tokens.
| Parameter | Type | Description |
| --- | --- | --- |
| `expected` | `uint256` | The expected native token amount. |
| `actual` | `uint256` | The actual native token amount deposited. |
### PermissionAlreadyGrantedForDifferentCondition
```solidity
error PermissionAlreadyGrantedForDifferentCondition(
address where,
address who,
bytes32 permissionId,
address currentCondition,
address newCondition
)
```
Thrown if a permission has been already granted with a different condition.
> **Dev:** This makes sure that condition on the same permission can not be overwriten by a different condition.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The address of the target contract to grant `_who` permission to. |
| `who` | `address` | The address (EOA or contract) to which the permission has already been granted. |
| `permissionId` | `bytes32` | The permission identifier. |
| `currentCondition` | `address` | The current condition set for permissionId. |
| `newCondition` | `address` | The new condition it tries to set for permissionId. |
### PermissionsForAnyAddressDisallowed
```solidity
error PermissionsForAnyAddressDisallowed()
```
Thrown for `ROOT_PERMISSION_ID` or `EXECUTE_PERMISSION_ID` permission grants where `who` or `where` is `ANY_ADDR`.
### ProtocolVersionUpgradeNotSupported
```solidity
error ProtocolVersionUpgradeNotSupported(uint8[3] protocolVersion)
```
Thrown if an upgrade is not supported from a specific protocol version .
### ReentrantCall
```solidity
error ReentrantCall()
```
Thrown if a call is reentrant.
### TooManyActions
```solidity
error TooManyActions()
```
Thrown if the action array length is larger than `MAX_ACTIONS`.
### Unauthorized
```solidity
error Unauthorized(address where, address who, bytes32 permissionId)
```
Thrown if a call is unauthorized.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The context in which the authorization reverted. |
| `who` | `address` | The address (EOA or contract) missing the permission. |
| `permissionId` | `bytes32` | The permission identifier. |
### UnknownCallback
```solidity
error UnknownCallback(bytes4 callbackSelector, bytes4 magicNumber)
```
Thrown if the callback function is not registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `callbackSelector` | `bytes4` | The selector of the callback function. |
| `magicNumber` | `bytes4` | The magic number to be registered for the callback function selector. |
### ZeroAmount
```solidity
error ZeroAmount()
```
Thrown if the deposit amount is zero.
## Constants
_Public, so each is also readable through a generated getter._
### EXECUTE_PERMISSION_ID
```solidity
bytes32 public constant EXECUTE_PERMISSION_ID = keccak256("EXECUTE_PERMISSION");
```
Value: `0xbf04b4486c9663d805744005c3da000eda93de6e3308a4a7a812eb565327b78d`
The ID of the permission required to call the `execute` function.
### REGISTER_STANDARD_CALLBACK_PERMISSION_ID
```solidity
bytes32 public constant REGISTER_STANDARD_CALLBACK_PERMISSION_ID =
keccak256("REGISTER_STANDARD_CALLBACK_PERMISSION");
```
Value: `0xfaf505be9907aa6951c2ebe5b0312f4980e14f21912ed355372103cc8bd683bc`
The ID of the permission required to call the `registerStandardCallback` function.
### ROOT_PERMISSION_ID
_Inherited from `PermissionManager`._
```solidity
bytes32 public constant ROOT_PERMISSION_ID = keccak256("ROOT_PERMISSION");
```
Value: `0x815fe80e4b37c8582a3b773d1d7071f983eacfd56b5965db654f3087c25ada33`
The ID of the permission required to call the `grant`, `grantWithCondition`, `revoke`, and `bulk` function.
### SET_METADATA_PERMISSION_ID
```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_TRUSTED_FORWARDER_PERMISSION_ID
```solidity
bytes32 public constant SET_TRUSTED_FORWARDER_PERMISSION_ID =
keccak256("SET_TRUSTED_FORWARDER_PERMISSION");
```
Value: `0x06d294bc8cbad2e393408b20dd019a772661f60b8d633e56761157cb1ec85f8c`
The ID of the permission required to call the `setTrustedForwarder` function.
### UPGRADE_DAO_PERMISSION_ID
```solidity
bytes32 public constant UPGRADE_DAO_PERMISSION_ID = keccak256("UPGRADE_DAO_PERMISSION");
```
Value: `0x1f53edd44352e5d15bad2b29233baa93bcd595e09457780bc7c5445bbbe751cc`
The ID of the permission required to call the `_authorizeUpgrade` function.
### VALIDATE_SIGNATURE_PERMISSION_ID
```solidity
bytes32 public constant VALIDATE_SIGNATURE_PERMISSION_ID =
keccak256("VALIDATE_SIGNATURE_PERMISSION");
```
Value: `0x968c17ebf04aa1b7544168e69314cdab6b69ba813bb6080d49c0c40a65560f58`
The ID of the permission required to validate [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signatures.
# DaoAuthorizable
**Abstract contract** · [`src/common/permission/auth/DaoAuthorizable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/auth/DaoAuthorizable.sol)
**Explained in:** [Authorizing against a DAO](/common/auth.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `Context`
An abstract contract providing a meta-transaction compatible modifier for non-upgradeable contracts instantiated via the `new` keyword to authorize function calls through an associated DAO.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
# DaoAuthorizableUpgradeable
**Abstract contract** · [`src/common/permission/auth/DaoAuthorizableUpgradeable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/auth/DaoAuthorizableUpgradeable.sol)
**Explained in:** [Authorizing against a DAO](/common/auth.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `ContextUpgradeable`
An abstract contract providing a meta-transaction compatible modifier for upgradeable or cloneable contracts to authorize function calls through an associated DAO.
> **Dev:** Make sure to call `__DaoAuthorizableUpgradeable_init` during initialization of the inheriting contract.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
# DAOFactory
**Contract** · [`src/framework/dao/DAOFactory.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/dao/DAOFactory.sol)
**Explained in:** [A hands-on tour of OSx](/guides/hands-on-tour.md), [DAOFactory (creating a DAO)](/framework/dao-factory.md), [Deploy your first DAO](/guides/deploy-a-dao.md), [Install a plugin into a live DAO](/guides/install-a-plugin.md), [Launch a governance token with your DAO](/guides/launch-a-governance-token.md), [Manage permissions through governance](/guides/manage-permissions.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `ERC165`, [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract is used to create a DAO.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(DAORegistry _registry, PluginSetupProcessor _pluginSetupProcessor)
```
The constructor setting the registry and plugin setup processor and creating the base contracts for the factory.
| Parameter | Type | Description |
| --- | --- | --- |
| `_registry` | [`DAORegistry`](/abi/osx/DAORegistry.md) | The DAO registry to register the DAO by its name. |
| `_pluginSetupProcessor` | [`PluginSetupProcessor`](/abi/osx/PluginSetupProcessor.md) | The address of PluginSetupProcessor. |
## Functions
### createDao
```solidity
function createDao(
DAOFactory.DAOSettings _daoSettings,
DAOFactory.PluginSettings[] _pluginSettings
) external returns (DAO createdDao, DAOFactory.InstalledPlugin[] installedPlugins)
```
Selector: `0xb5568838`
Creates a new DAO, registers it in the DAO registry, and optionally installs plugins via the plugin setup processor.
> **Dev:** If `_pluginSettings` is empty, the caller is granted `EXECUTE_PERMISSION` on the DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `_daoSettings` | [`DAOFactory.DAOSettings`](#daosettings) | The settings to configure during DAO initialization. |
| `_pluginSettings` | [`DAOFactory.PluginSettings[]`](#pluginsettings) | An array containing plugin references and settings. If provided, each plugin is installed after the DAO creation. |
| Returns | Type | Description |
| --- | --- | --- |
| `createdDao` | [`DAO`](/abi/osx/DAO.md) | The address of the newly created DAO instance. |
| `installedPlugins` | [`DAOFactory.InstalledPlugin[]`](#installedplugin) | An array of `InstalledPlugin` structs, each containing the plugin address and associated helper contracts and permissions, if plugins were installed; otherwise, an empty array. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### NoPluginProvided
```solidity
error NoPluginProvided()
```
Thrown if `PluginSettings` array is empty, and no plugin is provided.
## Constants
_Public, so each is also readable through a generated getter._
### daoBase
```solidity
address public immutable daoBase;
```
The DAO base contract, to be used for creating new `DAO`s via `createERC1967Proxy` function.
### daoRegistry
```solidity
DAORegistry public immutable daoRegistry;
```
The DAO registry listing the `DAO` contracts created via this contract.
### pluginSetupProcessor
```solidity
PluginSetupProcessor public immutable pluginSetupProcessor;
```
The plugin setup processor for installing plugins on the newly created `DAO`s.
## Structs
### DAOSettings
```solidity
struct DAOSettings {
address trustedForwarder;
string daoURI;
string subdomain;
bytes metadata;
}
```
### InstalledPlugin
```solidity
struct InstalledPlugin {
address plugin;
IPluginSetup.PreparedSetupData preparedSetupData;
}
```
### PluginSettings
```solidity
struct PluginSettings {
PluginSetupRef pluginSetupRef;
bytes data;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `data` | `bytes` | |
# DAORegistry
**Contract** · [`src/framework/dao/DAORegistry.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/dao/DAORegistry.sol)
**Explained in:** [DAO Registry](/framework/dao-registry.md), [Registries and ENS names](/framework/registries.md)
**Register your unique DAO subdomain**
**Author:** Aragon X - 2022-2023
**Inherits:** [`InterfaceBasedRegistry`](/abi/osx/InterfaceBasedRegistry.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract provides the possibility to register a DAO.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
> **Dev:** Used to disallow initializing the implementation contract by an attacker for extra safety.
**oz-upgrades-unsafe-allow:** constructor
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### entries
```solidity
function entries(address) external view returns (bool)
```
Selector: `0xf29ee125`
The mapping containing the registry entries returning true for registered contract addresses.
### initialize
```solidity
function initialize(IDAO _managingDao, ENSSubdomainRegistrar _subdomainRegistrar) external
```
Selector: `0x485cc955`
Initializes the contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_managingDao` | [`IDAO`](/abi/osx/IDAO.md) | the managing DAO address. |
| `_subdomainRegistrar` | [`ENSSubdomainRegistrar`](/abi/osx/ENSSubdomainRegistrar.md) | The `ENSSubdomainRegistrar` where `ENS` subdomain will be registered. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### register
```solidity
function register(IDAO dao, address creator, string subdomain) external
```
Selector: `0xede49739`
Registers a DAO by its address. If a non-empty subdomain name is provided that is not taken already, the DAO becomes the owner of the ENS name.
> **Dev:** A subdomain is unique within the Aragon DAO framework and can get stored here.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | [`IDAO`](/abi/osx/IDAO.md) | The address of the DAO contract. |
| `creator` | `address` | The address of the creator. |
| `subdomain` | `string` | The DAO subdomain. |
### subdomainRegistrar
```solidity
function subdomainRegistrar() external view returns (ENSSubdomainRegistrar)
```
Selector: `0x00077393`
The ENS subdomain registrar registering the DAO subdomains.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ENSSubdomainRegistrar`](/abi/osx/ENSSubdomainRegistrar.md) | |
### targetInterfaceId
```solidity
function targetInterfaceId() external view returns (bytes4)
```
Selector: `0x44162ef8`
The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID that the target contracts being registered must support.
### 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
## 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.
### DAORegistered
```solidity
event DAORegistered(address indexed dao, address indexed creator, string subdomain)
```
Emitted when a new DAO is registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | `address` | The address of the DAO contract. |
| `creator` | `address` | The address of the creator. |
| `subdomain` | `string` | The DAO subdomain. |
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### ContractAlreadyRegistered
```solidity
error ContractAlreadyRegistered(address registrant)
```
Thrown if the contract is already registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### ContractERC165SupportInvalid
```solidity
error ContractERC165SupportInvalid(address registrant)
```
Thrown if the contract does not support ERC165.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract. |
### ContractInterfaceInvalid
```solidity
error ContractInterfaceInvalid(address registrant)
```
Thrown if the contract does not support the required interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### DaoUnauthorized
```solidity
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. |
### ENSNotSupported
```solidity
error ENSNotSupported()
```
Thrown if the subdomain is present, but registrar is address(0).
### InvalidDaoSubdomain
```solidity
error InvalidDaoSubdomain(string subdomain)
```
Thrown if the DAO subdomain doesn't match the regex `[0-9a-z\-]`
## Constants
_Public, so each is also readable through a generated getter._
### REGISTER_DAO_PERMISSION_ID
```solidity
bytes32 public constant REGISTER_DAO_PERMISSION_ID = keccak256("REGISTER_DAO_PERMISSION");
```
Value: `0xde5e253d6956bc5fb69cfa564733633f4e53b143e42859306cd13cdc54856215`
The ID of the permission required to call the `register` function.
### UPGRADE_REGISTRY_PERMISSION_ID
_Inherited from `InterfaceBasedRegistry`._
```solidity
bytes32 public constant UPGRADE_REGISTRY_PERMISSION_ID =
keccak256("UPGRADE_REGISTRY_PERMISSION");
```
Value: `0x60b96ff9fb5f29153c29c1747515b8be4ee523d686cc6f453ec294b0afa72932`
The ID of the permission required to call the `_authorizeUpgrade` function.
# ENSSubdomainRegistrar
**Contract** · [`src/framework/utils/ens/ENSSubdomainRegistrar.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/utils/ens/ENSSubdomainRegistrar.sol)
**Explained in:** [Registries and ENS names](/framework/registries.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `UUPSUpgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract registers ENS subdomains under a parent domain specified in the initialization process and maintains ownership of the subdomain since only the resolver address is set. This contract must either be the domain node owner or an approved operator of the node owner. The default resolver being used is the one specified in the parent domain.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
> **Dev:** Used to disallow initializing the implementation contract by an attacker for extra safety.
**oz-upgrades-unsafe-allow:** constructor
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### ens
```solidity
function ens() external view returns (ENS)
```
Selector: `0x3f15457f`
The ENS registry contract
### initialize
```solidity
function initialize(IDAO _managingDao, ENS _ens, bytes32 _node) external
```
Selector: `0x6133f985`
Initializes the component by
- checking that the contract is the domain node owner or an approved operator
- initializing the underlying component
- registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID
- setting the ENS contract, the domain node hash, and resolver.
| Parameter | Type | Description |
| --- | --- | --- |
| `_managingDao` | [`IDAO`](/abi/osx/IDAO.md) | The interface of the DAO managing the components permissions. |
| `_ens` | `ENS` | The interface of the ENS registry to be used. |
| `_node` | `bytes32` | The ENS parent domain node under which the subdomains are to be registered. |
### node
```solidity
function node() external view returns (bytes32)
```
Selector: `0xd70754ec`
The namehash of the domain on which subdomains are registered.
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### registerSubnode
```solidity
function registerSubnode(bytes32 _label, address _targetAddress) external
```
Selector: `0x89bb4145`
Registers a new subdomain with this registrar as the owner and set the target address in the resolver.
> **Dev:** It reverts with no message if this contract isn't the owner nor an approved operator for the given node.
| Parameter | Type | Description |
| --- | --- | --- |
| `_label` | `bytes32` | The labelhash of the subdomain name. |
| `_targetAddress` | `address` | The address to which the subdomain resolves. |
### resolver
```solidity
function resolver() external view returns (address)
```
Selector: `0x04f3bcec`
The address of the ENS resolver resolving the names to an address.
### setDefaultResolver
```solidity
function setDefaultResolver(address _resolver) external
```
Selector: `0xc66485b2`
Sets the default resolver contract address that the subdomains being registered will use.
| Parameter | Type | Description |
| --- | --- | --- |
| `_resolver` | `address` | The resolver contract to be used. |
### 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
## 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.
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### AlreadyRegistered
```solidity
error AlreadyRegistered(bytes32 subnode, address nodeOwner)
```
Thrown if the subnode is already registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `subnode` | `bytes32` | The subnode namehash. |
| `nodeOwner` | `address` | The node owner address. |
### DaoUnauthorized
```solidity
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. |
### InvalidResolver
```solidity
error InvalidResolver(bytes32 node, address resolver)
```
Thrown if node's resolver is invalid.
| Parameter | Type | Description |
| --- | --- | --- |
| `node` | `bytes32` | The node namehash. |
| `resolver` | `address` | The node resolver address. |
## Constants
_Public, so each is also readable through a generated getter._
### REGISTER_ENS_SUBDOMAIN_PERMISSION_ID
```solidity
bytes32 public constant REGISTER_ENS_SUBDOMAIN_PERMISSION_ID =
keccak256("REGISTER_ENS_SUBDOMAIN_PERMISSION");
```
Value: `0xbbdfd23f099d7ed9f535e0f97d2123efb1332b16e023b8359b3b879eaecd3c14`
The ID of the permission required to call the `registerSubnode` and `setDefaultResolver` function.
### UPGRADE_REGISTRAR_PERMISSION_ID
```solidity
bytes32 public constant UPGRADE_REGISTRAR_PERMISSION_ID =
keccak256("UPGRADE_REGISTRAR_PERMISSION");
```
Value: `0xa1fcba4efb1e94b7648f5e0504bfd39734aead5f17965d12705915d771c859ff`
The ID of the permission required to call the `_authorizeUpgrade` function.
# Executor
**Contract** · [`src/common/executors/Executor.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/executors/Executor.sol)
**Explained in:** [Actions and execution](/core/execution.md)
**IDAO**
**Author:** Aragon X - 2024
**Inherits:** [`IExecutor`](/abi/osx/IExecutor.md), `ERC165`
Simple Executor that loops through the actions and executes them.
> **Dev:** This doesn't use any type of permission for execution and can be called by anyone.
> Most useful use-case is to deploy it as non-upgradeable and call from another contract via delegatecall.
> If used with delegatecall, DO NOT add state variables in sequential slots, otherwise this will overwrite
> the storage of the calling contract.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
Initializes the contract with a non-entered reentrancy status.
> **Dev:** Sets the reentrancy guard status to `_NOT_ENTERED` to prevent reentrant calls from the start.
## Functions
### execute
```solidity
function execute(
bytes32 _callId,
Action[] _actions,
uint256 _allowFailureMap
) external returns (bytes[] execResults, uint256 failureMap)
```
Selector: `0xc71bf324`
Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_callId` | `bytes32` | The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions. |
| `_allowFailureMap` | `uint256` | A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| Returns | Type | Description |
| --- | --- | --- |
| `execResults` | `bytes[]` | The array of results obtained from the executed actions in `bytes`. |
| `failureMap` | `uint256` | The resulting failure map containing the actions have actually failed. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### Executed
```solidity
event Executed(
address indexed actor,
bytes32 callId,
Action[] actions,
uint256 allowFailureMap,
uint256 failureMap,
bytes[] execResults
)
```
Emitted when a proposal is executed.
> **Dev:** The value of `callId` is defined by the component/contract calling the execute function.
> A `Plugin` implementation can use it, for example, as a nonce.
| Parameter | Type | Description |
| --- | --- | --- |
| `actor` | `address` | The address of the caller. |
| `callId` | `bytes32` | The ID of the call. |
| `actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions executed. |
| `allowFailureMap` | `uint256` | The allow failure map encoding which actions are allowed to fail. |
| `failureMap` | `uint256` | The failure map encoding which actions have failed. |
| `execResults` | `bytes[]` | The array with the results of the executed actions. |
## Errors
### ActionFailed
```solidity
error ActionFailed(uint256 index)
```
Thrown if action execution has failed.
| Parameter | Type | Description |
| --- | --- | --- |
| `index` | `uint256` | The index of the action in the action array that failed. |
### InsufficientGas
```solidity
error InsufficientGas()
```
Thrown if an action has insufficient gas left.
### ReentrantCall
```solidity
error ReentrantCall()
```
Thrown if a call is reentrant.
### TooManyActions
```solidity
error TooManyActions()
```
Thrown if the action array length is larger than `MAX_ACTIONS`.
# InterfaceBasedRegistry
**Abstract contract** · [`src/framework/utils/InterfaceBasedRegistry.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/utils/InterfaceBasedRegistry.sol)
**Explained in:** [DAO Registry](/framework/dao-registry.md), [PluginRepo Registry](/framework/plugin-repo-registry.md), [Registries and ENS names](/framework/registries.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `UUPSUpgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md)
An [ERC-165](https://eips.ethereum.org/EIPS/eip-165)-based registry for contracts.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### entries
```solidity
function entries(address) external view returns (bool)
```
Selector: `0xf29ee125`
The mapping containing the registry entries returning true for registered contract addresses.
### 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.
### targetInterfaceId
```solidity
function targetInterfaceId() external view returns (bytes4)
```
Selector: `0x44162ef8`
The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID that the target contracts being registered must support.
### 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
## 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.
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### ContractAlreadyRegistered
```solidity
error ContractAlreadyRegistered(address registrant)
```
Thrown if the contract is already registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### ContractERC165SupportInvalid
```solidity
error ContractERC165SupportInvalid(address registrant)
```
Thrown if the contract does not support ERC165.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract. |
### ContractInterfaceInvalid
```solidity
error ContractInterfaceInvalid(address registrant)
```
Thrown if the contract does not support the required interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### UPGRADE_REGISTRY_PERMISSION_ID
```solidity
bytes32 public constant UPGRADE_REGISTRY_PERMISSION_ID =
keccak256("UPGRADE_REGISTRY_PERMISSION");
```
Value: `0x60b96ff9fb5f29153c29c1747515b8be4ee523d686cc6f453ec294b0afa72932`
The ID of the permission required to call the `_authorizeUpgrade` function.
# MemberRegistry
**Contract** · [`src/framework/member/MemberRegistry.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/member/MemberRegistry.sol)
**Explained in:** [Member registry](/framework/member-registry.md)
**Author:** Aragon X - 2026
**Inherits:** [`IMemberRegistry`](/abi/osx/IMemberRegistry.md), `UUPSUpgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
Permissionless member self-registration via ENS subdomain claims. Owns the parent
ENS node, manages subdomain lifecycle (claim, release, move), and grants per-node
resolver approval so members can manage their own ENS records natively.
> **Dev:** The ENS registry and resolver are trusted, known mainnet contracts. No reentrancy
> guard is needed — the contract is the sole caller of its own ENS operations.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
> **Dev:** Disallow initializing the implementation contract.
**oz-upgrades-unsafe-allow:** constructor
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### ens
```solidity
function ens() external view returns (ENS)
```
Selector: `0x3f15457f`
The ENS registry contract.
### evict
```solidity
function evict(string subdomain, address newController) external
```
Selector: `0x75e99e1d`
Forcibly evict a subdomain, optionally re-assigning it to a new controller. Governed. Requires EVICT_SUBDOMAIN_PERMISSION_ID on this contract (OSx permission system). If `newController` is the zero address, the subdomain is fully released (records cleared, subnode released). If `newController` is non-zero, the same subdomain is re-assigned to it as if it had called `register` itself: ENS subnode re-created, addr record set to `newController`, per-node resolver approval granted to it. Reverts if the subdomain is unknown, if `newController` already controls it, or if `newController` is already registered with a different subdomain.
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to evict (e.g., "alice"). |
| `newController` | `address` | Address that should control the subdomain after the eviction, or `address(0)` to release without reassignment. |
### initialize
```solidity
function initialize(IDAO _managementDao, ENS _ens, string _domain, address _resolver) external
```
Selector: `0x09c26fb1`
Initializes the registry.
| Parameter | Type | Description |
| --- | --- | --- |
| `_managementDao` | [`IDAO`](/abi/osx/IDAO.md) | The DAO management permissions. |
| `_ens` | `ENS` | The ENS registry contract. |
| `_domain` | `string` | The parent domain this registry manages (e.g., `"members.dao.eth"`). |
| `_resolver` | `address` | The resolver address. Must support per-node `approve()`. |
### isRegistered
```solidity
function isRegistered(address member) external view returns (bool)
```
Selector: `0xc3c5a547`
Returns true if the member has a registered subdomain.
### labelOwner
```solidity
function labelOwner(bytes32) external view returns (address)
```
Selector: `0x23227a56`
Maps a labelhash to the member who owns it. `address(0)` means available.
### memberLabel
```solidity
function memberLabel(address) external view returns (bytes32)
```
Selector: `0x659ef1bf`
Maps a member address to its claimed labelhash. `bytes32(0)` means not registered.
### memberSubdomain
```solidity
function memberSubdomain(address) external view returns (string)
```
Selector: `0xbd51a3b8`
Maps a member address to its claimed subdomain string (for events and display).
### move(string,((string,string)[],address,bytes))
```solidity
function move(string newSubdomain, IMemberRegistry.Records records) external
```
Selector: `0x09b54918`
Move your subdomain and carry over resolver records atomically. Only moves the caller's own subdomain. Reverts if not registered or new label taken.
| Parameter | Type | Description |
| --- | --- | --- |
| `newSubdomain` | `string` | The new subdomain label to claim. |
| `records` | [`IMemberRegistry.Records`](#records) | Resolver records to set on the new subnode (text, addr, contenthash). addr=address(0) keeps the default (msg.sender). Empty contenthash is skipped. |
### move(string)
```solidity
function move(string newSubdomain) external
```
Selector: `0x0bfb0697`
Move your subdomain. Releases the old label and claims the new one atomically. Only moves the caller's own subdomain. Reverts if not registered or new label taken.
| Parameter | Type | Description |
| --- | --- | --- |
| `newSubdomain` | `string` | The new subdomain label to claim. |
### parentDomain
```solidity
function parentDomain() external view returns (string)
```
Selector: `0xaf1a6e3d`
The parent domain string (e.g., `"members.dao.eth"`). Pre-image of `parentNode`.
### parentNode
```solidity
function parentNode() external view returns (bytes32)
```
Selector: `0xf3068a00`
The namehash of the parent domain (e.g., `namehash("members.dao.eth")`).
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### register(string,((string,string)[],address,bytes))
```solidity
function register(string subdomain, IMemberRegistry.Records records) external
```
Selector: `0x24f8bee2`
Register as a member with initial resolver records set atomically. Permissionless. One subdomain per address. Reverts if already registered (release first).
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to claim (e.g., "alice"). |
| `records` | [`IMemberRegistry.Records`](#records) | Resolver records to set on the new subnode (text, addr, contenthash). addr=address(0) defaults to msg.sender. Empty contenthash is skipped. |
### register(string)
```solidity
function register(string subdomain) external
```
Selector: `0xf2c298be`
Register as a member by claiming a subdomain. Permissionless. One subdomain per address. Reverts if already registered (release first).
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to claim (e.g., "alice"). |
### release
```solidity
function release() external
```
Selector: `0x86d1a69f`
Voluntarily release your subdomain. Permissionless. Only releases the caller's own subdomain. Reverts if not registered.
### resolver
```solidity
function resolver() external view returns (address)
```
Selector: `0x04f3bcec`
The resolver address (must support per-node `approve()`).
### 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
## 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.
### ProfileMoved
```solidity
event ProfileMoved(address indexed member, string oldSubdomain, string newSubdomain)
```
Emitted when a member moves their subdomain (release old + claim new).
### Registered
```solidity
event Registered(address indexed member, string subdomain)
```
Emitted when a member registers and claims a subdomain.
### Released
```solidity
event Released(address indexed member, string subdomain)
```
Emitted when a member voluntarily releases their subdomain.
### SubdomainEvicted
```solidity
event SubdomainEvicted(address indexed member, address indexed evictor, string subdomain)
```
Emitted when governance forcibly evicts a member's subdomain.
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### AlreadyRegistered
```solidity
error AlreadyRegistered(address member)
```
Thrown if the member is already registered.
### DaoUnauthorized
```solidity
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. |
### InvalidDomain(string)
```solidity
error InvalidDomain(string domain)
```
Thrown if the parent domain is empty.
### InvalidDomain(string)
```solidity
error InvalidDomain(string domain)
```
Thrown if the parent domain is empty.
### InvalidENSRegistry
```solidity
error InvalidENSRegistry(address ens)
```
Thrown if the ENS registry address is not a valid ENS registry.
### InvalidManagementDao
```solidity
error InvalidManagementDao(address dao)
```
Thrown if the management DAO address is the zero address.
### InvalidNewController
```solidity
error InvalidNewController(address newController)
```
Thrown if the new controller passed to `evict` already controls the subdomain
being evicted (no-op transfer is rejected to surface caller mistakes).
### InvalidResolver
```solidity
error InvalidResolver(address resolver)
```
Thrown if the resolver address has no contract code (zero address or EOA).
### InvalidSubdomain
```solidity
error InvalidSubdomain(string subdomain)
```
Thrown if the subdomain is invalid: shorter than 3 characters, longer than 50,
starts or ends with `-`, or contains characters outside [0-9a-z-].
### NotRegistered
```solidity
error NotRegistered(address member)
```
Thrown if the member is not registered.
### SubdomainAlreadyTaken
```solidity
error SubdomainAlreadyTaken(string subdomain)
```
Thrown if the requested subdomain label is already taken.
### SubdomainNotRegistered
```solidity
error SubdomainNotRegistered(string subdomain)
```
Thrown if the subdomain has no current owner (evict target unknown).
## Constants
_Public, so each is also readable through a generated getter._
### EVICT_SUBDOMAIN_PERMISSION_ID
```solidity
bytes32 public constant EVICT_SUBDOMAIN_PERMISSION_ID = keccak256("EVICT_SUBDOMAIN_PERMISSION");
```
Value: `0x9586822989ef45dd4a50f192e8b5063684aa930288ca589d9882bc9b44d65519`
The ID of the permission required to call `evict`.
### UPGRADE_REGISTRY_PERMISSION_ID
```solidity
bytes32 public constant UPGRADE_REGISTRY_PERMISSION_ID = keccak256("UPGRADE_REGISTRY_PERMISSION");
```
Value: `0x60b96ff9fb5f29153c29c1747515b8be4ee523d686cc6f453ec294b0afa72932`
The ID of the permission required to call `_authorizeUpgrade`.
## Structs
### Records
_Inherited from `IMemberRegistry`._
```solidity
struct Records {
IMemberRegistry.TextRecord[] textRecords;
address addr;
bytes contenthash;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `textRecords` | [`IMemberRegistry.TextRecord[]`](#textrecord) | |
| `addr` | `address` | |
| `contenthash` | `bytes` | |
### TextRecord
_Inherited from `IMemberRegistry`._
```solidity
struct TextRecord {
string key;
string value;
}
```
# MetadataExtension
**Abstract contract** · [`src/common/utils/metadata/MetadataExtension.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/metadata/MetadataExtension.sol)
**Explained in:** [Plugin metadata](/framework/plugin-metadata.md)
**Author:** Aragon X - 2024
**Inherits:** `ERC165`, [`DaoAuthorizable`](/abi/osx/DaoAuthorizable.md)
An abstract, non upgradeable contract for managing and retrieving metadata associated with a plugin.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### getMetadata
```solidity
function getMetadata() external view returns (bytes)
```
Selector: `0x7a5b4f59`
Returns the metadata currently applied.
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `0xee57e36f`
Allows to set the metadata.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The plugin specific information encoded in bytes. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### MetadataSet
```solidity
event MetadataSet(bytes metadata)
```
Emitted when metadata is set.
## Errors
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_METADATA_PERMISSION_ID
```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.
# MetadataExtensionUpgradeable
**Abstract contract** · [`src/common/utils/metadata/MetadataExtensionUpgradeable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/metadata/MetadataExtensionUpgradeable.sol)
**Author:** Aragon X - 2024
**Inherits:** `ERC165Upgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md)
An abstract, upgradeable contract for managing and retrieving metadata associated with a plugin.
> **Dev:** Due to the requirements that already existing upgradeable plugins need to start inheritting from this,
> we're required to use hardcoded/specific slots for storage instead of sequential slots with gaps.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### getMetadata
```solidity
function getMetadata() external view returns (bytes)
```
Selector: `0x7a5b4f59`
Returns the metadata currently applied.
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `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. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### 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.
## Errors
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_METADATA_PERMISSION_ID
```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.
## Structs
### MetadataExtensionStorage
```solidity
struct MetadataExtensionStorage {
bytes metadata;
}
```
# PermissionCondition
**Abstract contract** · [`src/common/permission/condition/PermissionCondition.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/condition/PermissionCondition.sol)
**Explained in:** [Manage permissions through governance](/guides/manage-permissions.md), [Permission conditions](/common/permission-conditions.md)
**Author:** Aragon X - 2023
**Inherits:** `ERC165`, [`IPermissionCondition`](/abi/osx/IPermissionCondition.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract contract for non-upgradeable contracts instantiated via the `new` keyword to inherit from to support customary permissions depending on arbitrary onchain state.
**security-contact:** sirt@aragon.org
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
# PermissionConditionUpgradeable
**Abstract contract** · [`src/common/permission/condition/PermissionConditionUpgradeable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/condition/PermissionConditionUpgradeable.sol)
**Explained in:** [Permission conditions](/common/permission-conditions.md)
**Author:** Aragon X - 2023
**Inherits:** `ERC165Upgradeable`, [`IPermissionCondition`](/abi/osx/IPermissionCondition.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract contract for upgradeable or cloneable contracts to inherit from and to support customary permissions depending on arbitrary onchain state.
**security-contact:** sirt@aragon.org
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
# PermissionManager
**Abstract contract** · [`src/core/permission/PermissionManager.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/core/permission/PermissionManager.sol)
**Explained in:** [Manage permissions through governance](/guides/manage-permissions.md), [The permission system](/core/permissions.md)
**Author:** Aragon X - 2021-2023
**Inherits:** `Initializable`
The abstract permission manager used in a DAO, its associated plugins, and other framework-related components.
**security-contact:** sirt@aragon.org
## Functions
### applyMultiTargetPermissions
```solidity
function applyMultiTargetPermissions(PermissionLib.MultiTargetPermission[] _items) external
```
Selector: `0xe978afe5`
Applies an array of permission operations on multiple target contracts `items[i].where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_items` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to apply. |
### applySingleTargetPermissions
```solidity
function applySingleTargetPermissions(
address _where,
PermissionLib.SingleTargetPermission[] items
) external
```
Selector: `0x22844d04`
Applies an array of permission operations on a single target contracts `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the single target contract. |
| `items` | `PermissionLib.SingleTargetPermission[]` | The array of single-targeted permission operations to apply. |
### grant
```solidity
function grant(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd68bad2c`
Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
### grantWithCondition
```solidity
function grantWithCondition(
address _where,
address _who,
bytes32 _permissionId,
IPermissionCondition _condition
) external
```
Selector: `0xc9dbc2a4`
Grants permission to an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier if the referenced condition permits it.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier. |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if the caller address has permission on the target contract via a permission identifier and relays the answer to a condition contract if this was declared during the granting process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) for which the permission is checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data to be passed to the set `PermissionCondition`. |
### revoke
```solidity
function revoke(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd96054c4`
Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` loses permission. |
| `_who` | `address` | The address (EOA or contract) losing the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
## Events
### Granted
```solidity
event Granted(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who,
address condition
)
```
Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is granted. |
| `where` | `address` | The address of the target contract for which `_who` receives permission. |
| `who` | `address` | The address (EOA or contract) receiving the permission. |
| `condition` | `address` | The address `ALLOW_FLAG` for regular permissions or, alternatively, the `IPermissionCondition` contract implementation to be used. |
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### Revoked
```solidity
event Revoked(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who
)
```
Emitted when a permission `permission` is revoked in the context `here` from the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is revoked. |
| `where` | `address` | The address of the target contract for which `_who` loses permission. |
| `who` | `address` | The address (EOA or contract) losing the permission. |
## Errors
### AnyAddressDisallowedForWhoAndWhere
```solidity
error AnyAddressDisallowedForWhoAndWhere()
```
Thrown for permission grants where `who` and `where` are both `ANY_ADDR`.
### ConditionInterfaceNotSupported
```solidity
error ConditionInterfaceNotSupported(IPermissionCondition condition)
```
Thrown if a condition contract does not support the `IPermissionCondition` interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### ConditionNotAContract
```solidity
error ConditionNotAContract(IPermissionCondition condition)
```
Thrown if a condition address is not a contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### GrantWithConditionNotSupported
```solidity
error GrantWithConditionNotSupported()
```
Thrown if `Operation.GrantWithCondition` is requested as an operation but the method does not support it.
### PermissionAlreadyGrantedForDifferentCondition
```solidity
error PermissionAlreadyGrantedForDifferentCondition(
address where,
address who,
bytes32 permissionId,
address currentCondition,
address newCondition
)
```
Thrown if a permission has been already granted with a different condition.
> **Dev:** This makes sure that condition on the same permission can not be overwriten by a different condition.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The address of the target contract to grant `_who` permission to. |
| `who` | `address` | The address (EOA or contract) to which the permission has already been granted. |
| `permissionId` | `bytes32` | The permission identifier. |
| `currentCondition` | `address` | The current condition set for permissionId. |
| `newCondition` | `address` | The new condition it tries to set for permissionId. |
### PermissionsForAnyAddressDisallowed
```solidity
error PermissionsForAnyAddressDisallowed()
```
Thrown for `ROOT_PERMISSION_ID` or `EXECUTE_PERMISSION_ID` permission grants where `who` or `where` is `ANY_ADDR`.
### Unauthorized
```solidity
error Unauthorized(address where, address who, bytes32 permissionId)
```
Thrown if a call is unauthorized.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The context in which the authorization reverted. |
| `who` | `address` | The address (EOA or contract) missing the permission. |
| `permissionId` | `bytes32` | The permission identifier. |
## Constants
_Public, so each is also readable through a generated getter._
### ROOT_PERMISSION_ID
```solidity
bytes32 public constant ROOT_PERMISSION_ID = keccak256("ROOT_PERMISSION");
```
Value: `0x815fe80e4b37c8582a3b773d1d7071f983eacfd56b5965db654f3087c25ada33`
The ID of the permission required to call the `grant`, `grantWithCondition`, `revoke`, and `bulk` function.
# PlaceholderSetup
**Contract** · [`src/framework/plugin/repo/placeholder/PlaceholderSetup.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/repo/placeholder/PlaceholderSetup.sol)
**Author:** Aragon X - 2023
**Inherits:** [`PluginSetup`](/abi/osx/PluginSetup.md)
A placeholder setup contract for outdated plugin builds. When moving plugin repos to new chains or layers, where only the latest release and build should be available, this placeholder can be used to populate previous builds.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address,
bytes
) external pure returns (address, IPluginSetup.PreparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address,
IPluginSetup.SetupPayload
) external pure returns (PermissionLib.MultiTargetPermission[])
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | |
| `[1]` | [`IPluginSetup.SetupPayload`](#setuppayload) | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes, IPluginSetup.PreparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Since the underlying plugin is non-upgradeable, this non-virtual function must always revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### NonUpgradeablePlugin
```solidity
error NonUpgradeablePlugin()
```
Thrown when attempting to prepare an update on a non-upgradeable plugin.
### PlaceholderSetupCannotBeUsed
```solidity
error PlaceholderSetupCannotBeUsed()
```
Thrown if the dummy is used.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
# Plugin
**Abstract contract** · [`src/common/plugin/Plugin.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/Plugin.sol)
**Explained in:** [Choosing a plugin base](/framework/plugin-types.md), [The plugin model](/framework/plugins.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IPlugin`](/abi/osx/IPlugin.md), `ERC165`, [`DaoAuthorizable`](/abi/osx/DaoAuthorizable.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract, non-upgradeable contract to inherit from when creating a plugin being deployed via the `new` keyword.
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#plugintype) | |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target Config containing the address and operation type. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
## Errors
### DaoUnauthorized
```solidity
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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_TARGET_CONFIG_PERMISSION_ID
```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.
## Enums
### Operation
_Inherited from `IPlugin`._
```solidity
enum Operation {
Call,
DelegateCall
}
```
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### TargetConfig
_Inherited from `IPlugin`._
```solidity
struct TargetConfig {
address target;
IPlugin.Operation operation;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | |
| `operation` | [`IPlugin.Operation`](#operation) | |
# PluginCloneable
**Abstract contract** · [`src/common/plugin/PluginCloneable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/PluginCloneable.sol)
**Explained in:** [Choosing a plugin base](/framework/plugin-types.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IPlugin`](/abi/osx/IPlugin.md), `ERC165Upgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract, non-upgradeable contract to inherit from when creating a plugin being deployed via the minimal clones pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)).
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#plugintype) | |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
## Errors
### DaoUnauthorized
```solidity
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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_TARGET_CONFIG_PERMISSION_ID
```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.
## Enums
### Operation
_Inherited from `IPlugin`._
```solidity
enum Operation {
Call,
DelegateCall
}
```
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### TargetConfig
_Inherited from `IPlugin`._
```solidity
struct TargetConfig {
address target;
IPlugin.Operation operation;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | |
| `operation` | [`IPlugin.Operation`](#operation) | |
# PluginRepo
**Contract** · [`src/framework/plugin/repo/PluginRepo.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/repo/PluginRepo.sol)
**Explained in:** [PluginRepo (versioning & publishing)](/framework/plugin-repo.md), [Publish a plugin to a PluginRepo](/guides/publish-a-plugin.md)
**Author:** Aragon X - 2020 - 2023
**Inherits:** `Initializable`, `ERC165Upgradeable`, [`IPluginRepo`](/abi/osx/IPluginRepo.md), `UUPSUpgradeable`, [`ProtocolVersion`](/abi/osx/ProtocolVersion.md), [`PermissionManager`](/abi/osx/PermissionManager.md)
The plugin repository contract required for managing and publishing different plugin versions within the Aragon DAO framework.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
> **Dev:** Used to disallow initializing the implementation contract by an attacker for extra safety.
## Functions
### applyMultiTargetPermissions
```solidity
function applyMultiTargetPermissions(PermissionLib.MultiTargetPermission[] _items) external
```
Selector: `0xe978afe5`
Applies an array of permission operations on multiple target contracts `items[i].where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_items` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to apply. |
### applySingleTargetPermissions
```solidity
function applySingleTargetPermissions(
address _where,
PermissionLib.SingleTargetPermission[] items
) external
```
Selector: `0x22844d04`
Applies an array of permission operations on a single target contracts `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the single target contract. |
| `items` | `PermissionLib.SingleTargetPermission[]` | The array of single-targeted permission operations to apply. |
### buildCount
```solidity
function buildCount(uint8 _release) external view returns (uint256)
```
Selector: `0xdf1d6c44`
Gets the total number of builds for a given release number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
### createVersion
```solidity
function createVersion(
uint8 _release,
address _pluginSetup,
bytes _buildMetadata,
bytes _releaseMetadata
) external
```
Selector: `0xfc054427`
Creates a new plugin version as the latest build for an existing release number or the first build for a new release number for the provided `PluginSetup` contract address and metadata.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
| `_pluginSetup` | `address` | |
| `_buildMetadata` | `bytes` | The build metadata URI. |
| `_releaseMetadata` | `bytes` | The release metadata URI. |
### getLatestVersion(address)
```solidity
function getLatestVersion(address _pluginSetup) external view returns (PluginRepo.Version)
```
Selector: `0x50abe910`
Returns the latest version for a given plugin setup.
| Parameter | Type | Description |
| --- | --- | --- |
| `_pluginSetup` | `address` | The plugin setup address |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepo.Version`](#version) | |
### getLatestVersion(uint8)
```solidity
function getLatestVersion(uint8 _release) external view returns (PluginRepo.Version)
```
Selector: `0xe0589bd3`
Returns the latest version for a given release number.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepo.Version`](#version) | |
### getVersion((uint8,uint16))
```solidity
function getVersion(PluginRepo.Tag _tag) external view returns (PluginRepo.Version)
```
Selector: `0x9af3e909`
Returns the version associated with a tag.
| Parameter | Type | Description |
| --- | --- | --- |
| `_tag` | [`PluginRepo.Tag`](#tag) | The version tag. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepo.Version`](#version) | |
### getVersion(bytes32)
```solidity
function getVersion(bytes32 _tagHash) external view returns (PluginRepo.Version)
```
Selector: `0x9aaf9f08`
Returns the version for a tag hash.
| Parameter | Type | Description |
| --- | --- | --- |
| `_tagHash` | `bytes32` | The tag hash. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepo.Version`](#version) | |
### grant
```solidity
function grant(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd68bad2c`
Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
### grantWithCondition
```solidity
function grantWithCondition(
address _where,
address _who,
bytes32 _permissionId,
IPermissionCondition _condition
) external
```
Selector: `0xc9dbc2a4`
Grants permission to an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier if the referenced condition permits it.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission
> Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) receiving the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier. |
### initialize
```solidity
function initialize(address initialOwner) external
```
Selector: `0xc4d66de8`
Initializes the contract by
- initializing the permission manager
- granting the `MAINTAINER_PERMISSION_ID` permission to the initial owner.
> **Dev:** This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
### initializeFrom
```solidity
function initializeFrom(uint8[3] _previousProtocolVersion, bytes _initData) external
```
Selector: `0x42d8e99e`
Initializes the pluginRepo after an upgrade from a previous protocol version.
> **Dev:** This function is a placeholder until we require reinitialization.
| Parameter | Type | Description |
| --- | --- | --- |
| `_previousProtocolVersion` | `uint8[3]` | The semantic protocol version number of the previous DAO implementation contract this upgrade is transitioning from. |
| `_initData` | `bytes` | The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)). |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if the caller address has permission on the target contract via a permission identifier and relays the answer to a condition contract if this was declared during the granting process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` receives permission. |
| `_who` | `address` | The address (EOA or contract) for which the permission is checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data to be passed to the set `PermissionCondition`. |
### latestRelease
```solidity
function latestRelease() external view returns (uint8)
```
Selector: `0x7be0ca5e`
The ID of the latest release.
> **Dev:** The maximum release number is 255.
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### revoke
```solidity
function revoke(address _where, address _who, bytes32 _permissionId) external
```
Selector: `0xd96054c4`
Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.
> **Dev:** Requires the `ROOT_PERMISSION_ID` permission.
> Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that exist in parallel.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract for which `_who` loses permission. |
| `_who` | `address` | The address (EOA or contract) losing the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### updateReleaseMetadata
```solidity
function updateReleaseMetadata(uint8 _release, bytes _releaseMetadata) external
```
Selector: `0x28375f67`
Updates the metadata for release with content `@fromHex(_releaseMetadata)`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
| `_releaseMetadata` | `bytes` | The release metadata URI. |
### 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
## 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.
### Granted
```solidity
event Granted(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who,
address condition
)
```
Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is granted. |
| `where` | `address` | The address of the target contract for which `_who` receives permission. |
| `who` | `address` | The address (EOA or contract) receiving the permission. |
| `condition` | `address` | The address `ALLOW_FLAG` for regular permissions or, alternatively, the `IPermissionCondition` contract implementation to be used. |
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### ReleaseMetadataUpdated
```solidity
event ReleaseMetadataUpdated(uint8 release, bytes releaseMetadata)
```
Emitted when a release's metadata was updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `release` | `uint8` | The release number. |
| `releaseMetadata` | `bytes` | The release metadata URI. |
### Revoked
```solidity
event Revoked(
bytes32 indexed permissionId,
address indexed here,
address where,
address indexed who
)
```
Emitted when a permission `permission` is revoked in the context `here` from the address `_who` for the contract `_where`.
| Parameter | Type | Description |
| --- | --- | --- |
| `permissionId` | `bytes32` | The permission identifier. |
| `here` | `address` | The address of the context in which the permission is revoked. |
| `where` | `address` | The address of the target contract for which `_who` loses permission. |
| `who` | `address` | The address (EOA or contract) losing the permission. |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
### VersionCreated
```solidity
event VersionCreated(
uint8 release,
uint16 build,
address indexed pluginSetup,
bytes buildMetadata
)
```
Emitted if the same plugin setup exists in previous releases.
| Parameter | Type | Description |
| --- | --- | --- |
| `release` | `uint8` | The release number. |
| `build` | `uint16` | The build number. |
| `pluginSetup` | `address` | The address of the plugin setup contract. |
| `buildMetadata` | `bytes` | The build metadata URI. |
## Errors
### AnyAddressDisallowedForWhoAndWhere
```solidity
error AnyAddressDisallowedForWhoAndWhere()
```
Thrown for permission grants where `who` and `where` are both `ANY_ADDR`.
### ConditionInterfaceNotSupported
```solidity
error ConditionInterfaceNotSupported(IPermissionCondition condition)
```
Thrown if a condition contract does not support the `IPermissionCondition` interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### ConditionNotAContract
```solidity
error ConditionNotAContract(IPermissionCondition condition)
```
Thrown if a condition address is not a contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `condition` | [`IPermissionCondition`](/abi/osx/IPermissionCondition.md) | The address that is not a contract. |
### EmptyReleaseMetadata
```solidity
error EmptyReleaseMetadata()
```
Thrown if the metadata URI is empty.
### GrantWithConditionNotSupported
```solidity
error GrantWithConditionNotSupported()
```
Thrown if `Operation.GrantWithCondition` is requested as an operation but the method does not support it.
### InvalidPluginSetupInterface
```solidity
error InvalidPluginSetupInterface()
```
Thrown if a plugin setup contract does not inherit from `PluginSetup`.
### InvalidReleaseIncrement
```solidity
error InvalidReleaseIncrement(uint8 latestRelease, uint8 newRelease)
```
Thrown if a release number is incremented by more than one.
| Parameter | Type | Description |
| --- | --- | --- |
| `latestRelease` | `uint8` | The latest release number. |
| `newRelease` | `uint8` | The new release number. |
### PermissionAlreadyGrantedForDifferentCondition
```solidity
error PermissionAlreadyGrantedForDifferentCondition(
address where,
address who,
bytes32 permissionId,
address currentCondition,
address newCondition
)
```
Thrown if a permission has been already granted with a different condition.
> **Dev:** This makes sure that condition on the same permission can not be overwriten by a different condition.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The address of the target contract to grant `_who` permission to. |
| `who` | `address` | The address (EOA or contract) to which the permission has already been granted. |
| `permissionId` | `bytes32` | The permission identifier. |
| `currentCondition` | `address` | The current condition set for permissionId. |
| `newCondition` | `address` | The new condition it tries to set for permissionId. |
### PermissionsForAnyAddressDisallowed
```solidity
error PermissionsForAnyAddressDisallowed()
```
Thrown for `ROOT_PERMISSION_ID` or `EXECUTE_PERMISSION_ID` permission grants where `who` or `where` is `ANY_ADDR`.
### PluginSetupAlreadyInPreviousRelease
```solidity
error PluginSetupAlreadyInPreviousRelease(uint8 release, uint16 build, address pluginSetup)
```
Thrown if the same plugin setup contract exists already in a previous releases.
| Parameter | Type | Description |
| --- | --- | --- |
| `release` | `uint8` | The release number of the already existing plugin setup. |
| `build` | `uint16` | The build number of the already existing plugin setup. |
| `pluginSetup` | `address` | The plugin setup contract address. |
### ReleaseDoesNotExist
```solidity
error ReleaseDoesNotExist()
```
Thrown if release does not exist.
### ReleaseZeroNotAllowed
```solidity
error ReleaseZeroNotAllowed()
```
Thrown if a release number is zero.
### Unauthorized
```solidity
error Unauthorized(address where, address who, bytes32 permissionId)
```
Thrown if a call is unauthorized.
| Parameter | Type | Description |
| --- | --- | --- |
| `where` | `address` | The context in which the authorization reverted. |
| `who` | `address` | The address (EOA or contract) missing the permission. |
| `permissionId` | `bytes32` | The permission identifier. |
### VersionHashDoesNotExist
```solidity
error VersionHashDoesNotExist(bytes32 versionHash)
```
Thrown if a version does not exist.
| Parameter | Type | Description |
| --- | --- | --- |
| `versionHash` | `bytes32` | The tag hash. |
## Constants
_Public, so each is also readable through a generated getter._
### MAINTAINER_PERMISSION_ID
```solidity
bytes32 public constant MAINTAINER_PERMISSION_ID = keccak256("MAINTAINER_PERMISSION");
```
Value: `0xa0885006fe6672eeafd1deca6c67bcdc6dd79cfe2b157a98539ddf73cd8c04ea`
The ID of the permission required to call the `createVersion` function.
### ROOT_PERMISSION_ID
_Inherited from `PermissionManager`._
```solidity
bytes32 public constant ROOT_PERMISSION_ID = keccak256("ROOT_PERMISSION");
```
Value: `0x815fe80e4b37c8582a3b773d1d7071f983eacfd56b5965db654f3087c25ada33`
The ID of the permission required to call the `grant`, `grantWithCondition`, `revoke`, and `bulk` function.
### UPGRADE_REPO_PERMISSION_ID
```solidity
bytes32 public constant UPGRADE_REPO_PERMISSION_ID = keccak256("UPGRADE_REPO_PERMISSION");
```
Value: `0x5aa4f06bdc18535eff05128093a2315c2c960a2722e20021cbff28da04760f5b`
The ID of the permission required to call the `createVersion` function.
## Structs
### Tag
```solidity
struct Tag {
uint8 release;
uint16 build;
}
```
### Version
```solidity
struct Version {
PluginRepo.Tag tag;
address pluginSetup;
bytes buildMetadata;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `tag` | [`PluginRepo.Tag`](#tag) | |
| `pluginSetup` | `address` | |
| `buildMetadata` | `bytes` | |
# PluginRepoFactory
**Contract** · [`src/framework/plugin/repo/PluginRepoFactory.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/repo/PluginRepoFactory.sol)
**Explained in:** [PluginRepo (versioning & publishing)](/framework/plugin-repo.md), [Publish a plugin to a PluginRepo](/guides/publish-a-plugin.md)
**Author:** Aragon X - 2022-2023
**Inherits:** `ERC165`, [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract creates `PluginRepo` proxies and registers them on a `PluginRepoRegistry` contract.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(PluginRepoRegistry _pluginRepoRegistry)
```
Initializes the addresses of the Aragon plugin registry and `PluginRepo` base contract to proxy to.
| Parameter | Type | Description |
| --- | --- | --- |
| `_pluginRepoRegistry` | [`PluginRepoRegistry`](/abi/osx/PluginRepoRegistry.md) | The aragon plugin registry address. |
## Functions
### createPluginRepo
```solidity
function createPluginRepo(
string _subdomain,
address _initialOwner
) external returns (PluginRepo)
```
Selector: `0x49b19d08`
Creates a plugin repository proxy pointing to the `pluginRepoBase` implementation and registers it in the Aragon plugin registry.
| Parameter | Type | Description |
| --- | --- | --- |
| `_subdomain` | `string` | The plugin repository subdomain. |
| `_initialOwner` | `address` | The plugin maintainer address. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepo`](/abi/osx/PluginRepo.md) | |
### createPluginRepoWithFirstVersion
```solidity
function createPluginRepoWithFirstVersion(
string _subdomain,
address _pluginSetup,
address _maintainer,
bytes _releaseMetadata,
bytes _buildMetadata
) external returns (PluginRepo pluginRepo)
```
Selector: `0x7bd3e8ac`
Creates and registers a `PluginRepo` with an ENS subdomain and publishes an initial version `1.1`.
> **Dev:** After the creation of the `PluginRepo` and release of the first version by the factory, ownership is transferred to the `_maintainer` address.
| Parameter | Type | Description |
| --- | --- | --- |
| `_subdomain` | `string` | The plugin repository subdomain. |
| `_pluginSetup` | `address` | The plugin factory contract associated with the plugin version. |
| `_maintainer` | `address` | The maintainer of the plugin repo. This address has permission to update metadata, upgrade the repo logic, and manage the repo permissions. |
| `_releaseMetadata` | `bytes` | The release metadata URI. |
| `_buildMetadata` | `bytes` | The build metadata URI. |
| Returns | Type | Description |
| --- | --- | --- |
| `pluginRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | |
### pluginRepoBase
```solidity
function pluginRepoBase() external view returns (address)
```
Selector: `0xd222cb1e`
The address of the `PluginRepo` base contract to proxy to..
### pluginRepoRegistry
```solidity
function pluginRepoRegistry() external view returns (PluginRepoRegistry)
```
Selector: `0x0b36f03c`
The Aragon plugin registry contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepoRegistry`](/abi/osx/PluginRepoRegistry.md) | |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
# PluginRepoRegistry
**Contract** · [`src/framework/plugin/repo/PluginRepoRegistry.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/repo/PluginRepoRegistry.sol)
**Explained in:** [PluginRepo Registry](/framework/plugin-repo-registry.md), [Registries and ENS names](/framework/registries.md)
**Author:** Aragon X - 2022-2023
**Inherits:** [`InterfaceBasedRegistry`](/abi/osx/InterfaceBasedRegistry.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract maintains an address-based registry of plugin repositories in the Aragon App DAO framework.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor()
```
> **Dev:** Used to disallow initializing the implementation contract by an attacker for extra safety.
**oz-upgrades-unsafe-allow:** constructor
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### entries
```solidity
function entries(address) external view returns (bool)
```
Selector: `0xf29ee125`
The mapping containing the registry entries returning true for registered contract addresses.
### initialize
```solidity
function initialize(IDAO _dao, ENSSubdomainRegistrar _subdomainRegistrar) external
```
Selector: `0x485cc955`
Initializes the contract by setting calling the `InterfaceBasedRegistry` base class initialize method.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | [`IDAO`](/abi/osx/IDAO.md) | The address of the managing DAO. |
| `_subdomainRegistrar` | [`ENSSubdomainRegistrar`](/abi/osx/ENSSubdomainRegistrar.md) | The `ENSSubdomainRegistrar` where `ENS` subdomain will be registered. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### registerPluginRepo
```solidity
function registerPluginRepo(string subdomain, address pluginRepo) external
```
Selector: `0xfdb9df55`
Registers a plugin repository with a subdomain and address.
> **Dev:** If subdomain is empty, registration on ENS is skipped.
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain of the PluginRepo. |
| `pluginRepo` | `address` | The address of the PluginRepo contract. |
### subdomainRegistrar
```solidity
function subdomainRegistrar() external view returns (ENSSubdomainRegistrar)
```
Selector: `0x00077393`
The ENS subdomain registrar registering the PluginRepo subdomains.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ENSSubdomainRegistrar`](/abi/osx/ENSSubdomainRegistrar.md) | |
### targetInterfaceId
```solidity
function targetInterfaceId() external view returns (bytes4)
```
Selector: `0x44162ef8`
The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID that the target contracts being registered must support.
### 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
## 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.
### PluginRepoRegistered
```solidity
event PluginRepoRegistered(string subdomain, address pluginRepo)
```
Emitted if a new plugin repository is registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain of the plugin repository. |
| `pluginRepo` | `address` | The address of the plugin repository. |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### ContractAlreadyRegistered
```solidity
error ContractAlreadyRegistered(address registrant)
```
Thrown if the contract is already registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### ContractERC165SupportInvalid
```solidity
error ContractERC165SupportInvalid(address registrant)
```
Thrown if the contract does not support ERC165.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract. |
### ContractInterfaceInvalid
```solidity
error ContractInterfaceInvalid(address registrant)
```
Thrown if the contract does not support the required interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `registrant` | `address` | The address of the contract to be registered. |
### DaoUnauthorized
```solidity
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. |
### ENSNotSupported
```solidity
error ENSNotSupported()
```
Thrown if the subdomain is present, but registrar is address(0).
### InvalidPluginSubdomain
```solidity
error InvalidPluginSubdomain(string subdomain)
```
Thrown if the plugin subdomain doesn't match the regex `[0-9a-z\-]`
## Constants
_Public, so each is also readable through a generated getter._
### REGISTER_PLUGIN_REPO_PERMISSION_ID
```solidity
bytes32 public constant REGISTER_PLUGIN_REPO_PERMISSION_ID =
keccak256("REGISTER_PLUGIN_REPO_PERMISSION");
```
Value: `0x055973dfb6d3b3cd890dde3a801f5427fa973864752b6d2a1ae61cbd5ae5dc09`
The ID of the permission required to call the `register` function.
### UPGRADE_REGISTRY_PERMISSION_ID
_Inherited from `InterfaceBasedRegistry`._
```solidity
bytes32 public constant UPGRADE_REGISTRY_PERMISSION_ID =
keccak256("UPGRADE_REGISTRY_PERMISSION");
```
Value: `0x60b96ff9fb5f29153c29c1747515b8be4ee523d686cc6f453ec294b0afa72932`
The ID of the permission required to call the `_authorizeUpgrade` function.
# PluginSetup
**Abstract contract** · [`src/common/plugin/setup/PluginSetup.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/setup/PluginSetup.sol)
**Explained in:** [Plugin setup](/framework/plugin-setup.md)
**Author:** Aragon X - 2022-2024
**Inherits:** `ERC165`, [`IPluginSetup`](/abi/osx/IPluginSetup.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract contract to inherit from to implement the plugin setup for non-upgradeable plugins, i.e,
- `Plugin` being deployed via the `new` keyword
- `PluginCloneable` being deployed via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)).
**security-contact:** sirt@aragon.org
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes, IPluginSetup.PreparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Since the underlying plugin is non-upgradeable, this non-virtual function must always revert.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `[1]` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### NonUpgradeablePlugin
```solidity
error NonUpgradeablePlugin()
```
Thrown when attempting to prepare an update on a non-upgradeable plugin.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
# PluginSetupProcessor
**Contract** · [`src/framework/plugin/setup/PluginSetupProcessor.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessor.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
**Author:** Aragon X - 2022-2023
**Inherits:** [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
This contract processes the preparation and application of plugin setups (installation, update, uninstallation) on behalf of a requesting DAO.
> **Dev:** This contract is temporarily granted the `ROOT_PERMISSION_ID` permission on the applying DAO and therefore is highly security critical.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(PluginRepoRegistry _repoRegistry)
```
Constructs the plugin setup processor by setting the associated plugin repo registry.
| Parameter | Type | Description |
| --- | --- | --- |
| `_repoRegistry` | [`PluginRepoRegistry`](/abi/osx/PluginRepoRegistry.md) | The plugin repo registry contract. |
## Functions
### applyInstallation
```solidity
function applyInstallation(
address _dao,
PluginSetupProcessor.ApplyInstallationParams _params
) external
```
Selector: `0xfe6c3474`
Applies the permissions of a prepared installation to a DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_params` | [`PluginSetupProcessor.ApplyInstallationParams`](#applyinstallationparams) | The struct containing the parameters for the `applyInstallation` function. |
### applyUninstallation
```solidity
function applyUninstallation(
address _dao,
PluginSetupProcessor.ApplyUninstallationParams _params
) external
```
Selector: `0x851d11f8`
Applies the permissions of a prepared uninstallation to a DAO.
> **Dev:** The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happened) on which the uninstallation was prepared for.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_params` | [`PluginSetupProcessor.ApplyUninstallationParams`](#applyuninstallationparams) | The struct containing the parameters for the `applyUninstallation` function. |
### applyUpdate
```solidity
function applyUpdate(address _dao, PluginSetupProcessor.ApplyUpdateParams _params) external
```
Selector: `0x22e12c63`
Applies the permissions of a prepared update of an UUPS upgradeable proxy contract to a DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_params` | [`PluginSetupProcessor.ApplyUpdateParams`](#applyupdateparams) | The struct containing the parameters for the `applyUpdate` function. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
PluginSetupProcessor.PrepareInstallationParams _params
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0x3c8c01d1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_params` | [`PluginSetupProcessor.PrepareInstallationParams`](#prepareinstallationparams) | The struct containing the parameters for the `prepareInstallation` function. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The prepared plugin contract address. |
| `preparedSetupData` | `IPluginSetup.PreparedSetupData` | The data struct containing the array of helper contracts and permissions that the setup has prepared. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
PluginSetupProcessor.PrepareUninstallationParams _params
) external returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x2fb04336`
Prepares the uninstallation of a plugin.
> **Dev:** The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happened) on which the uninstallation was prepared for.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_params` | [`PluginSetupProcessor.PrepareUninstallationParams`](#prepareuninstallationparams) | The struct containing the parameters for the `prepareUninstallation` function. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The list of multi-targeted permission operations to be applied to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
PluginSetupProcessor.PrepareUpdateParams _params
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xd7598122`
Prepares the update of an UUPS upgradeable plugin.
> **Dev:** The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happened) on which the update is prepared for.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the DAO For which preparation of update happens. |
| `_params` | [`PluginSetupProcessor.PrepareUpdateParams`](#prepareupdateparams) | The struct containing the parameters for the `prepareUpdate` function. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied |
| `preparedSetupData` | `IPluginSetup.PreparedSetupData` | The data struct containing the array of helper contracts and permissions that the setup has prepared. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### repoRegistry
```solidity
function repoRegistry() external view returns (PluginRepoRegistry)
```
Selector: `0x483d209e`
The plugin repo registry listing the `PluginRepo` contracts versioning the `PluginSetup` contracts.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`PluginRepoRegistry`](/abi/osx/PluginRepoRegistry.md) | |
### states
```solidity
function states(
bytes32
) external view returns (uint256 blockNumber, bytes32 currentAppliedSetupId)
```
Selector: `0xfbdc1ef1`
A mapping between the plugin installation ID (obtained from the DAO and plugin address) and the plugin state information.
> **Dev:** This variable is public on purpose to allow future versions to access and migrate the storage.
### validatePreparedSetupId
```solidity
function validatePreparedSetupId(
bytes32 pluginInstallationId,
bytes32 preparedSetupId
) external view
```
Selector: `0xfafc79da`
Validates that a setup ID can be applied for `applyInstallation`, `applyUpdate`, or `applyUninstallation`.
> **Dev:** If the block number stored in `states[pluginInstallationId].blockNumber` exceeds the one stored in `pluginState.preparedSetupIdToBlockNumber[preparedSetupId]`, the prepared setup with `preparedSetupId` is outdated and not applicable anymore.
| Parameter | Type | Description |
| --- | --- | --- |
| `pluginInstallationId` | `bytes32` | The plugin installation ID obtained from the hash of `abi.encode(daoAddress, pluginAddress)`. |
| `preparedSetupId` | `bytes32` | The prepared setup ID to be validated. |
## Events
### InstallationApplied
```solidity
event InstallationApplied(
address indexed dao,
address indexed plugin,
bytes32 preparedSetupId,
bytes32 appliedSetupId
)
```
Emitted after a plugin installation was applied.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `plugin` | `address` | The address of the plugin contract. |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
| `appliedSetupId` | `bytes32` | The applied setup ID. |
### InstallationPrepared
```solidity
event InstallationPrepared(
address indexed sender,
address indexed dao,
bytes32 preparedSetupId,
PluginRepo indexed pluginSetupRepo,
PluginRepo.Tag versionTag,
bytes data,
address plugin,
IPluginSetup.PreparedSetupData preparedSetupData
)
```
Emitted with a prepared plugin installation to store data relevant for the application step.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The sender that prepared the plugin installation. |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `preparedSetupId` | `bytes32` | The prepared setup ID obtained from the supplied data. |
| `pluginSetupRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | The repository storing the `PluginSetup` contracts of all versions of a plugin. |
| `versionTag` | `PluginRepo.Tag` | The version tag of the plugin setup of the prepared installation. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation as specified in the corresponding ABI on the version's metadata. |
| `plugin` | `address` | The address of the plugin contract. |
| `preparedSetupData` | `IPluginSetup.PreparedSetupData` | The deployed plugin's relevant data which consists of helpers and permissions. |
### UninstallationApplied
```solidity
event UninstallationApplied(
address indexed dao,
address indexed plugin,
bytes32 preparedSetupId
)
```
Emitted after a plugin installation was applied.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `plugin` | `address` | The address of the plugin contract. |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
### UninstallationPrepared
```solidity
event UninstallationPrepared(
address indexed sender,
address indexed dao,
bytes32 preparedSetupId,
PluginRepo indexed pluginSetupRepo,
PluginRepo.Tag versionTag,
IPluginSetup.SetupPayload setupPayload,
PermissionLib.MultiTargetPermission[] permissions
)
```
Emitted with a prepared plugin uninstallation to store data relevant for the application step.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The sender that prepared the plugin uninstallation. |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
| `pluginSetupRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | The repository storing the `PluginSetup` contracts of all versions of a plugin. |
| `versionTag` | `PluginRepo.Tag` | The version tag of the plugin to used for install preparation. |
| `setupPayload` | `IPluginSetup.SetupPayload` | The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The list of multi-targeted permission operations to be applied to the installing DAO. |
### UpdateApplied
```solidity
event UpdateApplied(
address indexed dao,
address indexed plugin,
bytes32 preparedSetupId,
bytes32 appliedSetupId
)
```
Emitted after a plugin update was applied.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `plugin` | `address` | The address of the plugin contract. |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
| `appliedSetupId` | `bytes32` | The applied setup ID. |
### UpdatePrepared
```solidity
event UpdatePrepared(
address indexed sender,
address indexed dao,
bytes32 preparedSetupId,
PluginRepo indexed pluginSetupRepo,
PluginRepo.Tag versionTag,
IPluginSetup.SetupPayload setupPayload,
IPluginSetup.PreparedSetupData preparedSetupData,
bytes initData
)
```
Emitted with a prepared plugin update to store data relevant for the application step.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The sender that prepared the plugin update. |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
| `pluginSetupRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | The repository storing the `PluginSetup` contracts of all versions of a plugin. |
| `versionTag` | `PluginRepo.Tag` | The version tag of the plugin setup of the prepared update. |
| `setupPayload` | `IPluginSetup.SetupPayload` | The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup. |
| `preparedSetupData` | `IPluginSetup.PreparedSetupData` | The deployed plugin's relevant data which consists of helpers and permissions. |
| `initData` | `bytes` | The initialization data to be passed to the upgradeable plugin contract. |
## Errors
### InvalidAppliedSetupId
```solidity
error InvalidAppliedSetupId(bytes32 currentAppliedSetupId, bytes32 appliedSetupId)
```
Thrown if the applied setup ID resulting from the supplied setup payload does not match with the current applied setup ID.
| Parameter | Type | Description |
| --- | --- | --- |
| `currentAppliedSetupId` | `bytes32` | The current applied setup ID with which the data in the supplied payload must match. |
| `appliedSetupId` | `bytes32` | The applied setup ID obtained from the data in the supplied setup payload. |
### InvalidUpdateVersion
```solidity
error InvalidUpdateVersion(PluginRepo.Tag currentVersionTag, PluginRepo.Tag newVersionTag)
```
Thrown if the update version is invalid.
| Parameter | Type | Description |
| --- | --- | --- |
| `currentVersionTag` | `PluginRepo.Tag` | The tag of the current version to update from. |
| `newVersionTag` | `PluginRepo.Tag` | The tag of the new version to update to. |
### IPluginNotSupported
```solidity
error IPluginNotSupported(address plugin)
```
Thrown if a contract does not support the `IPlugin` interface.
| Parameter | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the contract. |
### PluginAlreadyInstalled
```solidity
error PluginAlreadyInstalled()
```
Thrown if plugin is already installed and one tries to prepare or apply install on it.
### PluginNonupgradeable
```solidity
error PluginNonupgradeable(address plugin)
```
Thrown if a plugin is not upgradeable.
| Parameter | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the plugin contract. |
### PluginProxyUpgradeFailed
```solidity
error PluginProxyUpgradeFailed(address proxy, address implementation, bytes initData)
```
Thrown if the upgrade of an `UUPSUpgradeable` proxy contract (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) failed.
| Parameter | Type | Description |
| --- | --- | --- |
| `proxy` | `address` | The address of the proxy. |
| `implementation` | `address` | The address of the implementation contract. |
| `initData` | `bytes` | The initialization data to be passed to the upgradeable plugin contract via `upgradeToAndCall`. |
### PluginRepoNonexistent
```solidity
error PluginRepoNonexistent()
```
Thrown if a plugin repository does not exist on the plugin repo registry.
### SetupAlreadyPrepared
```solidity
error SetupAlreadyPrepared(bytes32 preparedSetupId)
```
Thrown if a plugin setup was already prepared indicated by the prepared setup ID.
| Parameter | Type | Description |
| --- | --- | --- |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
### SetupApplicationUnauthorized
```solidity
error SetupApplicationUnauthorized(address dao, address caller, bytes32 permissionId)
```
Thrown if a setup is unauthorized and cannot be applied because of a missing permission of the associated DAO.
> **Dev:** This is thrown if the `APPLY_INSTALLATION_PERMISSION_ID`, `APPLY_UPDATE_PERMISSION_ID`, or APPLY_UNINSTALLATION_PERMISSION_ID is missing.
| Parameter | Type | Description |
| --- | --- | --- |
| `dao` | `address` | The address of the DAO to which the plugin belongs. |
| `caller` | `address` | The address (EOA or contract) that requested the application of a setup on the associated DAO. |
| `permissionId` | `bytes32` | The permission identifier. |
### SetupNotApplicable
```solidity
error SetupNotApplicable(bytes32 preparedSetupId)
```
Thrown if a prepared setup ID is not eligible to be applied. This can happen if another setup has been already applied or if the setup wasn't prepared in the first place.
| Parameter | Type | Description |
| --- | --- | --- |
| `preparedSetupId` | `bytes32` | The prepared setup ID. |
## Constants
_Public, so each is also readable through a generated getter._
### APPLY_INSTALLATION_PERMISSION_ID
```solidity
bytes32 public constant APPLY_INSTALLATION_PERMISSION_ID =
keccak256("APPLY_INSTALLATION_PERMISSION");
```
Value: `0xf796b89427c6552c1ac705d833bfb7909f8eb5ce502c1db97f85fabc6ad83548`
The ID of the permission required to call the `applyInstallation` function.
### APPLY_UNINSTALLATION_PERMISSION_ID
```solidity
bytes32 public constant APPLY_UNINSTALLATION_PERMISSION_ID =
keccak256("APPLY_UNINSTALLATION_PERMISSION");
```
Value: `0xbd4dbacf5ba6d9793f600403b3293d6ecd695fcc703a2b5edcf245f45fda6cfa`
The ID of the permission required to call the `applyUninstallation` function.
### APPLY_UPDATE_PERMISSION_ID
```solidity
bytes32 public constant APPLY_UPDATE_PERMISSION_ID = keccak256("APPLY_UPDATE_PERMISSION");
```
Value: `0xb03cf3d518f6d49560b7f5bece1ccb8fd50ea7370f02f5e5210edba04be3c4f7`
The ID of the permission required to call the `applyUpdate` function.
## Structs
### ApplyInstallationParams
```solidity
struct ApplyInstallationParams {
PluginSetupRef pluginSetupRef;
address plugin;
PermissionLib.MultiTargetPermission[] permissions;
bytes32 helpersHash;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `plugin` | `address` | |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | |
| `helpersHash` | `bytes32` | |
### ApplyUninstallationParams
```solidity
struct ApplyUninstallationParams {
address plugin;
PluginSetupRef pluginSetupRef;
PermissionLib.MultiTargetPermission[] permissions;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | |
### ApplyUpdateParams
```solidity
struct ApplyUpdateParams {
address plugin;
PluginSetupRef pluginSetupRef;
bytes initData;
PermissionLib.MultiTargetPermission[] permissions;
bytes32 helpersHash;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `initData` | `bytes` | |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | |
| `helpersHash` | `bytes32` | |
### PluginState
```solidity
struct PluginState {
uint256 blockNumber;
bytes32 currentAppliedSetupId;
mapping(bytes32 => uint256) preparedSetupIdToBlockNumber;
}
```
### PrepareInstallationParams
```solidity
struct PrepareInstallationParams {
PluginSetupRef pluginSetupRef;
bytes data;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `data` | `bytes` | |
### PrepareUninstallationParams
```solidity
struct PrepareUninstallationParams {
PluginSetupRef pluginSetupRef;
IPluginSetup.SetupPayload setupPayload;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | |
| `setupPayload` | `IPluginSetup.SetupPayload` | |
### PrepareUpdateParams
```solidity
struct PrepareUpdateParams {
PluginRepo.Tag currentVersionTag;
PluginRepo.Tag newVersionTag;
PluginRepo pluginSetupRepo;
IPluginSetup.SetupPayload setupPayload;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `currentVersionTag` | `PluginRepo.Tag` | |
| `newVersionTag` | `PluginRepo.Tag` | |
| `pluginSetupRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | |
| `setupPayload` | `IPluginSetup.SetupPayload` | |
# PluginUpgradeableSetup
**Abstract contract** · [`src/common/plugin/setup/PluginUpgradeableSetup.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/setup/PluginUpgradeableSetup.sol)
**Explained in:** [Plugin setup](/framework/plugin-setup.md)
**Author:** Aragon X - 2022-2024
**Inherits:** `ERC165`, [`IPluginSetup`](/abi/osx/IPluginSetup.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract contract to inherit from to implement the plugin setup for upgradeable plugins, i.e, `PluginUUPSUpgradeable` being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822) and [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967)).
**security-contact:** sirt@aragon.org
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### InvalidUpdatePath
```solidity
error InvalidUpdatePath(uint16 fromBuild, uint16 thisBuild)
```
Thrown when an update path is not available, for example, if this is the initial build.
| Parameter | Type | Description |
| --- | --- | --- |
| `fromBuild` | `uint16` | The build number to update from. |
| `thisBuild` | `uint16` | The build number of this setup to update to. |
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
# PluginUUPSUpgradeable
**Abstract contract** · [`src/common/plugin/PluginUUPSUpgradeable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/PluginUUPSUpgradeable.sol)
**Explained in:** [Choosing a plugin base](/framework/plugin-types.md), [Deploy your first DAO](/guides/deploy-a-dao.md), [Update a plugin](/guides/update-a-plugin.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IPlugin`](/abi/osx/IPlugin.md), `ERC165Upgradeable`, `UUPSUpgradeable`, [`DaoAuthorizableUpgradeable`](/abi/osx/DaoAuthorizableUpgradeable.md), [`ProtocolVersion`](/abi/osx/ProtocolVersion.md)
An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
**security-contact:** sirt@aragon.org
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IDAO`](/abi/osx/IDAO.md) | |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#plugintype) | |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target Config containing the address and operation type. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### 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
## 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.
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## 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.
| 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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
## Constants
_Public, so each is also readable through a generated getter._
### SET_TARGET_CONFIG_PERMISSION_ID
```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.
### UPGRADE_PLUGIN_PERMISSION_ID
```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
}
```
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### TargetConfig
_Inherited from `IPlugin`._
```solidity
struct TargetConfig {
address target;
IPlugin.Operation operation;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | |
| `operation` | [`IPlugin.Operation`](#operation) | |
# Proposal
**Abstract contract** · [`src/common/plugin/extensions/proposal/Proposal.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/extensions/proposal/Proposal.sol)
**Explained in:** [Proposals](/common/proposal.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IProposal`](/abi/osx/IProposal.md), `ERC165`
An abstract contract containing the traits and internal functionality to create and execute proposals
that can be inherited by non-upgradeable DAO plugins.
**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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### hasSucceeded
```solidity
function hasSucceeded(uint256 _proposalId) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The proposal count. |
### 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.
> **Dev:** In addition to the current interfaceId, also support previous version of the interfaceId
> that did not include the following functions:
> `createProposal`, `hasSucceeded`, `execute`, `canExecute`, `customProposalParamsABI`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### 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.
| 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[]`](/abi/osx/Action.md) | 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
## Errors
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
# ProposalUpgradeable
**Abstract contract** · [`src/common/plugin/extensions/proposal/ProposalUpgradeable.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/extensions/proposal/ProposalUpgradeable.sol)
**Explained in:** [Proposals](/common/proposal.md)
**Author:** Aragon X - 2022-2024
**Inherits:** [`IProposal`](/abi/osx/IProposal.md), `ERC165Upgradeable`
An abstract contract containing the traits and internal functionality to create and execute proposals
that can be inherited by upgradeable DAO plugins.
**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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### hasSucceeded
```solidity
function hasSucceeded(uint256 _proposalId) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The proposal count. |
### 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.
> **Dev:** In addition to the current interfaceId, also support previous version of the interfaceId
> that did not include the following functions:
> `createProposal`, `hasSucceeded`, `execute`, `canExecute`, `customProposalParamsABI`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### 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.
| 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[]`](/abi/osx/Action.md) | 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
## Errors
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
# ProtocolVersion
**Abstract contract** · [`src/common/utils/versioning/ProtocolVersion.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/versioning/ProtocolVersion.sol)
**Explained in:** [Protocol version](/common/protocol-version.md)
**Author:** Aragon X - 2023
**Inherits:** [`IProtocolVersion`](/abi/osx/IProtocolVersion.md)
An abstract, stateless, non-upgradeable contract providing the current Aragon OSx protocol version number.
> **Dev:** Do not add any new variables to this contract that would shift down storage in the inheritance chain.
**security-contact:** sirt@aragon.org
## Functions
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
# ProxyFactory
**Contract** · [`src/common/utils/deployment/ProxyFactory.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/deployment/ProxyFactory.sol)
**Explained in:** [Proxy deployment (UUPS & minimal proxies)](/common/proxies.md)
**Author:** Aragon X - 2024
A factory to deploy proxies via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) and minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)).
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(address _implementation)
```
Initializes the contract with a logic contract address.
| Parameter | Type | Description |
| --- | --- | --- |
| `_implementation` | `address` | The logic contract address. |
## Functions
### deployMinimalProxy
```solidity
function deployMinimalProxy(bytes _data) external returns (address proxy)
```
Selector: `0x93042ea3`
Creates an [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167) minimal proxy contract pointing to the pre-set logic contract.
> **Dev:** If `_data` is non-empty, it is used in a call to the clone contract. This will typically be an encoded function call initializing the storage of the contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_data` | `bytes` | The initialization data for this contract. |
| Returns | Type | Description |
| --- | --- | --- |
| `proxy` | `address` | The address of the proxy contract created. |
### deployUUPSProxy
```solidity
function deployUUPSProxy(bytes _data) external returns (address proxy)
```
Selector: `0x5c5c278b`
Creates an [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract pointing to the pre-set logic contract.
> **Dev:** If `_data` is non-empty, it is used in a delegate call to the `_implementation` contract. This will typically be an encoded function call initializing the proxy (see [OpenZeppelin ERC1967Proxy-constructor](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Proxy-constructor-address-bytes-)).
| Parameter | Type | Description |
| --- | --- | --- |
| `_data` | `bytes` | The initialization data for this contract. |
| Returns | Type | Description |
| --- | --- | --- |
| `proxy` | `address` | The address of the proxy contract created. |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the implementation contract address.
> **Dev:** The implementation can be cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
## Events
### ProxyCreated
```solidity
event ProxyCreated(address proxy)
```
Emitted when an proxy contract is created.
| Parameter | Type | Description |
| --- | --- | --- |
| `proxy` | `address` | The proxy address. |
# RuledCondition
**Abstract contract** · [`src/common/permission/condition/extensions/RuledCondition.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/condition/extensions/RuledCondition.sol)
**Explained in:** [RuledCondition (the rule engine)](/common/ruled-condition.md)
**Author:** Aragon X - 2024
**Inherits:** [`PermissionConditionUpgradeable`](/abi/osx/PermissionConditionUpgradeable.md)
An abstract contract to create conditional permissions using rules.
## Functions
### decodeRuleValue
```solidity
function decodeRuleValue(uint256 _x) external pure returns (uint32 a, uint32 b, uint32 c)
```
Selector: `0x1498b514`
Decodes rule indices into three uint32.
| Parameter | Type | Description |
| --- | --- | --- |
| `_x` | `uint256` | The value to decode. |
| Returns | Type | Description |
| --- | --- | --- |
| `a` | `uint32` | The first 32-bit segment. |
| `b` | `uint32` | The second 32-bit segment. |
| `c` | `uint32` | The third 32-bit segment. |
### encodeIfElse
```solidity
function encodeIfElse(
uint256 startingRuleIndex,
uint256 successRuleIndex,
uint256 failureRuleIndex
) external pure returns (uint240)
```
Selector: `0x23e8cefc`
Encodes rule indices into a uint240 value.
| Parameter | Type | Description |
| --- | --- | --- |
| `startingRuleIndex` | `uint256` | The index of the starting rule to evaluate. |
| `successRuleIndex` | `uint256` | The index of the rule to evaluate if the evaluation of `startingRuleIndex` was true. |
| `failureRuleIndex` | `uint256` | The index of the rule to evaluate if the evaluation of `startingRuleIndex` was false. |
### encodeLogicalOperator
```solidity
function encodeLogicalOperator(
uint256 ruleIndex1,
uint256 ruleIndex2
) external pure returns (uint240)
```
Selector: `0xd09e5361`
Encodes two rule indexes into a uint240 value. Useful for logical operators such as `AND/OR/XOR` and others.
| Parameter | Type | Description |
| --- | --- | --- |
| `ruleIndex1` | `uint256` | The first index to evaluate. |
| `ruleIndex2` | `uint256` | The second index to evaluate. |
### getRules
```solidity
function getRules() external view returns (RuledCondition.Rule[])
```
Selector: `0x45e2984a`
Retrieves the current rules stored in this contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`RuledCondition.Rule[]`](#rule) | |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns `true` if the interface is supported. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### RulesUpdated
```solidity
event RulesUpdated(RuledCondition.Rule[] rules)
```
Emitted when the rules are updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `rules` | [`RuledCondition.Rule[]`](#rule) | The new rules that replaces old rules. |
## Enums
### Op
```solidity
enum Op {
NONE,
EQ,
NEQ,
GT,
LT,
GTE,
LTE,
RET,
NOT,
AND,
OR,
XOR,
IF_ELSE
}
```
| Option | Value |
| --- | --- |
| `NONE` | `0` |
| `EQ` | `1` |
| `NEQ` | `2` |
| `GT` | `3` |
| `LT` | `4` |
| `GTE` | `5` |
| `LTE` | `6` |
| `RET` | `7` |
| `NOT` | `8` |
| `AND` | `9` |
| `OR` | `10` |
| `XOR` | `11` |
| `IF_ELSE` | `12` |
## Structs
### Rule
```solidity
struct Rule {
uint8 id;
uint8 op;
uint240 value;
bytes32 permissionId;
}
```
# IDAO
**Interface** · [`src/common/dao/IDAO.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/dao/IDAO.sol)
**Explained in:** [The DAO contract](/core/dao.md)
**Author:** Aragon X - 2022-2024
The interface required for DAOs within the Aragon App DAO framework.
**security-contact:** sirt@aragon.org
## Functions
### deposit
```solidity
function deposit(address _token, uint256 _amount, string _reference) external payable
```
Selector: `0xbfe07da6`
Deposits (native) tokens to the DAO contract with a reference string.
| Parameter | Type | Description |
| --- | --- | --- |
| `_token` | `address` | The address of the token or address(0) in case of the native token. |
| `_amount` | `uint256` | The amount of tokens to deposit. |
| `_reference` | `string` | The reference describing the deposit reason. |
### getTrustedForwarder
```solidity
function getTrustedForwarder() external view returns (address)
```
Selector: `0xce1b815f`
Getter for the trusted forwarder verifying the meta transaction.
### hasPermission
```solidity
function hasPermission(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0xfdef9106`
Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the contract. |
| `_who` | `address` | The address of a EOA or contract to give the permissions. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | The optional data passed to the `PermissionCondition` registered. |
### isValidSignature
```solidity
function isValidSignature(bytes32 _hash, bytes _signature) external returns (bytes4)
```
Selector: `0x1626ba7e`
Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).
| Parameter | Type | Description |
| --- | --- | --- |
| `_hash` | `bytes32` | The hash of the data to be signed. |
| `_signature` | `bytes` | The signature byte array associated with `_hash`. |
### registerStandardCallback
```solidity
function registerStandardCallback(
bytes4 _interfaceId,
bytes4 _callbackSelector,
bytes4 _magicNumber
) external
```
Selector: `0xc4a50145`
Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
| `_callbackSelector` | `bytes4` | The selector of the callback function. |
| `_magicNumber` | `bytes4` | The magic number to be registered for the function signature. |
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `0xee57e36f`
Updates the DAO metadata (e.g., an IPFS hash).
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The IPFS hash of the new metadata object. |
### setSignatureValidator
```solidity
function setSignatureValidator(address) external
```
Selector: `0x3e2ab0d9`
Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.
> **Dev:** Introduced in v1.0.0. Removed in v1.4.0.
### setTrustedForwarder
```solidity
function setTrustedForwarder(address _trustedForwarder) external
```
Selector: `0xda742228`
Setter for the trusted forwarder verifying the meta transaction.
| Parameter | Type | Description |
| --- | --- | --- |
| `_trustedForwarder` | `address` | The trusted forwarder address. |
## Events
### Deposited
```solidity
event Deposited(
address indexed sender,
address indexed token,
uint256 amount,
string _reference
)
```
Emitted when a token deposit has been made to the DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The address of the sender. |
| `token` | `address` | The address of the deposited token. |
| `amount` | `uint256` | The amount of tokens deposited. |
| `_reference` | `string` | The reference describing the deposit reason. |
### MetadataSet
```solidity
event MetadataSet(bytes metadata)
```
Emitted when the DAO metadata is updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `metadata` | `bytes` | The IPFS hash of the new metadata object. |
### NativeTokenDeposited
```solidity
event NativeTokenDeposited(address sender, uint256 amount)
```
Emitted when a native token deposit has been made to the DAO.
> **Dev:** This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).
| Parameter | Type | Description |
| --- | --- | --- |
| `sender` | `address` | The address of the sender. |
| `amount` | `uint256` | The amount of native tokens deposited. |
### StandardCallbackRegistered
```solidity
event StandardCallbackRegistered(
bytes4 interfaceId,
bytes4 callbackSelector,
bytes4 magicNumber
)
```
Emitted when a standard callback is registered.
| Parameter | Type | Description |
| --- | --- | --- |
| `interfaceId` | `bytes4` | The ID of the interface. |
| `callbackSelector` | `bytes4` | The selector of the callback function. |
| `magicNumber` | `bytes4` | The magic number to be registered for the callback function selector. |
### TrustedForwarderSet
```solidity
event TrustedForwarderSet(address forwarder)
```
Emitted when a new TrustedForwarder is set on the DAO.
| Parameter | Type | Description |
| --- | --- | --- |
| `forwarder` | `address` | the new forwarder address. |
# IEIP4824
**Interface** · [`src/core/dao/IEIP4824.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/core/dao/IEIP4824.sol)
**Explained in:** [DAO metadata](/core/dao-metadata.md), [The DAO contract](/core/dao.md)
**EIP-4824 Common Interfaces for DAOs**
**Author:** Aragon X - 2021-2023
> **Dev:** See https://eips.ethereum.org/EIPS/eip-4824
**security-contact:** sirt@aragon.org
## Functions
### daoURI
```solidity
function daoURI() external view returns (string _daoURI)
```
Selector: `0x7034731b`
A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the "EIP-4824 DAO JSON-LD Schema". This JSON file splits into four URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI should point to a JSON file that conforms to the "EIP-4824 Members JSON-LD Schema". The proposalsURI should point to a JSON file that conforms to the "EIP-4824 Proposals JSON-LD Schema". The activityLogURI should point to a JSON file that conforms to the "EIP-4824 Activity Log JSON-LD Schema". The governanceURI should point to a flatfile, normatively a .md file. Each of the JSON files named above can be statically hosted or dynamically-generated.
| Returns | Type | Description |
| --- | --- | --- |
| `_daoURI` | `string` | The DAO URI. |
# IExecutor
**Interface** · [`src/common/executors/IExecutor.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/executors/IExecutor.sol)
**Explained in:** [Actions and execution](/core/execution.md), [Create, vote, and execute a proposal](/guides/create-vote-execute.md)
**Author:** Aragon X - 2024
The interface required for Executors within the Aragon App DAO framework.
**security-contact:** sirt@aragon.org
## Functions
### execute
```solidity
function execute(
bytes32 _callId,
Action[] _actions,
uint256 _allowFailureMap
) external returns (bytes[], uint256)
```
Selector: `0xc71bf324`
Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_callId` | `bytes32` | The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions. |
| `_allowFailureMap` | `uint256` | A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert. |
## Events
### Executed
```solidity
event Executed(
address indexed actor,
bytes32 callId,
Action[] actions,
uint256 allowFailureMap,
uint256 failureMap,
bytes[] execResults
)
```
Emitted when a proposal is executed.
> **Dev:** The value of `callId` is defined by the component/contract calling the execute function.
> A `Plugin` implementation can use it, for example, as a nonce.
| Parameter | Type | Description |
| --- | --- | --- |
| `actor` | `address` | The address of the caller. |
| `callId` | `bytes32` | The ID of the call. |
| `actions` | [`Action[]`](/abi/osx/Action.md) | The array of actions executed. |
| `allowFailureMap` | `uint256` | The allow failure map encoding which actions are allowed to fail. |
| `failureMap` | `uint256` | The failure map encoding which actions have failed. |
| `execResults` | `bytes[]` | The array with the results of the executed actions. |
# IMemberRegistry
**Interface** · [`src/framework/member/IMemberRegistry.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/member/IMemberRegistry.sol)
**Explained in:** [Member registry](/framework/member-registry.md)
Permissionless member self-registration via ENS subdomain claims.
Members claim a subdomain under a configurable parent domain, manage their own
resolver records (text, avatar, etc.) via per-node approval, and can release or
move their subdomain at any time.
**security-contact:** sirt@aragon.org
## Functions
### evict
```solidity
function evict(string subdomain, address newController) external
```
Selector: `0x75e99e1d`
Forcibly evict a subdomain, optionally re-assigning it to a new controller. Governed.
Requires EVICT_SUBDOMAIN_PERMISSION_ID on this contract (OSx permission system).
If `newController` is the zero address, the subdomain is fully released (records
cleared, subnode released). If `newController` is non-zero, the same subdomain is
re-assigned to it as if it had called `register` itself: ENS subnode re-created,
addr record set to `newController`, per-node resolver approval granted to it.
Reverts if the subdomain is unknown, if `newController` already controls it, or
if `newController` is already registered with a different subdomain.
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to evict (e.g., "alice"). |
| `newController` | `address` | Address that should control the subdomain after the eviction, or `address(0)` to release without reassignment. |
### isRegistered
```solidity
function isRegistered(address member) external view returns (bool)
```
Selector: `0xc3c5a547`
Returns true if `member` has a registered subdomain.
### move(string,((string,string)[],address,bytes))
```solidity
function move(string newSubdomain, IMemberRegistry.Records records) external
```
Selector: `0x09b54918`
Move your subdomain and carry over resolver records atomically.
Only moves the caller's own subdomain. Reverts if not registered or new label taken.
| Parameter | Type | Description |
| --- | --- | --- |
| `newSubdomain` | `string` | The new subdomain label to claim. |
| `records` | [`IMemberRegistry.Records`](#records) | Resolver records to set on the new subnode (text, addr, contenthash). addr=address(0) keeps the default (msg.sender). Empty contenthash is skipped. |
### move(string)
```solidity
function move(string newSubdomain) external
```
Selector: `0x0bfb0697`
Move your subdomain. Releases the old label and claims the new one atomically.
Only moves the caller's own subdomain. Reverts if not registered or new label taken.
| Parameter | Type | Description |
| --- | --- | --- |
| `newSubdomain` | `string` | The new subdomain label to claim. |
### parentDomain
```solidity
function parentDomain() external view returns (string)
```
Selector: `0xaf1a6e3d`
The parent domain string this registry manages (e.g., `"members.dao.eth"`).
Pre-image of `parentNode()`.
### parentNode
```solidity
function parentNode() external view returns (bytes32)
```
Selector: `0xf3068a00`
The namehash of the parent domain. Equal to `namehash(parentDomain())`.
### register(string,((string,string)[],address,bytes))
```solidity
function register(string subdomain, IMemberRegistry.Records records) external
```
Selector: `0x24f8bee2`
Register as a member with initial resolver records set atomically. Permissionless.
One subdomain per address. Reverts if already registered (release first).
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to claim (e.g., "alice"). |
| `records` | [`IMemberRegistry.Records`](#records) | Resolver records to set on the new subnode (text, addr, contenthash). addr=address(0) defaults to msg.sender. Empty contenthash is skipped. |
### register(string)
```solidity
function register(string subdomain) external
```
Selector: `0xf2c298be`
Register as a member by claiming a subdomain. Permissionless.
One subdomain per address. Reverts if already registered (release first).
| Parameter | Type | Description |
| --- | --- | --- |
| `subdomain` | `string` | The subdomain label to claim (e.g., "alice"). |
### release
```solidity
function release() external
```
Selector: `0x86d1a69f`
Voluntarily release your subdomain. Permissionless.
Only releases the caller's own subdomain. Reverts if not registered.
## Events
### ProfileMoved
```solidity
event ProfileMoved(address indexed member, string oldSubdomain, string newSubdomain)
```
Emitted when a member moves their subdomain (release old + claim new).
### Registered
```solidity
event Registered(address indexed member, string subdomain)
```
Emitted when a member registers and claims a subdomain.
### Released
```solidity
event Released(address indexed member, string subdomain)
```
Emitted when a member voluntarily releases their subdomain.
### SubdomainEvicted
```solidity
event SubdomainEvicted(address indexed member, address indexed evictor, string subdomain)
```
Emitted when governance forcibly evicts a member's subdomain.
## Errors
### AlreadyRegistered
```solidity
error AlreadyRegistered(address member)
```
Thrown if the member is already registered.
### InvalidDomain
```solidity
error InvalidDomain(string domain)
```
Thrown if the parent domain is empty.
### InvalidENSRegistry
```solidity
error InvalidENSRegistry(address ens)
```
Thrown if the ENS registry address is not a valid ENS registry.
### InvalidManagementDao
```solidity
error InvalidManagementDao(address dao)
```
Thrown if the management DAO address is the zero address.
### InvalidNewController
```solidity
error InvalidNewController(address newController)
```
Thrown if the new controller passed to `evict` already controls the subdomain
being evicted (no-op transfer is rejected to surface caller mistakes).
### InvalidResolver
```solidity
error InvalidResolver(address resolver)
```
Thrown if the resolver address has no contract code (zero address or EOA).
### InvalidSubdomain
```solidity
error InvalidSubdomain(string subdomain)
```
Thrown if the subdomain is invalid: shorter than 3 characters, longer than 50,
starts or ends with `-`, or contains characters outside [0-9a-z-].
### NotRegistered
```solidity
error NotRegistered(address member)
```
Thrown if the member is not registered.
### SubdomainAlreadyTaken
```solidity
error SubdomainAlreadyTaken(string subdomain)
```
Thrown if the requested subdomain label is already taken.
### SubdomainNotRegistered
```solidity
error SubdomainNotRegistered(string subdomain)
```
Thrown if the subdomain has no current owner (evict target unknown).
## Structs
### Records
```solidity
struct Records {
IMemberRegistry.TextRecord[] textRecords;
address addr;
bytes contenthash;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `textRecords` | [`IMemberRegistry.TextRecord[]`](#textrecord) | |
| `addr` | `address` | |
| `contenthash` | `bytes` | |
### TextRecord
```solidity
struct TextRecord {
string key;
string value;
}
```
# IMembership
**Interface** · [`src/common/plugin/extensions/membership/IMembership.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/extensions/membership/IMembership.sol)
**Explained in:** [Membership and the address list](/common/membership.md)
**Author:** Aragon X - 2022-2023
An interface to be implemented by DAO plugins that define membership.
**security-contact:** sirt@aragon.org
## Functions
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The address of the account to be checked. |
## Events
### MembersAdded
```solidity
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
```solidity
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
```solidity
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. |
# IPermissionCondition
**Interface** · [`src/common/permission/condition/IPermissionCondition.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/condition/IPermissionCondition.sol)
**Explained in:** [Permission conditions](/common/permission-conditions.md)
**Author:** Aragon X - 2021-2023
An interface to be implemented to support custom permission logic.
> **Dev:** To attach a condition to a permission, the `grantWithCondition` function must be used and refer to the implementing contract's address with the `condition` argument.
**security-contact:** sirt@aragon.org
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
# IPlugin
**Interface** · [`src/common/plugin/IPlugin.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/IPlugin.sol)
**Explained in:** [The plugin model](/framework/plugins.md)
**Author:** Aragon X - 2022-2024
An interface defining the traits of a plugin.
**security-contact:** sirt@aragon.org
## Functions
### pluginType
```solidity
function pluginType() external view returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#plugintype) | |
## Enums
### Operation
```solidity
enum Operation {
Call,
DelegateCall
}
```
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
## Structs
### TargetConfig
```solidity
struct TargetConfig {
address target;
IPlugin.Operation operation;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | |
| `operation` | [`IPlugin.Operation`](#operation) | |
# IPluginRepo
**Interface** · [`src/framework/plugin/repo/IPluginRepo.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/repo/IPluginRepo.sol)
**Explained in:** [PluginRepo (versioning & publishing)](/framework/plugin-repo.md)
**Author:** Aragon X - 2022-2023
The interface required for a plugin repository.
**security-contact:** sirt@aragon.org
## Functions
### createVersion
```solidity
function createVersion(
uint8 _release,
address _pluginSetupAddress,
bytes _buildMetadata,
bytes _releaseMetadata
) external
```
Selector: `0xfc054427`
Creates a new plugin version as the latest build for an existing release number or the first build for a new release number for the provided `PluginSetup` contract address and metadata.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
| `_pluginSetupAddress` | `address` | The address of the plugin setup contract. |
| `_buildMetadata` | `bytes` | The build metadata URI. |
| `_releaseMetadata` | `bytes` | The release metadata URI. |
### updateReleaseMetadata
```solidity
function updateReleaseMetadata(uint8 _release, bytes _releaseMetadata) external
```
Selector: `0x28375f67`
Updates the metadata for release with content `@fromHex(_releaseMetadata)`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_release` | `uint8` | The release number. |
| `_releaseMetadata` | `bytes` | The release metadata URI. |
## Events
### ReleaseMetadataUpdated
```solidity
event ReleaseMetadataUpdated(uint8 release, bytes releaseMetadata)
```
Emitted when a release's metadata was updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `release` | `uint8` | The release number. |
| `releaseMetadata` | `bytes` | The release metadata URI. |
### VersionCreated
```solidity
event VersionCreated(
uint8 release,
uint16 build,
address indexed pluginSetup,
bytes buildMetadata
)
```
Emitted if the same plugin setup exists in previous releases.
| Parameter | Type | Description |
| --- | --- | --- |
| `release` | `uint8` | The release number. |
| `build` | `uint16` | The build number. |
| `pluginSetup` | `address` | The address of the plugin setup contract. |
| `buildMetadata` | `bytes` | The build metadata URI. |
# IPluginSetup
**Interface** · [`src/common/plugin/setup/IPluginSetup.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/setup/IPluginSetup.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [Plugin setup](/framework/plugin-setup.md), [Update a plugin](/guides/update-a-plugin.md)
**Author:** Aragon X - 2022-2023
The interface required for a plugin setup contract to be consumed by the `PluginSetupProcessor` for plugin installations, updates, and uninstallations.
**security-contact:** sirt@aragon.org
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
## Structs
### PreparedSetupData
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
### SetupPayload
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
# IProposal
**Interface** · [`src/common/plugin/extensions/proposal/IProposal.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/plugin/extensions/proposal/IProposal.sol)
**Explained in:** [Proposals](/common/proposal.md)
**Author:** Aragon X - 2022-2024
An interface to be implemented by DAO plugins that create and execute proposals.
**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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### createProposal
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64 _endDate,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | [`Action[]`](/abi/osx/Action.md) | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### hasSucceeded
```solidity
function hasSucceeded(uint256 _proposalId) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The id of the proposal. |
### 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.
## Events
### 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.
| 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[]`](/abi/osx/Action.md) | 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
# IProtocolVersion
**Interface** · [`src/common/utils/versioning/IProtocolVersion.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/versioning/IProtocolVersion.sol)
**Explained in:** [Protocol version](/common/protocol-version.md)
**Author:** Aragon X - 2022-2023
An interface defining the semantic Aragon OSx protocol version number.
**security-contact:** sirt@aragon.org
## Functions
### protocolVersion
```solidity
function protocolVersion() external view returns (uint8[3] _version)
```
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.
| Returns | Type | Description |
| --- | --- | --- |
| `_version` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
# IResolver
**Interface** · [`src/framework/utils/ens/IResolver.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/utils/ens/IResolver.sol)
Minimal resolver interface for MemberRegistry.
Covers what the registry calls during subnode lifecycle and record migration.
Members call the full PublicResolver directly for additional record management.
**security-contact:** sirt@aragon.org
## Functions
### approve
```solidity
function approve(bytes32 node, address delegate, bool approved) external
```
Selector: `0xa4b91a01`
Approve a delegate to manage resolver records for a specific node.
> **Dev:** Per-node delegation. Available in ens-contracts >= v0.0.19.
### clearRecords
```solidity
function clearRecords(bytes32 node) external
```
Selector: `0x3603d758`
Invalidate all resolver records for a node by incrementing the version counter.
### isApprovedFor
```solidity
function isApprovedFor(
address owner,
bytes32 node,
address delegate
) external view returns (bool)
```
Selector: `0xa9784b3e`
Check if a delegate is approved for a node by a given owner.
### setAddr
```solidity
function setAddr(bytes32 node, address addr) external
```
Selector: `0xd5fa2b00`
Set the address record for a node.
### setContenthash
```solidity
function setContenthash(bytes32 node, bytes hash) external
```
Selector: `0x304e6ade`
Set the contenthash for a node.
### setText
```solidity
function setText(bytes32 node, string key, string value) external
```
Selector: `0x10f13a8c`
Set a text record for a node.
# ENSDomain
**Library** · [`src/framework/utils/ens/ENSDomain.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/utils/ens/ENSDomain.sol)
Pure-string utilities for working with ENS domain names: namehash (EIP-137)
and splitting at the first dot. Single source of truth used by the contract,
deploy scripts and tests.
## Errors
### InvalidDomain
```solidity
error InvalidDomain(string domain)
```
Thrown when `domain` is structurally malformed
# PermissionLib
**Library** · [`src/common/permission/PermissionLib.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/PermissionLib.sol)
**Explained in:** [The permission system](/core/permissions.md)
**Author:** Aragon X - 2021-2023
A library containing objects for permission processing.
**security-contact:** sirt@aragon.org
## Constants
_Public, so each is also readable through a generated getter._
### NO_CONDITION
```solidity
address public constant NO_CONDITION = address(0);
```
A constant expressing that no condition is applied to a permission.
## Enums
### Operation
```solidity
enum Operation {
Grant,
Revoke,
GrantWithCondition
}
```
| Option | Value |
| --- | --- |
| `Grant` | `0` |
| `Revoke` | `1` |
| `GrantWithCondition` | `2` |
## Structs
### MultiTargetPermission
```solidity
struct MultiTargetPermission {
PermissionLib.Operation operation;
address where;
address who;
address condition;
bytes32 permissionId;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `operation` | [`PermissionLib.Operation`](#operation) | |
| `where` | `address` | |
| `who` | `address` | |
| `condition` | `address` | |
| `permissionId` | `bytes32` | |
### SingleTargetPermission
```solidity
struct SingleTargetPermission {
PermissionLib.Operation operation;
address who;
bytes32 permissionId;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `operation` | [`PermissionLib.Operation`](#operation) | |
| `who` | `address` | |
| `permissionId` | `bytes32` | |
# ProxyLib
**Library** · [`src/common/utils/deployment/ProxyLib.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/deployment/ProxyLib.sol)
**Explained in:** [Proxy deployment (UUPS & minimal proxies)](/common/proxies.md)
**Author:** Aragon X - 2024
A library containing methods for the deployment of proxies via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) and minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)).
**security-contact:** sirt@aragon.org
# VersionComparisonLib
**Library** · [`src/common/utils/versioning/VersionComparisonLib.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/versioning/VersionComparisonLib.sol)
**Explained in:** [Protocol version](/common/protocol-version.md)
**Author:** Aragon X - 2023
A library containing methods for [semantic version number](https://semver.org/spec/v2.0.0.html) comparison.
**security-contact:** sirt@aragon.org
# Action
**Struct** · [`src/common/executors/IExecutor.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/executors/IExecutor.sol)
**Explained in:** [Actions and execution](/core/execution.md), [Create, vote, and execute a proposal](/guides/create-vote-execute.md)
```solidity
struct Action {
address to;
uint256 value;
bytes data;
}
```
# PluginSetupRef
**Struct** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
struct PluginSetupRef {
PluginRepo.Tag versionTag;
PluginRepo pluginSetupRepo;
}
```
| Field | Type | Description |
| --- | --- | --- |
| `versionTag` | `PluginRepo.Tag` | |
| `pluginSetupRepo` | [`PluginRepo`](/abi/osx/PluginRepo.md) | |
# PreparationType
**Enum** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
enum PreparationType {
None,
Installation,
Update,
Uninstallation
}
```
| Option | Value |
| --- | --- |
| `None` | `0` |
| `Installation` | `1` |
| `Update` | `2` |
| `Uninstallation` | `3` |
# DaoUnauthorized
**Error** · [`src/common/permission/auth/auth.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/auth/auth.sol)
**Explained in:** [Authorizing against a DAO](/common/auth.md)
```solidity
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. |
# RatioOutOfBounds
**Error** · [`src/common/utils/math/Ratio.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/Ratio.sol)
**Explained in:** [Ratio (threshold math)](/common/ratio.md)
```solidity
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. |
# RATIO_BASE
**Constant** · [`src/common/utils/math/Ratio.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/Ratio.sol)
**Explained in:** [Ratio (threshold math)](/common/ratio.md)
```solidity
uint256 constant RATIO_BASE = 10 ** 6;
```
# _applyRatioCeiled
**Function** · [`src/common/utils/math/Ratio.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/Ratio.sol)
**Explained in:** [Ratio (threshold math)](/common/ratio.md)
```solidity
function _applyRatioCeiled(uint256 _value, uint256 _ratio) pure returns (uint256 result)
```
Applies a ratio to a value and ceils the remainder.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_value` | `uint256` | The value to which the ratio is applied. |
| `_ratio` | `uint256` | The ratio that must be in the interval `[0, 10**6]`. |
| Returns | Type | Description |
| --- | --- | --- |
| `result` | `uint256` | The resulting value. |
# _auth
**Function** · [`src/common/permission/auth/auth.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/permission/auth/auth.sol)
**Explained in:** [Authorizing against a DAO](/common/auth.md)
```solidity
function _auth(
IDAO _dao,
address _where,
address _who,
bytes32 _permissionId,
bytes calldata _data
) view
```
A free function checking if a caller is granted permissions on a target contract via a permission identifier that redirects the approval to a `PermissionCondition` if this was specified in the setup.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | [`IDAO`](/abi/osx/IDAO.md) | |
| `_where` | `address` | The address of the target contract for which `who` receives permission. |
| `_who` | `address` | The address (EOA or contract) owning the permission. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | The optional data passed to the `PermissionCondition` registered. |
# _getAppliedSetupId
**Function** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
function _getAppliedSetupId(
PluginSetupRef memory _pluginSetupRef,
bytes32 _helpersHash
) pure returns (bytes32)
```
Returns an identifier for applied installations.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | The reference of the plugin setup containing plugin setup repo and version tag. |
| `_helpersHash` | `bytes32` | The hash of the helper contract addresses. |
# _getPluginInstallationId
**Function** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
function _getPluginInstallationId(address _dao, address _plugin) pure returns (bytes32)
```
Returns an ID for plugin installation by hashing the DAO and plugin address.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the DAO conducting the setup. |
| `_plugin` | `address` | The plugin address. |
# _getPreparedSetupId
**Function** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
function _getPreparedSetupId(
PluginSetupRef memory _pluginSetupRef,
bytes32 _permissionsHash,
bytes32 _helpersHash,
bytes memory _data,
PreparationType _preparationType
) pure returns (bytes32)
```
Returns an ID for prepared setup obtained from hashing characterizing elements.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_pluginSetupRef` | [`PluginSetupRef`](/abi/osx/PluginSetupRef.md) | The reference of the plugin setup containing plugin setup repo and version tag. |
| `_permissionsHash` | `bytes32` | The hash of the permission operations requested by the setup. |
| `_helpersHash` | `bytes32` | The hash of the helper contract addresses. |
| `_data` | `bytes` | The bytes-encoded initialize data for the upgrade that is returned by `prepareUpdate`. |
| `_preparationType` | [`PreparationType`](/abi/osx/PreparationType.md) | The type of preparation the plugin is currently undergoing. Without this, it is possible to call `applyUpdate` even after `applyInstallation` is called. |
# _uncheckedAdd
**Function** · [`src/common/utils/math/UncheckedMath.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/UncheckedMath.sol)
```solidity
function _uncheckedAdd(uint256 a, uint256 b) pure returns (uint256)
```
Adds two unsigned integers without checking the result for overflow errors (using safe math).
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `a` | `uint256` | The first summand. |
| `b` | `uint256` | The second summand. |
# _uncheckedSub
**Function** · [`src/common/utils/math/UncheckedMath.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/UncheckedMath.sol)
```solidity
function _uncheckedSub(uint256 a, uint256 b) pure returns (uint256)
```
Subtracts two unsigned integers without checking the result for overflow errors (using safe math).
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `a` | `uint256` | The minuend. |
| `b` | `uint256` | The subtrahend. |
# flipBit
**Function** · [`src/common/utils/math/BitMap.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/BitMap.sol)
**Explained in:** [Actions and execution](/core/execution.md)
```solidity
function flipBit(uint256 bitmap, uint8 index) pure returns (uint256)
```
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `bitmap` | `uint256` | The `uint256` representation of bits. |
| `index` | `uint8` | The index number to set the bit. |
# hasBit
**Function** · [`src/common/utils/math/BitMap.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/common/utils/math/BitMap.sol)
**Explained in:** [Actions and execution](/core/execution.md)
```solidity
function hasBit(uint256 bitmap, uint8 index) pure returns (bool)
```
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `bitmap` | `uint256` | The `uint256` representation of bits. |
| `index` | `uint8` | The index number to check whether 1 or 0 is set. |
# hashHelpers
**Function** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
function hashHelpers(address[] memory _helpers) pure returns (bytes32)
```
Returns a hash of an array of helper addresses (contracts or EOAs).
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_helpers` | `address[]` | The array of helper addresses (contracts or EOAs) to be hashed. |
# hashPermissions
**Function** · [`src/framework/plugin/setup/PluginSetupProcessorHelpers.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/plugin/setup/PluginSetupProcessorHelpers.sol)
**Explained in:** [Install a plugin into a live DAO](/guides/install-a-plugin.md), [The PluginSetupProcessor (PSP)](/framework/plugin-setup-processor.md), [Update a plugin](/guides/update-a-plugin.md)
```solidity
function hashPermissions(
PermissionLib.MultiTargetPermission[] memory _permissions
) pure returns (bytes32)
```
Returns a hash of an array of multi-targeted permission operations.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `_permissions` | `PermissionLib.MultiTargetPermission[]` | The array of of multi-targeted permission operations. |
# isSubdomainValid
**Function** · [`src/framework/utils/RegistryUtils.sol`](https://github.com/aragon/core/blob/f7c7508f4ceb2b685ee037ffe87df17340fc4aef/src/framework/utils/RegistryUtils.sol)
**Explained in:** [Registries and ENS names](/framework/registries.md)
```solidity
function isSubdomainValid(string calldata subDomain) pure returns (bool)
```
Validates that a subdomain name is composed only from characters in the allowed character set:
- the lowercase letters `a-z`
- the digits `0-9`
- the hyphen `-`
> **Dev:** This function allows empty (zero-length) subdomains. If this should not be allowed, make sure to add a respective check when using this function in your code.
> Aborts on the first invalid char found.
**security-contact:** sirt@aragon.org
| Parameter | Type | Description |
| --- | --- | --- |
| `subDomain` | `string` | The name of the DAO. |
# staged-proposal-processor-plugin — ABI reference
Generated from [`staged-proposal-processor-plugin`](https://github.com/aragon/staged-proposal-processor-plugin) at commit [`96b83dd5`](https://github.com/aragon/staged-proposal-processor-plugin/commit/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2).
6 entries. Regenerate with `just abi`.
## Contracts
- [`SPPRuleCondition`](/abi/staged-proposal-processor-plugin/SPPRuleCondition.md) — The SPP Condition that must be granted for `createProposal` function of `StagedProposalProcessor`.
- [`StagedProposalProcessor`](/abi/staged-proposal-processor-plugin/StagedProposalProcessor.md) — A multi-stage proposal processor where proposals progress through defined stages.
- [`StagedProposalProcessorSetup`](/abi/staged-proposal-processor-plugin/StagedProposalProcessorSetup.md) — The setup contract of the `StagedProposalProcessor` plugin.
## Libraries
- [`Errors`](/abi/staged-proposal-processor-plugin/Errors.md) — Library containing all custom errors the plugin may revert with.
- [`Permissions`](/abi/staged-proposal-processor-plugin/Permissions.md)
- [`PluginSettings`](/abi/staged-proposal-processor-plugin/PluginSettings.md) — Provides constant values and metadata for the "StagedProposalProcessor" plugin, including contract names, versioning, and IPFS metadata for builds and releases.
# SPPRuleCondition
**Contract** · [`src/utils/SPPRuleCondition.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/utils/SPPRuleCondition.sol)
**Explained in:** [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md)
**Author:** Aragon X - 2024
**Inherits:** `DaoAuthorizableUpgradeable`, `RuledCondition`
The SPP Condition that must be granted for `createProposal` function of `StagedProposalProcessor`.
> **Dev:** This contract must be deployed either with clonable or `new` keyword.
## Constructor
### constructor
```solidity
constructor(address _dao, RuledCondition.Rule[] _rules)
```
Disables the initializers on the implementation contract to prevent it from being left uninitialized.
**oz-upgrades-unsafe-allow:** constructor
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | |
| `_rules` | [`RuledCondition.Rule[]`](#rule) | |
## Functions
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### decodeRuleValue
```solidity
function decodeRuleValue(uint256 _x) external pure returns (uint32 a, uint32 b, uint32 c)
```
Selector: `0x1498b514`
Decodes rule indices into three uint32.
| Parameter | Type | Description |
| --- | --- | --- |
| `_x` | `uint256` | The value to decode. |
| Returns | Type | Description |
| --- | --- | --- |
| `a` | `uint32` | The first 32-bit segment. |
| `b` | `uint32` | The second 32-bit segment. |
| `c` | `uint32` | The third 32-bit segment. |
### encodeIfElse
```solidity
function encodeIfElse(
uint256 startingRuleIndex,
uint256 successRuleIndex,
uint256 failureRuleIndex
) external pure returns (uint240)
```
Selector: `0x23e8cefc`
Encodes rule indices into a uint240 value.
| Parameter | Type | Description |
| --- | --- | --- |
| `startingRuleIndex` | `uint256` | The index of the starting rule to evaluate. |
| `successRuleIndex` | `uint256` | The index of the rule to evaluate if the evaluation of `startingRuleIndex` was true. |
| `failureRuleIndex` | `uint256` | The index of the rule to evaluate if the evaluation of `startingRuleIndex` was false. |
### encodeLogicalOperator
```solidity
function encodeLogicalOperator(
uint256 ruleIndex1,
uint256 ruleIndex2
) external pure returns (uint240)
```
Selector: `0xd09e5361`
Encodes two rule indexes into a uint240 value. Useful for logical operators such as `AND/OR/XOR` and others.
| Parameter | Type | Description |
| --- | --- | --- |
| `ruleIndex1` | `uint256` | The first index to evaluate. |
| `ruleIndex2` | `uint256` | The second index to evaluate. |
### getRules
```solidity
function getRules() external view returns (RuledCondition.Rule[])
```
Selector: `0x45e2984a`
Retrieves the current rules stored in this contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`RuledCondition.Rule[]`](#rule) | |
### initialize
```solidity
function initialize(address _dao, RuledCondition.Rule[] _rules) external
```
Selector: `0xe87c7fa8`
Initializes the component.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The IDAO interface of the associated DAO. |
| `_rules` | [`RuledCondition.Rule[]`](#rule) | The rules that decide who can create a proposal on `StagedProposalProcessor`. |
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes
) external view returns (bool isPermitted)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `[3]` | `bytes` | |
| Returns | Type | Description |
| --- | --- | --- |
| `isPermitted` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns `true` if the interface is supported. |
### updateRules
```solidity
function updateRules(RuledCondition.Rule[] _rules) external
```
Selector: `0x8306b5f1`
Updates the rules that will be used as a check upon proposal creation on `StagedProposalProcessor`.
| Parameter | Type | Description |
| --- | --- | --- |
| `_rules` | [`RuledCondition.Rule[]`](#rule) | The rules that decide who can create a proposal on `StagedProposalProcessor`. |
## Events
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### RulesUpdated
```solidity
event RulesUpdated(RuledCondition.Rule[] rules)
```
Emitted when the rules are updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `rules` | [`RuledCondition.Rule[]`](#rule) | The new rules that replaces old rules. |
## Errors
### DaoUnauthorized
```solidity
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. |
## Constants
_Public, so each is also readable through a generated getter._
### UPDATE_RULES_PERMISSION_ID
```solidity
bytes32 public constant UPDATE_RULES_PERMISSION_ID = keccak256("UPDATE_RULES_PERMISSION");
```
Value: `0xd3d98e95f3486fc234d80c098cf0d2a0a3fb187833d7e9cc930f8c4f8335a0e7`
The ID of the permission required to call the `updateRules` function.
## Enums
### Op
_Inherited from `RuledCondition`._
```solidity
enum Op {
NONE,
EQ,
NEQ,
GT,
LT,
GTE,
LTE,
RET,
NOT,
AND,
OR,
XOR,
IF_ELSE
}
```
Represents various operations that can be performed in a rule.
| Option | Value | Description |
| --- | --- | --- |
| `NONE` | `0` | No operation. |
| `EQ` | `1` | Equal to operation. |
| `NEQ` | `2` | Not equal to operation. |
| `GT` | `3` | Greater than operation. |
| `LT` | `4` | Less than operation. |
| `GTE` | `5` | Greater than or equal to operation. |
| `LTE` | `6` | Less than or equal to operation. |
| `RET` | `7` | Return the evaluation result. |
| `NOT` | `8` | Logical NOT operation. |
| `AND` | `9` | Logical AND operation. |
| `OR` | `10` | Logical OR operation. |
| `XOR` | `11` | Logical XOR operation. |
| `IF_ELSE` | `12` | Conditional evaluation with IF-ELSE logic. |
## Structs
### Rule
_Inherited from `RuledCondition`._
```solidity
struct Rule {
uint8 id;
uint8 op;
uint240 value;
bytes32 permissionId;
}
```
Represents a rule used in the condition contract.
| Field | Type | Description |
| --- | --- | --- |
| `id` | `uint8` | The ID representing the identifier of the rule. |
| `op` | `uint8` | The operation to apply, as defined in the `Op` enum. |
| `value` | `uint240` | The value associated with this rule, which could be an address, timestamp, etc. |
| `permissionId` | `bytes32` | The specific permission ID to use for evaluating this rule. If set to `0x`, the passed permission ID will be used. |
# StagedProposalProcessor
**Contract** · [`src/StagedProposalProcessor.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/StagedProposalProcessor.sol)
**Explained in:** [Composing SPP bodies](/plugins/spp-plugin/composing-bodies.md), [SPP lifecycle & state machine](/plugins/spp-plugin/lifecycle.md), [SPP stages & bodies](/plugins/spp-plugin/stages-and-bodies.md), [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md)
**Author:** Aragon X - 2024
**Inherits:** `ProposalUpgradeable`, `MetadataExtensionUpgradeable`, `PluginUUPSUpgradeable`
A multi-stage proposal processor where proposals progress through defined stages.
Each stage is evaluated by the responsible bodies, determining whether the proposal advances
to the next stage. Once a proposal successfully passes all stages, it can be executed.
## Functions
### advanceProposal
```solidity
function advanceProposal(uint256 _proposalId) external
```
Selector: `0xfdbd7eb3`
Advances the specified proposal to the next stage if allowed.
> **Dev:** This function checks whether the proposal exists and can advance based on its current state.
> If the proposal is in the final stage, the caller must have the
> `EXECUTE_PERMISSION_ID` permission to execute it.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### cancel
```solidity
function cancel(uint256 _proposalId) external
```
Selector: `0x40e58ee5`
Cancels the proposal.
> **Dev:** The proposal can be canceled only if it's allowed in the stage configuration.
> The caller must have the `CANCEL_PERMISSION_ID` permission to cancel it.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The id of the proposal. |
### canExecute
```solidity
function canExecute(uint256 _proposalId) external view returns (bool)
```
Selector: `0xcc63604a`
Checks if a proposal can be executed.
| 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. |
### canProposalAdvance
```solidity
function canProposalAdvance(uint256 _proposalId) external view returns (bool)
```
Selector: `0x5c23bfb7`
Determines whether the specified proposal can be advanced to the next stage.
> **Dev:** Reverts if the proposal with the given `_proposalId` does not exist.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The unique identifier of the proposal to check. |
### createProposal(bytes,(address,uint256,bytes)[],uint128,uint64,bytes[][])
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint128 _allowFailureMap,
uint64 _startDate,
bytes[][] _proposalParams
) external returns (uint256 proposalId)
```
Selector: `0x35ade049`
Creates a new proposal in this `StagedProposalProcessor` plugin.
> **Dev:** Requires the caller to have the `CREATE_PROPOSAL_PERMISSION_ID` permission.
> Also creates proposals for non-manual bodies in the first stage of the proposal process.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_allowFailureMap` | `uint128` | Allows 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. |
| `_startDate` | `uint64` | The date at which first stage's bodies' proposals must be started at. |
| `_proposalParams` | `bytes[][]` | The extra abi encoded parameters for each sub-body's createProposal function. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### createProposal(bytes,(address,uint256,bytes)[],uint64,uint64,bytes)
```solidity
function createProposal(
bytes _metadata,
Action[] _actions,
uint64 _startDate,
uint64,
bytes _data
) external returns (uint256 proposalId)
```
Selector: `0xea65ab82`
Creates a new proposal.
> **Dev:** Calls a public function that requires the `CREATE_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `[3]` | `uint64` | |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### customProposalParamsABI
```solidity
function customProposalParamsABI() external pure returns (string)
```
Selector: `0x3d3f4b1b`
The human-readable abi format for extra params included in `data` of `createProposal`.
> **Dev:** This plugin inherits from `IProposal`, requiring an override for this function.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI of params in `data` of `createProposal`. |
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### edit
```solidity
function edit(uint256 _proposalId, bytes _metadata, Action[] _actions) external
```
Selector: `0x0b47808d`
Edits the proposal.
> **Dev:** The proposal can be editable only if it's allowed in the stage configuration.
> The caller must have the `EDIT_PERMISSION_ID` permission to edit
> and stage must be advanceable.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The id of the proposal. |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
> **Dev:** Requires the `EXECUTE_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getBodyProposalId
```solidity
function getBodyProposalId(
uint256 _proposalId,
uint16 _stageId,
address _body
) external view returns (uint256)
```
Selector: `0x1c622dea`
Retrieves the sub proposal id.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_stageId` | `uint16` | The stage index. |
| `_body` | `address` | The address of the sub-body. |
### getBodyResult
```solidity
function getBodyResult(
uint256 _proposalId,
uint16 _stageId,
address _body
) external view returns (StagedProposalProcessor.ResultType)
```
Selector: `0x761f8acb`
Retrieves the result type submitted by a body for a specific proposal and stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_stageId` | `uint16` | The stage index. |
| `_body` | `address` | The address of the sub-body. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`StagedProposalProcessor.ResultType`](#resulttype) | |
### getCreateProposalParams
```solidity
function getCreateProposalParams(
uint256 _proposalId,
uint16 _stageId,
uint256 _index
) external view returns (bytes)
```
Selector: `0x1f3cb5b4`
Retrieves the `data` parameter encoded for a sub-body's `createProposal` function in a specific stage.
Excludes sub-bodies from the first stage, as their parameters are not stored for efficiency.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_stageId` | `uint16` | The stage index. |
| `_index` | `uint256` | The index of the body within the stage. |
### getCurrentConfigIndex
```solidity
function getCurrentConfigIndex() external view returns (uint16)
```
Selector: `0x1abf3f11`
Retrieves the current configuration index at which the current configurations of stages are stored.
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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 (StagedProposalProcessor.Proposal)
```
Selector: `0xc7f758a8`
Retrieves all information associated with a proposal by its ID.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`StagedProposalProcessor.Proposal`](#proposal) | |
### getProposalTally
```solidity
function getProposalTally(
uint256 _proposalId,
uint16 _stageId
) external view returns (uint256 approvals, uint256 vetoes)
```
Selector: `0x4e3ed5e9`
Calculates and retrieves the number of approvals and vetoes for a proposal on the stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The proposal ID. |
| `_stageId` | `uint16` | The stage index. |
| Returns | Type | Description |
| --- | --- | --- |
| `approvals` | `uint256` | The total number of approvals for the proposal. |
| `vetoes` | `uint256` | The total number of vetoes for the proposal. |
### getStages
```solidity
function getStages(uint256 _index) external view returns (StagedProposalProcessor.Stage[])
```
Selector: `0xef8cccb0`
Retrieves the stages stored on the `_index` in the `stages` configuration.
| Parameter | Type | Description |
| --- | --- | --- |
| `_index` | `uint256` | The index from which to get the stages configuration. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`StagedProposalProcessor.Stage[]`](#stage) | |
### 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#targetconfig) | |
### getTrustedForwarder
```solidity
function getTrustedForwarder() external view returns (address)
```
Selector: `0xce1b815f`
Retrieves the address of the trusted forwarder.
### hasAdvancePermission
```solidity
function hasAdvancePermission(address _account) external view returns (bool)
```
Selector: `0x7e3f1353`
Checks whether the caller has the required permission to advance a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The address on which the `ADVANCE_PERMISSION_ID` is checked. |
### hasExecutePermission
```solidity
function hasExecutePermission(address _account) external view returns (bool)
```
Selector: `0xfd8d2d36`
Checks whether the caller has the required permission to execute a proposal at the last stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `_account` | `address` | The address on which the `EXECUTE_PERMISSION_ID` is checked. |
### hasSucceeded
```solidity
function hasSucceeded(uint256 _proposalId) external view returns (bool)
```
Selector: `0xc218c132`
Whether proposal succeeded or not.
> **Dev:** Note that this must not include time window checks and only make a decision based on the thresholds.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### initialize
```solidity
function initialize(
IDAO _dao,
address _trustedForwarder,
StagedProposalProcessor.Stage[] _stages,
bytes _pluginMetadata,
IPlugin.TargetConfig _targetConfig
) external
```
Selector: `0xbfde57c3`
Initializes the component.
> **Dev:** This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The IDAO interface of the associated DAO. |
| `_trustedForwarder` | `address` | The trusted forwarder responsible for extracting the original sender. |
| `_stages` | [`StagedProposalProcessor.Stage[]`](#stage) | The stages configuration. |
| `_pluginMetadata` | `bytes` | The utf8 bytes of a content addressing cid that stores plugin's information. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target to which this contract will pass actions with an operation type. |
### isTrustedForwarder
```solidity
function isTrustedForwarder(address _forwarder) external view returns (bool)
```
Selector: `0x572b6c05`
Indicates whether any particular address is the trusted forwarder.
| Parameter | Type | Description |
| --- | --- | --- |
| `_forwarder` | `address` | The address of the Forwarder contract that is being used. |
### pluginType
```solidity
function pluginType() external pure returns (IPlugin.PluginType)
```
Selector: `0x41de6830`
Returns the plugin's type
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
### reportProposalResult
```solidity
function reportProposalResult(
uint256 _proposalId,
uint16 _stageId,
StagedProposalProcessor.ResultType _resultType,
bool _tryAdvance
) external
```
Selector: `0x52303962`
Reports and records the result for a proposal at a specific stage.
> **Dev:** This function can be called by any address even if it is not included in the stage configuration.
> `_canProposalAdvance` function ensures that only records from addresses
> in the stage configuration are used.
> If `_tryAdvance` is true, the proposal will attempt to advance to the next stage if eligible.
> Requires the caller to have the `EXECUTE_PERMISSION_ID` permission to execute the final stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_stageId` | `uint16` | The index of the stage, being reported on. Must not exceed the current stage of the proposal. |
| `_resultType` | [`StagedProposalProcessor.ResultType`](#resulttype) | The result type being reported (`Approval` or `Veto`). |
| `_tryAdvance` | `bool` | Whether to attempt advancing the proposal to the next stage if conditions are met. |
### setMetadata
```solidity
function setMetadata(bytes _metadata) external
```
Selector: `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
```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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target Config containing the address and operation type. |
### setTrustedForwarder
```solidity
function setTrustedForwarder(address _forwarder) external
```
Selector: `0xda742228`
Sets a new trusted forwarder address.
> **Dev:** Requires the caller to have the `SET_TRUSTED_FORWARDER_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_forwarder` | `address` | The new trusted forwarder address. |
### state
```solidity
function state(
uint256 _proposalId
) external view returns (StagedProposalProcessor.ProposalState)
```
Selector: `0x3e4f49e6`
Current state of a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The proposal id. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`StagedProposalProcessor.ProposalState`](#proposalstate) | |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### updateStages
```solidity
function updateStages(StagedProposalProcessor.Stage[] _stages) external
```
Selector: `0x30196ab9`
Allows to update stage configuration.
> **Dev:** Requires the caller to have the `UPDATE_STAGES_PERMISSION_ID` permission.
> Reverts if the provided `_stages` array is empty.
| Parameter | Type | Description |
| --- | --- | --- |
| `_stages` | [`StagedProposalProcessor.Stage[]`](#stage) | The new stage configuration as an array of `Stage` structs. |
### 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
## 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.
### ProposalAdvanced
```solidity
event ProposalAdvanced(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed sender
)
```
Emitted when the proposal is advanced to the next stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal id. |
| `stageId` | `uint16` | The stage index. |
| `sender` | `address` | The address that advanced the proposal. |
### ProposalCanceled
```solidity
event ProposalCanceled(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed sender
)
```
Emitted when the proposal gets cancelled.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | the proposal id. |
| `stageId` | `uint16` | The stage index in which the proposal was cancelled. |
| `sender` | `address` | The sender that canceled the proposal. |
### 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.
| 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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
### ProposalEdited
```solidity
event ProposalEdited(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed sender,
bytes metadata,
Action[] actions
)
```
Emitted when the proposal gets edited.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | the proposal id. |
| `stageId` | `uint16` | The stage index in which the proposal was edited. |
| `sender` | `address` | The sender that edited the proposal. |
| `metadata` | `bytes` | The new metadata that replaces old metadata. |
| `actions` | `Action[]` | The new actions that replaces old actions. |
### ProposalExecuted
```solidity
event ProposalExecuted(uint256 indexed proposalId)
```
Emitted when a proposal is executed.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### ProposalResultReported
```solidity
event ProposalResultReported(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed body
)
```
Emitted when a body reports results by calling `reportProposalResult`.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal id. |
| `stageId` | `uint16` | The stage index. |
| `body` | `address` | The sender that reported the result. |
### StagesUpdated
```solidity
event StagesUpdated(StagedProposalProcessor.Stage[] stages)
```
Emitted when the stage configuration is updated for a proposal process.
| Parameter | Type | Description |
| --- | --- | --- |
| `stages` | [`StagedProposalProcessor.Stage[]`](#stage) | The array of `Stage` structs representing the updated stage configuration. |
### SubProposalCreated
```solidity
event SubProposalCreated(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed body,
uint256 bodyProposalId
)
```
Emitted when this plugin successfully creates a proposal on sub-body.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal id. |
| `stageId` | `uint16` | The stage index. |
| `body` | `address` | The sub-body on which sub-proposal has been created. |
| `bodyProposalId` | `uint256` | The proposal id that sub-body returns for later usage by this plugin. |
### SubProposalNotCreated
```solidity
event SubProposalNotCreated(
uint256 indexed proposalId,
uint16 indexed stageId,
address indexed body,
bytes reason
)
```
Emitted when this plugin fails in creating a proposal on sub-body.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The proposal id. |
| `stageId` | `uint16` | The stage index. |
| `body` | `address` | The sub-body on which sub-proposal failed to be created. |
| `reason` | `bytes` | The reason why it was failed. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | |
### TrustedForwarderUpdated
```solidity
event TrustedForwarderUpdated(address indexed forwarder)
```
Emitted when the trusted forwarder is updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `forwarder` | `address` | The new trusted forwarder address. |
### Upgraded
```solidity
event Upgraded(address indexed implementation)
```
> **Dev:** Emitted when the implementation is upgraded.
## Errors
### AlreadyInitialized
```solidity
error AlreadyInitialized()
```
Thrown when initialize is called after it has already been executed.
### BodyResultTypeNotSet
```solidity
error BodyResultTypeNotSet(address body)
```
Thrown if the body result type is not set.
| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `address` | The address of the body. |
### DaoUnauthorized
```solidity
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. |
### DelegateCallFailed
```solidity
error DelegateCallFailed()
```
Thrown when `delegatecall` fails.
### DuplicateBodyAddress
```solidity
error DuplicateBodyAddress(uint256 stageId, address body)
```
Thrown if a body address is duplicated in the same stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `stageId` | `uint256` | The stage id that contains the duplicated body address. |
| `body` | `address` | The address that is duplicated in `stageId`. |
### FunctionDeprecated
```solidity
error FunctionDeprecated()
```
### InsufficientGas
```solidity
error InsufficientGas()
```
### InterfaceNotSupported
```solidity
error InterfaceNotSupported()
```
Thrown when a body doesn't support IProposal interface.
### InvalidTargetConfig
```solidity
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)
```
Thrown when target is of type 'IDAO', but operation is `delegateCall`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target config to update it to. |
### NonexistentProposal
```solidity
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. |
### ProposalAdvanceForbidden
```solidity
error ProposalAdvanceForbidden(uint256 proposalId)
```
Thrown if the proposal advance is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### ProposalAlreadyExists
```solidity
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. |
### ProposalCanNotBeCancelled
```solidity
error ProposalCanNotBeCancelled(uint256 proposalId, uint16 stageId)
```
Thrown if the proposal is not cancelable in the `stageId`.
### ProposalCanNotBeEdited
```solidity
error ProposalCanNotBeEdited(uint256 proposalId, uint16 stageId)
```
Thrown if the proposal is not editable.
> **Dev:** This can happen in 2 cases: either Proposal can not yet be advanced or, The stage has `editable:false` in the configuration.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
| `stageId` | `uint16` | |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### StageCountZero
```solidity
error StageCountZero()
```
Thrown when the stages length is zero.
### StageDurationsInvalid
```solidity
error StageDurationsInvalid()
```
Thrown if stage durations are invalid.
### StageIdInvalid
```solidity
error StageIdInvalid(uint64 currentStageId, uint64 reportedStageId)
```
Thrown when the body tries to submit report for the stage id that has not yet become active.
| Parameter | Type | Description |
| --- | --- | --- |
| `currentStageId` | `uint64` | The stage id that proposal is currently at. |
| `reportedStageId` | `uint64` | The stage id for which the report is being submitted. |
### StageThresholdsInvalid
```solidity
error StageThresholdsInvalid()
```
Thrown if the thresholds are invalid.
### StartDateInvalid
```solidity
error StartDateInvalid(uint64)
```
Thrown if the start date is less than current timestamp.
### Uint16MaxSizeExceeded
```solidity
error Uint16MaxSizeExceeded()
```
Thrown if `_proposalParams`'s length exceeds `type(uint16).max`.
### UnexpectedProposalState
```solidity
error UnexpectedProposalState(uint256 proposalId, uint8 currentState, bytes32 allowedStates)
```
Thrown if the proposal's state doesn't match the allowed state.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
| `currentState` | `uint8` | The current state of the proposal. |
| `allowedStates` | `bytes32` | The allowed state that must match the `currentState`, otherwise the error is thrown. |
## Constants
_Public, so each is also readable through a generated getter._
### 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.
### 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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
### ProposalState
```solidity
enum ProposalState {
Active,
Canceled,
Executed,
Advanceable,
Expired
}
```
The states of the proposal.
| Option | Value | Description |
| --- | --- | --- |
| `Active` | `0` | Whether the proposal is not advanceable. |
| `Canceled` | `1` | Whether the proposal is canceled. |
| `Executed` | `2` | Whether the proposal is executed. |
| `Advanceable` | `3` | Whether the proposal can be advanced to the next stage. |
| `Expired` | `4` | Whether the proposal's stage maxAdvance time has passed. |
### ResultType
```solidity
enum ResultType {
None,
Approval,
Veto
}
```
The different types that bodies can be registered as.
| Option | Value | Description |
| --- | --- | --- |
| `None` | `0` | Used to check if the body reported the result or not. |
| `Approval` | `1` | Used to allow a body to report approval result. |
| `Veto` | `2` | Used to allow a body to report veto result. |
## Structs
### Body
```solidity
struct Body {
address addr;
bool isManual;
bool tryAdvance;
StagedProposalProcessor.ResultType resultType;
}
```
A container for Body-related information.
| Field | Type | Description |
| --- | --- | --- |
| `addr` | `address` | The address responsible for reporting results. For automatic bodies, it is also where the SPP creates proposals. |
| `isManual` | `bool` | Whether SPP should create a proposal on a body. If true, it will not create. |
| `tryAdvance` | `bool` | Whether to try to automatically advance the stage when a body reports results. |
| `resultType` | [`StagedProposalProcessor.ResultType`](#resulttype) | The type(`Approval` or `Veto`) this body is registered with. |
### MetadataExtensionStorage
_Inherited from `MetadataExtensionUpgradeable`._
```solidity
struct MetadataExtensionStorage {
bytes metadata;
}
```
### Proposal
```solidity
struct Proposal {
uint128 allowFailureMap;
uint64 lastStageTransition;
uint16 currentStage;
uint16 stageConfigIndex;
bool executed;
bool canceled;
address creator;
Action[] actions;
IPlugin.TargetConfig targetConfig;
}
```
A container for proposal-related information.
| Field | Type | Description |
| --- | --- | --- |
| `allowFailureMap` | `uint128` | A bitmap allowing the proposal to succeed, even if individual actions might revert. |
| `lastStageTransition` | `uint64` | The timestamp at which proposal's current stage has started. |
| `currentStage` | `uint16` | Which stage the proposal is at. |
| `stageConfigIndex` | `uint16` | The stage configuration that this proposal uses. |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `canceled` | `bool` | Whether the proposal is canceled or not. |
| `creator` | `address` | The creator of the proposal. |
| `actions` | `Action[]` | The actions to be executed when the proposal passes. |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The target to which this contract will pass actions with an operation type. |
### Stage
```solidity
struct Stage {
StagedProposalProcessor.Body[] bodies;
uint64 maxAdvance;
uint64 minAdvance;
uint64 voteDuration;
uint16 approvalThreshold;
uint16 vetoThreshold;
bool cancelable;
bool editable;
}
```
A container for stage-related information.
| Field | Type | Description |
| --- | --- | --- |
| `bodies` | [`StagedProposalProcessor.Body[]`](#body) | The bodies that are responsible for advancing the stage. |
| `maxAdvance` | `uint64` | The maximum duration after which stage can not be advanced. |
| `minAdvance` | `uint64` | The minimum duration until when stage can not be advanced. |
| `voteDuration` | `uint64` | The time to give vetoing bodies to make decisions in optimistic stage. Note that this also is used as an endDate time for bodies, see `_createBodyProposals`. |
| `approvalThreshold` | `uint16` | The number of bodies that are required to pass to advance the proposal. |
| `vetoThreshold` | `uint16` | If this number of bodies veto, the proposal can never advance even if `approvalThreshold` is satisfied. |
| `cancelable` | `bool` | If the proposal can be cancelled in the stage. |
| `editable` | `bool` | If the proposal can be edited in the stage. |
### 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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
# StagedProposalProcessorSetup
**Contract** · [`src/StagedProposalProcessorSetup.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/StagedProposalProcessorSetup.sol)
**Explained in:** [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md)
**Author:** Aragon X - 2024
**Inherits:** `PluginUpgradeableSetup`
The setup contract of the `StagedProposalProcessor` plugin.
> **Dev:** Release 1, Build 2
## Constructor
### constructor
```solidity
constructor(StagedProposalProcessor _spp)
```
Constructs the `PluginUpgradeableSetup` by storing the `SPP` implementation address.
> **Dev:** The implementation address is used to deploy UUPS proxies referencing it and
> to verify the plugin on the respective block explorers.
| Parameter | Type | Description |
| --- | --- | --- |
| `_spp` | [`StagedProposalProcessor`](/abi/staged-proposal-processor-plugin/StagedProposalProcessor.md) | |
## Functions
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _installationParams
) external returns (address spp, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_installationParams` | `bytes` | |
| Returns | Type | Description |
| --- | --- | --- |
| `spp` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external pure returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** v1.1 → v1.2: deploys a fresh `SPPRuleCondition` seeded with the existing rules and migrates
> `CREATE_PROPOSAL_PERMISSION` (on the plugin) and `UPDATE_RULES_PERMISSION` (on the helper) from
> the old condition to the new one. The plugin proxy itself is upgraded to the new implementation
> by the `PluginSetupProcessor` automatically; no reinitializer is required because no new storage
> is introduced in build 2. Existing rules are read from the old helper, so no caller-supplied data
> is required — `_payload.data` is ignored.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
## Errors
### InvalidUpdatePath
```solidity
error InvalidUpdatePath(uint16 fromBuild, uint16 thisBuild)
```
Thrown when an update path is not available, for example, if this is the initial build.
| Parameter | Type | Description |
| --- | --- | --- |
| `fromBuild` | `uint16` | The build number to update from. |
| `thisBuild` | `uint16` | The build number of this setup to update to. |
## Constants
_Public, so each is also readable through a generated getter._
### CLONES_SUPPORTED
```solidity
bool public immutable CLONES_SUPPORTED;
```
Whether the network supports EIP-1167 minimal proxies (clones).
> **Dev:** False on networks like ZkSync that lack CREATE2 clone support; falls back to UUPS.
### CONDITION_IMPLEMENTATION
```solidity
address public immutable CONDITION_IMPLEMENTATION;
```
The address of the condition implementation contract.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
# Errors
**Library** · [`src/libraries/Errors.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/libraries/Errors.sol)
**Explained in:** [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md)
**Author:** Aragon X - 2024
Library containing all custom errors the plugin may revert with.
## Errors
### BodyResultTypeNotSet
```solidity
error BodyResultTypeNotSet(address body)
```
Thrown if the body result type is not set.
| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `address` | The address of the body. |
### DuplicateBodyAddress
```solidity
error DuplicateBodyAddress(uint256 stageId, address body)
```
Thrown if a body address is duplicated in the same stage.
| Parameter | Type | Description |
| --- | --- | --- |
| `stageId` | `uint256` | The stage id that contains the duplicated body address. |
| `body` | `address` | The address that is duplicated in `stageId`. |
### EmptyMetadata
```solidity
error EmptyMetadata()
```
Thrown when the metadata is empty.
### IncorrectActionCount
```solidity
error IncorrectActionCount()
```
Thrown when trusted forwarder can not execute the actions.
### InsufficientGas
```solidity
error InsufficientGas()
```
### InterfaceNotSupported
```solidity
error InterfaceNotSupported()
```
Thrown when a body doesn't support IProposal interface.
### InvalidCustomParamsForFirstStage
```solidity
error InvalidCustomParamsForFirstStage()
```
Thrown if first stage's params don't match the count of the current first stage's bodies' count.
### NonexistentProposal
```solidity
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. |
### ProposalAdvanceForbidden
```solidity
error ProposalAdvanceForbidden(uint256 proposalId)
```
Thrown if the proposal advance is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### ProposalAlreadyCancelled
```solidity
error ProposalAlreadyCancelled(uint256 proposalId)
```
Thrown if the proposal has already been cancelled.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### ProposalAlreadyExists
```solidity
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. |
### ProposalCanNotBeCancelled
```solidity
error ProposalCanNotBeCancelled(uint256 proposalId, uint16 stageId)
```
Thrown if the proposal is not cancelable in the `stageId`.
### ProposalCanNotBeEdited
```solidity
error ProposalCanNotBeEdited(uint256 proposalId, uint16 stageId)
```
Thrown if the proposal is not editable.
> **Dev:** This can happen in 2 cases:
> either Proposal can not yet be advanced or,
> The stage has `editable:false` in the configuration.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
| `stageId` | `uint16` | |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### StageCountZero
```solidity
error StageCountZero()
```
Thrown when the stages length is zero.
### StageDurationsInvalid
```solidity
error StageDurationsInvalid()
```
Thrown if stage durations are invalid.
### StageIdInvalid
```solidity
error StageIdInvalid(uint64 currentStageId, uint64 reportedStageId)
```
Thrown when the body tries to submit report for the stage id that has not yet become active.
| Parameter | Type | Description |
| --- | --- | --- |
| `currentStageId` | `uint64` | The stage id that proposal is currently at. |
| `reportedStageId` | `uint64` | The stage id for which the report is being submitted. |
### StageThresholdsInvalid
```solidity
error StageThresholdsInvalid()
```
Thrown if the thresholds are invalid.
### StartDateInvalid
```solidity
error StartDateInvalid(uint64)
```
Thrown if the start date is less than current timestamp.
### Uint16MaxSizeExceeded
```solidity
error Uint16MaxSizeExceeded()
```
Thrown if `_proposalParams`'s length exceeds `type(uint16).max`.
### UnexpectedProposalState
```solidity
error UnexpectedProposalState(uint256 proposalId, uint8 currentState, bytes32 allowedStates)
```
Thrown if the proposal's state doesn't match the allowed state.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
| `currentState` | `uint8` | The current state of the proposal. |
| `allowedStates` | `bytes32` | The allowed state that must match the `currentState`, otherwise the error is thrown. |
# Permissions
**Library** · [`src/libraries/Permissions.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/libraries/Permissions.sol)
# PluginSettings
**Library** · [`src/utils/PluginSettings.sol`](https://github.com/aragon/staged-proposal-processor-plugin/blob/96b83dd5da22930e8d9bcc211cf4e57aaf5270f2/src/utils/PluginSettings.sol)
**Explained in:** [Staged Proposal Processor (SPP)](/plugins/spp-plugin.md)
**Author:** Aragon X - 2024
Provides constant values and metadata for the "StagedProposalProcessor" plugin,
including contract names, versioning, and IPFS metadata for builds and releases.
## Constants
_Public, so each is also readable through a generated getter._
### BUILD_METADATA
```solidity
string public constant BUILD_METADATA =
"ipfs://QmaxGSvvnTAZcDLYz2BMtaXmcx3i1GcaKGaxNEpfQe3Vyv";
```
### PLACEHOLDER_BUILD_METADATA
```solidity
string public constant PLACEHOLDER_BUILD_METADATA =
"ipfs://QmZDx8G5xuF9vqVbFGZ3KhF5nioL8gXwV3JbsEsSHvNMiz";
```
Aragon's canonical empty-schema placeholder build metadata, used when filling skipped builds
on a fresh-network deploy so onchain build numbers stay aligned across networks.
> **Dev:** Content-addressed; the file at `lib/osx/.../placeholder/placeholder-build-metadata.json` always pins to this CID.
### PLUGIN_CONTRACT_NAME
```solidity
string public constant PLUGIN_CONTRACT_NAME = "StagedProposalProcessor";
```
### PLUGIN_REPO_ENS_SUBDOMAIN_NAME
```solidity
string public constant PLUGIN_REPO_ENS_SUBDOMAIN_NAME = "spp";
```
### PLUGIN_SETUP_CONTRACT_NAME
```solidity
string public constant PLUGIN_SETUP_CONTRACT_NAME = "StagedProposalProcessorSetup";
```
### PROPOSAL_METADATA
```solidity
string public constant PROPOSAL_METADATA =
"ipfs://QmTS3Nrjrs8nuMeqUqSRjBxbGUhZB4nW6N1GiK8vFmfDcD";
```
Title/summary/description/resources JSON pinned for this version's management DAO proposal.
> **Dev:** Re-pin and update on every VERSION_BUILD bump. Source: `script/new-version-proposal-metadata.json`.
### RELEASE_METADATA
```solidity
string public constant RELEASE_METADATA =
"ipfs://bafkreif23p6yw325rkwwlhgkudiasvq64lonqmfnt7ls5ksfam5hedcb4m";
```
### VERSION_BUILD
```solidity
uint8 public constant VERSION_BUILD = 2;
```
### VERSION_RELEASE
```solidity
uint8 public constant VERSION_RELEASE = 1;
```
# token-voting-plugin — ABI reference
Generated from [`token-voting-plugin`](https://github.com/aragon/token-voting-plugin) at commit [`e97b783d`](https://github.com/aragon/token-voting-plugin/commit/e97b783d76872d694f41dfc4bc846405019ca741).
10 entries. Regenerate with `just abi`.
## Contracts
- [`GovernanceERC20`](/abi/token-voting-plugin/GovernanceERC20.md) — An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token,…
- [`GovernanceWrappedERC20`](/abi/token-voting-plugin/GovernanceWrappedERC20.md) — Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by inheriting from `ERC20WrapperUpgradeable` and allows using it for voting by…
- [`MajorityVotingBase`](/abi/token-voting-plugin/MajorityVotingBase.md) — The abstract implementation of majority voting plugins.
- [`TokenVoting`](/abi/token-voting-plugin/TokenVoting.md) — The majority voting implementation using an [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible governance token.
- [`TokenVotingSetup`](/abi/token-voting-plugin/TokenVotingSetup.md) — The setup contract of the `TokenVoting` plugin.
- [`TokenVotingSetupZkSync`](/abi/token-voting-plugin/TokenVotingSetupZkSync.md) — The setup contract of the `TokenVoting` plugin.
- [`VotingPowerCondition`](/abi/token-voting-plugin/VotingPowerCondition.md) — Checks if an account's voting power or token balance meets the threshold set in an associated TokenVoting plugin.
## Interfaces
- [`IERC20MintableUpgradeable`](/abi/token-voting-plugin/IERC20MintableUpgradeable.md) — Interface to allow minting of [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
- [`IGovernanceWrappedERC20`](/abi/token-voting-plugin/IGovernanceWrappedERC20.md) — An interface for the token wrapping contract wrapping existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
- [`IMajorityVoting`](/abi/token-voting-plugin/IMajorityVoting.md) — The interface of majority voting plugin.
# GovernanceERC20
**Contract** · [`src/erc20/GovernanceERC20.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/erc20/GovernanceERC20.sol)
**Explained in:** [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md)
**Author:** Aragon X
**Inherits:** [`IERC20MintableUpgradeable`](/abi/token-voting-plugin/IERC20MintableUpgradeable.md), `Initializable`, `ERC165Upgradeable`, `ERC20VotesUpgradeable`, `DaoAuthorizableUpgradeable`
An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes)
compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token, used for voting and managed by a DAO.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(IDAO _dao, string _name, string _symbol, GovernanceERC20.MintSettings _mintSettings)
```
Calls the initialize function.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The managing DAO. |
| `_name` | `string` | The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token. |
| `_symbol` | `string` | The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token. |
| `_mintSettings` | [`GovernanceERC20.MintSettings`](#mintsettings) | The token mint settings struct containing the `receivers`, the `amounts` and `ensureDelegationOnMint`. |
## Functions
### allowance
```solidity
function allowance(address owner, address spender) external view returns (uint256)
```
Selector: `0xdd62ed3e`
> **Dev:** See {IERC20-allowance}.
### approve
```solidity
function approve(address spender, uint256 amount) external returns (bool)
```
Selector: `0x095ea7b3`
> **Dev:** See {IERC20-approve}.
>
> NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
> `transferFrom`. This is semantically equivalent to an infinite approval.
>
> Requirements:
>
> - `spender` cannot be the zero address.
### balanceOf
```solidity
function balanceOf(address account) external view returns (uint256)
```
Selector: `0x70a08231`
> **Dev:** See {IERC20-balanceOf}.
### checkpoints
```solidity
function checkpoints(
address account,
uint32 pos
) external view returns (ERC20VotesUpgradeable.Checkpoint)
```
Selector: `0xf1127ed8`
> **Dev:** Get the `pos`-th checkpoint for `account`.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ERC20VotesUpgradeable.Checkpoint`](#checkpoint) | |
### clock
```solidity
function clock() external view returns (uint48)
```
Selector: `0x91ddadf4`
> **Dev:** Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
### CLOCK_MODE
```solidity
function CLOCK_MODE() external view returns (string)
```
Selector: `0x4bf5d7e9`
> **Dev:** Description of the clock
### dao
```solidity
function dao() external view returns (IDAO)
```
Selector: `0x4162169f`
Returns the DAO contract.
### decimals
```solidity
function decimals() external view returns (uint8)
```
Selector: `0x313ce567`
> **Dev:** Returns the number of decimals used to get its user representation.
> For example, if `decimals` equals `2`, a balance of `505` tokens should
> be displayed to a user as `5.05` (`505 / 10 ** 2`).
>
> Tokens usually opt for a value of 18, imitating the relationship between
> Ether and Wei. This is the default value returned by this function, unless
> it's overridden.
>
> NOTE: This information is only used for _display_ purposes: it in
> no way affects any of the arithmetic of the contract, including
> {IERC20-balanceOf} and {IERC20-transfer}.
### decreaseAllowance
```solidity
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool)
```
Selector: `0xa457c2d7`
> **Dev:** Atomically decreases the allowance granted to `spender` by the caller.
>
> This is an alternative to {approve} that can be used as a mitigation for
> problems described in {IERC20-approve}.
>
> Emits an {Approval} event indicating the updated allowance.
>
> Requirements:
>
> - `spender` cannot be the zero address.
> - `spender` must have allowance for the caller of at least
> `subtractedValue`.
### delegate
```solidity
function delegate(address delegatee) external
```
Selector: `0x5c19a95c`
> **Dev:** Delegate votes from the sender to `delegatee`.
### delegateBySig
```solidity
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external
```
Selector: `0xc3cda520`
> **Dev:** Delegates votes from signer to `delegatee`
### delegates
```solidity
function delegates(address account) external view returns (address)
```
Selector: `0x587cde1e`
> **Dev:** Get the address `account` is currently delegating to.
### DOMAIN_SEPARATOR
```solidity
function DOMAIN_SEPARATOR() external view returns (bytes32)
```
Selector: `0x3644e515`
> **Dev:** Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
### eip712Domain
```solidity
function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)
```
Selector: `0x84b0196e`
> **Dev:** See {EIP-5267}.
>
> _Available since v4.9._
### freezeMinting
```solidity
function freezeMinting() external
```
Selector: `0xc013f30f`
Disables the mint() function permanently
### getEnsureDelegationOnMint
```solidity
function getEnsureDelegationOnMint() external view returns (bool)
```
Selector: `0xd9957169`
Whether mint() enables self delegation if the receiver has no delegate.
### getMintingFrozen
```solidity
function getMintingFrozen() external view returns (bool)
```
Selector: `0x081f4b8c`
Returns true if the ability to mint tokens has been frozen
### getPastTotalSupply
```solidity
function getPastTotalSupply(uint256 timepoint) external view returns (uint256)
```
Selector: `0x8e539e8c`
> **Dev:** Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.
> It is NOT the sum of all the delegated votes!
>
> Requirements:
>
> - `timepoint` must be in the past
### getPastVotes
```solidity
function getPastVotes(address account, uint256 timepoint) external view returns (uint256)
```
Selector: `0x3a46b1a8`
> **Dev:** Retrieve the number of votes for `account` at the end of `timepoint`.
>
> Requirements:
>
> - `timepoint` must be in the past
### getVotes
```solidity
function getVotes(address account) external view returns (uint256)
```
Selector: `0x9ab24eb0`
> **Dev:** Gets the current votes balance for `account`
### increaseAllowance
```solidity
function increaseAllowance(address spender, uint256 addedValue) external returns (bool)
```
Selector: `0x39509351`
> **Dev:** Atomically increases the allowance granted to `spender` by the caller.
>
> This is an alternative to {approve} that can be used as a mitigation for
> problems described in {IERC20-approve}.
>
> Emits an {Approval} event indicating the updated allowance.
>
> Requirements:
>
> - `spender` cannot be the zero address.
### initialize
```solidity
function initialize(
IDAO _dao,
string _name,
string _symbol,
GovernanceERC20.MintSettings _mintSettings
) external
```
Selector: `0x6273f4dc`
Initializes the contract and mints tokens to a list of receivers.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The managing DAO. |
| `_name` | `string` | The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token. |
| `_symbol` | `string` | The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token. |
| `_mintSettings` | [`GovernanceERC20.MintSettings`](#mintsettings) | The token mint settings struct containing the `receivers`, the `amounts` and `ensureDelegationOnMint`. |
### mint
```solidity
function mint(address to, uint256 amount) external
```
Selector: `0x40c10f19`
Mints tokens to an address.
| Parameter | Type | Description |
| --- | --- | --- |
| `to` | `address` | The address receiving the tokens. |
| `amount` | `uint256` | The amount of tokens to be minted. |
### name
```solidity
function name() external view returns (string)
```
Selector: `0x06fdde03`
> **Dev:** Returns the name of the token.
### nonces
```solidity
function nonces(address owner) external view returns (uint256)
```
Selector: `0x7ecebe00`
> **Dev:** Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.
### numCheckpoints
```solidity
function numCheckpoints(address account) external view returns (uint32)
```
Selector: `0x6fcfff45`
> **Dev:** Get number of checkpoints for `account`.
### permit
```solidity
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external
```
Selector: `0xd505accf`
> **Dev:** Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### symbol
```solidity
function symbol() external view returns (string)
```
Selector: `0x95d89b41`
> **Dev:** Returns the symbol of the token, usually a shorter version of the
> name.
### totalSupply
```solidity
function totalSupply() external view returns (uint256)
```
Selector: `0x18160ddd`
> **Dev:** See {IERC20-totalSupply}.
### transfer
```solidity
function transfer(address to, uint256 amount) external returns (bool)
```
Selector: `0xa9059cbb`
> **Dev:** See {IERC20-transfer}.
>
> Requirements:
>
> - `to` cannot be the zero address.
> - the caller must have a balance of at least `amount`.
### transferFrom
```solidity
function transferFrom(address from, address to, uint256 amount) external returns (bool)
```
Selector: `0x23b872dd`
> **Dev:** See {IERC20-transferFrom}.
>
> Emits an {Approval} event indicating the updated allowance. This is not
> required by the EIP. See the note at the beginning of {ERC20}.
>
> NOTE: Does not update the allowance if the current allowance
> is the maximum `uint256`.
>
> Requirements:
>
> - `from` and `to` cannot be the zero address.
> - `from` must have a balance of at least `amount`.
> - the caller must have allowance for ``from``'s tokens of at least
> `amount`.
## Events
### Approval
```solidity
event Approval(address indexed owner, address indexed spender, uint256 value)
```
> **Dev:** Emitted when the allowance of a `spender` for an `owner` is set by
> a call to {approve}. `value` is the new allowance.
### DelegateChanged
```solidity
event DelegateChanged(
address indexed delegator,
address indexed fromDelegate,
address indexed toDelegate
)
```
> **Dev:** Emitted when an account changes their delegate.
### DelegateVotesChanged
```solidity
event DelegateVotesChanged(
address indexed delegate,
uint256 previousBalance,
uint256 newBalance
)
```
> **Dev:** Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
### EIP712DomainChanged
```solidity
event EIP712DomainChanged()
```
> **Dev:** MAY be emitted to signal that the domain could have changed.
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### MintingFrozen
```solidity
event MintingFrozen()
```
Emitted when minting is frozen permanently
### Transfer
```solidity
event Transfer(address indexed from, address indexed to, uint256 value)
```
> **Dev:** Emitted when `value` tokens are moved from one account (`from`) to
> another (`to`).
>
> Note that `value` may be zero.
## Errors
### DaoUnauthorized
```solidity
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. |
### MintingIsFrozen
```solidity
error MintingIsFrozen()
```
Thrown when attempting to mint when minting is permanently disabled
### MintSettingsArrayLengthMismatch
```solidity
error MintSettingsArrayLengthMismatch(uint256 receiversArrayLength, uint256 amountsArrayLength)
```
Thrown if the number of receivers and amounts specified in the mint settings do not match.
| Parameter | Type | Description |
| --- | --- | --- |
| `receiversArrayLength` | `uint256` | The length of the `receivers` array. |
| `amountsArrayLength` | `uint256` | The length of the `amounts` array. |
## Constants
_Public, so each is also readable through a generated getter._
### MINT_PERMISSION_ID
```solidity
bytes32 public constant MINT_PERMISSION_ID = keccak256("MINT_PERMISSION");
```
Value: `0xb737b436e6cc542520cb79ec04245c720c38eebfa56d9e2d99b043979db20e4c`
The permission identifier to mint new tokens
## Structs
### Checkpoint
_Inherited from `ERC20VotesUpgradeable`._
```solidity
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
}
```
### MintSettings
```solidity
struct MintSettings {
address[] receivers;
uint256[] amounts;
bool ensureDelegationOnMint;
}
```
The settings for the initial mint of the token.
> **Dev:** The lengths of `receivers` and `amounts` must match.
| Field | Type | Description |
| --- | --- | --- |
| `receivers` | `address[]` | The receivers of the tokens. On initialization only. |
| `amounts` | `uint256[]` | The amounts of tokens to be minted for each receiver. On initialization only. |
| `ensureDelegationOnMint` | `bool` | Whether mint() calls should self delegate if the receiver doesn't have one. |
# GovernanceWrappedERC20
**Contract** · [`src/erc20/GovernanceWrappedERC20.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/erc20/GovernanceWrappedERC20.sol)
**Explained in:** [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md)
**Author:** Aragon X
**Inherits:** [`IGovernanceWrappedERC20`](/abi/token-voting-plugin/IGovernanceWrappedERC20.md), `Initializable`, `ERC165Upgradeable`, `ERC20VotesUpgradeable`, `ERC20WrapperUpgradeable`
Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by
inheriting from `ERC20WrapperUpgradeable` and allows using it for voting by inheriting from `ERC20VotesUpgradeable`.
The latter is compatible with
[OpenZeppelin's `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) interface.
The contract supports meta transactions. To use an `amount` of underlying tokens for voting, the token owner must:
1. call `approve` for the tokens to be used by this contract
2. call `depositFor` to wrap them, which safely transfers the underlying
[ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens to the contract and mints wrapped
[ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
To get the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens back, the owner of the wrapped tokens can call
`withdrawFor`, which burns the wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens and
safely transfers the underlying tokens back to the owner.
> **Dev:** This contract intentionally has no public mint functionality because this is the
> responsibility of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token contract.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(IERC20Upgradeable _token, string _name, string _symbol)
```
Calls the initialize function.
| Parameter | Type | Description |
| --- | --- | --- |
| `_token` | `IERC20Upgradeable` | The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token. |
| `_name` | `string` | The name of the wrapped token. |
| `_symbol` | `string` | The symbol of the wrapped token. |
## Functions
### allowance
```solidity
function allowance(address owner, address spender) external view returns (uint256)
```
Selector: `0xdd62ed3e`
> **Dev:** See {IERC20-allowance}.
### approve
```solidity
function approve(address spender, uint256 amount) external returns (bool)
```
Selector: `0x095ea7b3`
> **Dev:** See {IERC20-approve}.
>
> NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
> `transferFrom`. This is semantically equivalent to an infinite approval.
>
> Requirements:
>
> - `spender` cannot be the zero address.
### balanceOf
```solidity
function balanceOf(address account) external view returns (uint256)
```
Selector: `0x70a08231`
> **Dev:** See {IERC20-balanceOf}.
### checkpoints
```solidity
function checkpoints(
address account,
uint32 pos
) external view returns (ERC20VotesUpgradeable.Checkpoint)
```
Selector: `0xf1127ed8`
> **Dev:** Get the `pos`-th checkpoint for `account`.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`ERC20VotesUpgradeable.Checkpoint`](#checkpoint) | |
### clock
```solidity
function clock() external view returns (uint48)
```
Selector: `0x91ddadf4`
> **Dev:** Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
### CLOCK_MODE
```solidity
function CLOCK_MODE() external view returns (string)
```
Selector: `0x4bf5d7e9`
> **Dev:** Description of the clock
### decimals
```solidity
function decimals() external view returns (uint8)
```
Selector: `0x313ce567`
> **Dev:** Uses the `decimals` of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.
### decreaseAllowance
```solidity
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool)
```
Selector: `0xa457c2d7`
> **Dev:** Atomically decreases the allowance granted to `spender` by the caller.
>
> This is an alternative to {approve} that can be used as a mitigation for
> problems described in {IERC20-approve}.
>
> Emits an {Approval} event indicating the updated allowance.
>
> Requirements:
>
> - `spender` cannot be the zero address.
> - `spender` must have allowance for the caller of at least
> `subtractedValue`.
### delegate
```solidity
function delegate(address delegatee) external
```
Selector: `0x5c19a95c`
> **Dev:** Delegate votes from the sender to `delegatee`.
### delegateBySig
```solidity
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external
```
Selector: `0xc3cda520`
> **Dev:** Delegates votes from signer to `delegatee`
### delegates
```solidity
function delegates(address account) external view returns (address)
```
Selector: `0x587cde1e`
> **Dev:** Get the address `account` is currently delegating to.
### depositFor
```solidity
function depositFor(address account, uint256 amount) external returns (bool)
```
Selector: `0x2f4f21e2`
Deposits an amount of underlying token and mints the corresponding number of wrapped tokens for a receiving address.
| Parameter | Type | Description |
| --- | --- | --- |
| `account` | `address` | The address receiving the minted, wrapped tokens. |
| `amount` | `uint256` | The amount of tokens to deposit. |
### DOMAIN_SEPARATOR
```solidity
function DOMAIN_SEPARATOR() external view returns (bytes32)
```
Selector: `0x3644e515`
> **Dev:** Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
### eip712Domain
```solidity
function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)
```
Selector: `0x84b0196e`
> **Dev:** See {EIP-5267}.
>
> _Available since v4.9._
### getPastTotalSupply
```solidity
function getPastTotalSupply(uint256 timepoint) external view returns (uint256)
```
Selector: `0x8e539e8c`
> **Dev:** Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.
> It is NOT the sum of all the delegated votes!
>
> Requirements:
>
> - `timepoint` must be in the past
### getPastVotes
```solidity
function getPastVotes(address account, uint256 timepoint) external view returns (uint256)
```
Selector: `0x3a46b1a8`
> **Dev:** Retrieve the number of votes for `account` at the end of `timepoint`.
>
> Requirements:
>
> - `timepoint` must be in the past
### getVotes
```solidity
function getVotes(address account) external view returns (uint256)
```
Selector: `0x9ab24eb0`
> **Dev:** Gets the current votes balance for `account`
### increaseAllowance
```solidity
function increaseAllowance(address spender, uint256 addedValue) external returns (bool)
```
Selector: `0x39509351`
> **Dev:** Atomically increases the allowance granted to `spender` by the caller.
>
> This is an alternative to {approve} that can be used as a mitigation for
> problems described in {IERC20-approve}.
>
> Emits an {Approval} event indicating the updated allowance.
>
> Requirements:
>
> - `spender` cannot be the zero address.
### initialize
```solidity
function initialize(IERC20Upgradeable _token, string _name, string _symbol) external
```
Selector: `0x90657147`
Initializes the contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_token` | `IERC20Upgradeable` | The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token. |
| `_name` | `string` | The name of the wrapped token. |
| `_symbol` | `string` | The symbol of the wrapped token. |
### name
```solidity
function name() external view returns (string)
```
Selector: `0x06fdde03`
> **Dev:** Returns the name of the token.
### nonces
```solidity
function nonces(address owner) external view returns (uint256)
```
Selector: `0x7ecebe00`
> **Dev:** Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.
### numCheckpoints
```solidity
function numCheckpoints(address account) external view returns (uint32)
```
Selector: `0x6fcfff45`
> **Dev:** Get number of checkpoints for `account`.
### permit
```solidity
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external
```
Selector: `0xd505accf`
> **Dev:** Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### symbol
```solidity
function symbol() external view returns (string)
```
Selector: `0x95d89b41`
> **Dev:** Returns the symbol of the token, usually a shorter version of the
> name.
### totalSupply
```solidity
function totalSupply() external view returns (uint256)
```
Selector: `0x18160ddd`
> **Dev:** See {IERC20-totalSupply}.
### transfer
```solidity
function transfer(address to, uint256 amount) external returns (bool)
```
Selector: `0xa9059cbb`
> **Dev:** See {IERC20-transfer}.
>
> Requirements:
>
> - `to` cannot be the zero address.
> - the caller must have a balance of at least `amount`.
### transferFrom
```solidity
function transferFrom(address from, address to, uint256 amount) external returns (bool)
```
Selector: `0x23b872dd`
> **Dev:** See {IERC20-transferFrom}.
>
> Emits an {Approval} event indicating the updated allowance. This is not
> required by the EIP. See the note at the beginning of {ERC20}.
>
> NOTE: Does not update the allowance if the current allowance
> is the maximum `uint256`.
>
> Requirements:
>
> - `from` and `to` cannot be the zero address.
> - `from` must have a balance of at least `amount`.
> - the caller must have allowance for ``from``'s tokens of at least
> `amount`.
### underlying
```solidity
function underlying() external view returns (IERC20Upgradeable)
```
Selector: `0x6f307dc3`
> **Dev:** Returns the address of the underlying ERC-20 token that is being wrapped.
### withdrawTo
```solidity
function withdrawTo(address account, uint256 amount) external returns (bool)
```
Selector: `0x205c2878`
Withdraws an amount of underlying tokens to a receiving address and burns the corresponding number of wrapped tokens.
| Parameter | Type | Description |
| --- | --- | --- |
| `account` | `address` | The address receiving the withdrawn, underlying tokens. |
| `amount` | `uint256` | The amount of underlying tokens to withdraw. |
## Events
### Approval
```solidity
event Approval(address indexed owner, address indexed spender, uint256 value)
```
> **Dev:** Emitted when the allowance of a `spender` for an `owner` is set by
> a call to {approve}. `value` is the new allowance.
### DelegateChanged
```solidity
event DelegateChanged(
address indexed delegator,
address indexed fromDelegate,
address indexed toDelegate
)
```
> **Dev:** Emitted when an account changes their delegate.
### DelegateVotesChanged
```solidity
event DelegateVotesChanged(
address indexed delegate,
uint256 previousBalance,
uint256 newBalance
)
```
> **Dev:** Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
### EIP712DomainChanged
```solidity
event EIP712DomainChanged()
```
> **Dev:** MAY be emitted to signal that the domain could have changed.
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### Transfer
```solidity
event Transfer(address indexed from, address indexed to, uint256 value)
```
> **Dev:** Emitted when `value` tokens are moved from one account (`from`) to
> another (`to`).
>
> Note that `value` may be zero.
## Structs
### Checkpoint
_Inherited from `ERC20VotesUpgradeable`._
```solidity
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
}
```
# MajorityVotingBase
**Abstract contract** · [`src/base/MajorityVotingBase.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/base/MajorityVotingBase.sol)
**Explained in:** [Create, vote, and execute a proposal](/guides/create-vote-execute.md), [Majority voting](/plugins/majority-voting.md), [Voting modes](/plugins/voting-modes.md)
**Author:** Aragon X - 2022-2025
**Inherits:** [`IMajorityVoting`](/abi/token-voting-plugin/IMajorityVoting.md), `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{total}
- (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](#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{no}
+ 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.
| 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
```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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The proposal Id. |
| `_account` | `address` | The account address to be checked. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | Whether the voter abstains, supports or opposes the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_allowFailureMap` | `uint256` | Allows 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. |
| `_startDate` | `uint64` | The start date of the proposal vote. If 0, the current timestamp is used and the vote starts immediately. |
| `_endDate` | `uint64` | The end date of the proposal vote. If 0, `_startDate + minDuration` is used. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option to be casted on proposal creation. |
| `_tryEarlyExecution` | `bool` | If `true`, early execution is tried after the vote cast. The call does not revert if early execution is not possible. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| 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`](#proposalparameters) | The parameters of the proposal. |
| `tally` | [`MajorityVotingBase.Tally`](#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`](#targetconfig) | Execution 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voter` | `address` | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteOption`](#voteoption) | The 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.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) 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.
| 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. |
### 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.
| 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. |
### 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.
| 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. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns `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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint32` | The 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
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportThreshold
```solidity
function supportThreshold() external view returns (uint32)
```
Selector: `0x7c36e8e8`
Returns the support threshold parameter stored in the voting settings.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint32` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_blockNumber` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_minApprovals` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The 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
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option. |
| `_tryEarlyExecution` | `bool` | If `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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingMode`](#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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The voter casting the vote. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
### VotingMinApprovalUpdated
```solidity
event VotingMinApprovalUpdated(uint256 minApprovals)
```
Emitted when the min approval value is updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `minApprovals` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A parameter to select the vote mode. |
| `supportThreshold` | `uint32` | The support threshold value. |
| `minParticipation` | `uint32` | The minimum participation value. |
| `minDuration` | `uint64` | The minimum duration of the proposal vote in seconds. |
| `minProposerVotingPower` | `uint256` | The 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.
| 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
```solidity
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
```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`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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).
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint64` | The limit value. |
| `actual` | `uint64` | The actual value. |
### NonexistentProposal
```solidity
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. |
### ProposalAlreadyExists
```solidity
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. |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### RatioOutOfBounds
```solidity
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. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `account` | `address` | The address of the _account. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The 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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
### VoteOption
_Inherited from `IMajorityVoting`._
```solidity
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
```solidity
enum VotingMode {
Standard,
EarlyExecution,
VoteReplacement
}
```
The different voting modes available.
| Option | Value | Description |
| --- | --- | --- |
| `Standard` | `0` | In standard mode, early execution and vote replacement are disabled. |
| `EarlyExecution` | `1` | In early execution mode, a proposal can be executed early before the end date if the vote outcome cannot mathematically change by more voters voting. |
| `VoteReplacement` | `2` | In 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.
| Field | Type | Description |
| --- | --- | --- |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `parameters` | [`MajorityVotingBase.ProposalParameters`](#proposalparameters) | The proposal parameters at the time of the proposal creation. |
| `tally` | [`MajorityVotingBase.Tally`](#tally) | The vote tally of the proposal. |
| `voters` | `mapping(address => IMajorityVoting.VoteOption)` | The votes casted by the voters. |
| `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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `minApprovalPower` | `uint256` | The minimum amount of yes votes power needed for the proposal advance. |
| `targetConfig` | [`IPlugin.TargetConfig`](#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
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A parameter to select the vote mode. |
| `supportThreshold` | `uint32` | The support threshold value. The value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`. |
| `startDate` | `uint64` | The start date of the proposal vote. |
| `endDate` | `uint64` | The end date of the proposal vote. |
| `snapshotTimepoint` | `uint64` | The number of the block prior to the proposal creation. |
| `minVotingPower` | `uint256` | The 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.
| 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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The 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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A 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. |
| `supportThreshold` | `uint32` | The support threshold value. Its value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`. |
| `minParticipation` | `uint32` | The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`. |
| `minDuration` | `uint64` | The minimum duration of the proposal vote in seconds. |
| `minProposerVotingPower` | `uint256` | The minimum voting power required to create a proposal. |
# TokenVoting
**Contract** · [`src/TokenVoting.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/TokenVoting.sol)
**Explained in:** [Create, vote, and execute a proposal](/guides/create-vote-execute.md), [Token Voting Plugin](/plugins/token-voting-plugin.md), [Voting power (Token Voting Plugin)](/plugins/token-voting-plugin/voting-power.md)
**Author:** Aragon X - 2021-2025
**Inherits:** `IMembership`, [`MajorityVotingBase`](/abi/token-voting-plugin/MajorityVotingBase.md)
The majority voting implementation using an
[OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes)
compatible governance token.
> **Dev:** v1.4 (Release 1, Build 4). For each upgrade, if the reinitialization step is required,
> increment the version numbers in the modifier for both the initialize and initializeFrom functions.
**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.
| 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
```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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The proposal Id. |
| `_account` | `address` | The account address to be checked. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | Whether the voter abstains, supports or opposes the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns 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.
> **Dev:** Requires the `CREATE_PROPOSAL_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_allowFailureMap` | `uint256` | Allows 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. |
| `_startDate` | `uint64` | The start date of the proposal vote. If 0, the current timestamp is used and the vote starts immediately. |
| `_endDate` | `uint64` | The end date of the proposal vote. If 0, `_startDate + minDuration` is used. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option to be casted on proposal creation. |
| `_tryEarlyExecution` | `bool` | If `true`, early execution is tried after the vote cast. The call does not revert if early execution is not possible. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The metadata of the proposal. |
| `_actions` | `Action[]` | The actions that will be executed after the proposal passes. |
| `_startDate` | `uint64` | The start date of the proposal. |
| `_endDate` | `uint64` | The end date of the proposal. |
| `_data` | `bytes` | The additional abi-encoded data to include more necessary fields. |
| Returns | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The id of the proposal. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `string` | ABI 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getCurrentTargetConfig
```solidity
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)
```
Selector: `0xc98425ee`
Returns the currently set target contract.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| 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`](#proposalparameters) | The parameters of the proposal. |
| `tally` | [`MajorityVotingBase.Tally`](#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`](#targetconfig) | Execution 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().
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voter` | `address` | |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteOption`](#voteoption) | The vote option cast by a voter for a certain proposal. |
### getVotingToken
```solidity
function getVotingToken() external view returns (IVotesUpgradeable)
```
Selector: `0xe28c3b19`
getter function for the voting token.
> **Dev:** public function also useful for registering interfaceId
> and for distinguishing from majority voting interface.
### 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.
| 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
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
### initialize
```solidity
function initialize(
IDAO _dao,
MajorityVotingBase.VotingSettings _votingSettings,
IVotesUpgradeable _token,
IPlugin.TargetConfig _targetConfig,
uint256 _minApprovals,
bytes _pluginMetadata,
address[] _excludedAccounts
) external
```
Selector: `0xc502c97c`
Initializes the component.
> **Dev:** This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `IDAO` | The IDAO interface of the associated DAO. |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The voting settings. |
| `_token` | `IVotesUpgradeable` | The [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token to use for voting. If the given token implements https://eips.ethereum.org/EIPS/eip-6372, then `CLOCK_MODE()` or `clock()` will determine the clock type used by the plugin. The token will be assumed to use a block number based clock otherwise. |
| `_targetConfig` | [`IPlugin.TargetConfig`](#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. |
| `_minApprovals` | `uint256` | The minimal amount of approvals the proposal needs to succeed. |
| `_pluginMetadata` | `bytes` | The plugin specific information encoded in bytes. This can also be an ipfs cid encoded in bytes. |
| `_excludedAccounts` | `address[]` | |
### initializeFrom
```solidity
function initializeFrom(uint16 _fromBuild, bytes _initData) external
```
Selector: `0x10c83f4e`
Reinitializes the TokenVoting after an upgrade from a previous build version. For each
reinitialization step, use the `_fromBuild` version to decide which internal functions to
call for reinitialization.
> **Dev:** WARNING: The contract should only be upgradeable through PSP to ensure that _fromBuild is not
> incorrectly passed, and that the appropriate permissions for the upgrade are properly configured.
| Parameter | Type | Description |
| --- | --- | --- |
| `_fromBuild` | `uint16` | Build version number of previous implementation contract this upgrade is transitioning from. |
| `_initData` | `bytes` | The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)). |
### 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.
| 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
```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.
| 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. |
### 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.
| 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. |
### 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.
| 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. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns `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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint32` | The 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
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IPlugin.PluginType`](#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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint256` | The 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_metadata` | `bytes` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportThreshold
```solidity
function supportThreshold() external view returns (uint32)
```
Selector: `0x7c36e8e8`
Returns the support threshold parameter stored in the voting settings.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint32` | The support threshold parameter. |
### tokenIndexedByTimestamp
```solidity
function tokenIndexedByTimestamp() external view returns (bool)
```
Selector: `0x029dc439`
Wether the token contract indexes past voting power by timestamp.
### totalVotingPower
```solidity
function totalVotingPower(uint256 _timePoint) external view returns (uint256)
```
Selector: `0x536f9f42`
Returns the total voting power checkpointed for a specific timestamp or block number, subtracting the balance of excluded addresses.
| Parameter | Type | Description |
| --- | --- | --- |
| `_timePoint` | `uint256` | The block number or timestamp. |
### updateMinApprovals
```solidity
function updateMinApprovals(uint256 _minApprovals) external
```
Selector: `0xaac91e46`
Updates the minimal approval value.
> **Dev:** Requires the `UPDATE_VOTING_SETTINGS_PERMISSION_ID` permission.
| Parameter | Type | Description |
| --- | --- | --- |
| `_minApprovals` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_votingSettings` | [`MajorityVotingBase.VotingSettings`](#votingsettings) | The 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
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option. |
| `_tryEarlyExecution` | `bool` | If `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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`MajorityVotingBase.VotingMode`](#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.
### ExcludedFromSupply
```solidity
event ExcludedFromSupply(address[] accounts)
```
Emitted when an account's balance is considered as non-circulating supply. Its balance will be excluded from the token supply computation.
| Parameter | Type | Description |
| --- | --- | --- |
| `accounts` | `address[]` | The addresses whose balance is considered as not circulating |
### Initialized
```solidity
event Initialized(uint8 version)
```
> **Dev:** Triggered when the contract has been initialized or reinitialized.
### MembersAdded
```solidity
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
```solidity
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
```solidity
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
```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.
| 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 `i`th 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### TargetSet
```solidity
event TargetSet(IPlugin.TargetConfig newTargetConfig)
```
Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
| --- | --- | --- |
| `newTargetConfig` | [`IPlugin.TargetConfig`](#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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `voter` | `address` | The voter casting the vote. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
### VotingMinApprovalUpdated
```solidity
event VotingMinApprovalUpdated(uint256 minApprovals)
```
Emitted when the min approval value is updated.
| Parameter | Type | Description |
| --- | --- | --- |
| `minApprovals` | `uint256` | The 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A parameter to select the vote mode. |
| `supportThreshold` | `uint32` | The support threshold value. |
| `minParticipation` | `uint32` | The minimum participation value. |
| `minDuration` | `uint64` | The minimum duration of the proposal vote in seconds. |
| `minProposerVotingPower` | `uint256` | The 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.
| 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
```solidity
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
```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`.
| Parameter | Type | Description |
| --- | --- | --- |
| `targetConfig` | [`IPlugin.TargetConfig`](#targetconfig) | The 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).
| Parameter | Type | Description |
| --- | --- | --- |
| `limit` | `uint64` | The limit value. |
| `actual` | `uint64` | The actual value. |
### NonexistentProposal
```solidity
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
```solidity
error NoVotingPower()
```
Thrown if the voting power is zero
### ProposalAlreadyExists
```solidity
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. |
### ProposalExecutionForbidden
```solidity
error ProposalExecutionForbidden(uint256 proposalId)
```
Thrown if the proposal execution is forbidden.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
### RatioOutOfBounds
```solidity
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. |
### TokenClockMismatch
```solidity
error TokenClockMismatch()
```
Thrown if the token reports an inconsistent clock mode and clock 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `proposalId` | `uint256` | The ID of the proposal. |
| `account` | `address` | The address of the _account. |
| `voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option. |
## Constants
_Public, so each is also readable through a generated getter._
### CREATE_PROPOSAL_PERMISSION_ID
_Inherited from `MajorityVotingBase`._
```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.
### 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
_Inherited from `MajorityVotingBase`._
```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.
| Option | Value |
| --- | --- |
| `Call` | `0` |
| `DelegateCall` | `1` |
### PluginType
_Inherited from `IPlugin`._
```solidity
enum PluginType {
UUPS,
Cloneable,
Constructable
}
```
Types of plugin implementations available within OSx.
| Option | Value |
| --- | --- |
| `UUPS` | `0` |
| `Cloneable` | `1` |
| `Constructable` | `2` |
### VoteOption
_Inherited from `IMajorityVoting`._
```solidity
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`._
```solidity
enum VotingMode {
Standard,
EarlyExecution,
VoteReplacement
}
```
The different voting modes available.
| Option | Value | Description |
| --- | --- | --- |
| `Standard` | `0` | In standard mode, early execution and vote replacement are disabled. |
| `EarlyExecution` | `1` | In early execution mode, a proposal can be executed early before the end date if the vote outcome cannot mathematically change by more voters voting. |
| `VoteReplacement` | `2` | In 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.VoteOption) voters;
Action[] actions;
uint256 allowFailureMap;
uint256 minApprovalPower;
IPlugin.TargetConfig targetConfig;
}
```
A container for proposal-related information.
| Field | Type | Description |
| --- | --- | --- |
| `executed` | `bool` | Whether the proposal is executed or not. |
| `parameters` | [`MajorityVotingBase.ProposalParameters`](#proposalparameters) | The proposal parameters at the time of the proposal creation. |
| `tally` | [`MajorityVotingBase.Tally`](#tally) | The vote tally of the proposal. |
| `voters` | `mapping(address => IMajorityVoting.VoteOption)` | The votes casted by the voters. |
| `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 `i`th action reverts. A failure map value of 0 requires every action to not revert. |
| `minApprovalPower` | `uint256` | The minimum amount of yes votes power needed for the proposal advance. |
| `targetConfig` | [`IPlugin.TargetConfig`](#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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A parameter to select the vote mode. |
| `supportThreshold` | `uint32` | The support threshold value. The value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`. |
| `startDate` | `uint64` | The start date of the proposal vote. |
| `endDate` | `uint64` | The end date of the proposal vote. |
| `snapshotTimepoint` | `uint64` | The number of the block prior to the proposal creation. |
| `minVotingPower` | `uint256` | The minimum voting power needed for a proposal to reach minimum participation. |
### Tally
_Inherited from `MajorityVotingBase`._
```solidity
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`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `target` | `address` | The address of the target contract, typically the associated DAO but configurable to a custom executor. |
| `operation` | [`IPlugin.Operation`](#operation) | The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`. |
### VotingSettings
_Inherited from `MajorityVotingBase`._
```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.
| Field | Type | Description |
| --- | --- | --- |
| `votingMode` | [`MajorityVotingBase.VotingMode`](#votingmode) | A 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. |
| `supportThreshold` | `uint32` | The support threshold value. Its value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`. |
| `minParticipation` | `uint32` | The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`. |
| `minDuration` | `uint64` | The minimum duration of the proposal vote in seconds. |
| `minProposerVotingPower` | `uint256` | The minimum voting power required to create a proposal. |
# TokenVotingSetup
**Contract** · [`src/TokenVotingSetup.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/TokenVotingSetup.sol)
**Explained in:** [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md), [Launch a governance token with your DAO](/guides/launch-a-governance-token.md), [Token Voting Plugin](/plugins/token-voting-plugin.md)
**Author:** Aragon X - 2022-2025
**Inherits:** `PluginUpgradeableSetup`
The setup contract of the `TokenVoting` plugin.
> **Dev:** v1.4 (Release 1, Build 4)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(
TokenVoting _tokenVotingBase,
GovernanceERC20 _governanceERC20Base,
GovernanceWrappedERC20 _governanceWrappedERC20Base
)
```
The contract constructor deploying the plugin implementation contract
and receiving the governance token base contracts to clone from.
| Parameter | Type | Description |
| --- | --- | --- |
| `_tokenVotingBase` | [`TokenVoting`](/abi/token-voting-plugin/TokenVoting.md) | The base `TokenVoting` contract to create proxies for. |
| `_governanceERC20Base` | [`GovernanceERC20`](/abi/token-voting-plugin/GovernanceERC20.md) | The base `GovernanceERC20` contract to create clones from. |
| `_governanceWrappedERC20Base` | [`GovernanceWrappedERC20`](/abi/token-voting-plugin/GovernanceWrappedERC20.md) | The base `GovernanceWrappedERC20` contract to create clones from. |
## Functions
### decodeInstallationParameters
```solidity
function decodeInstallationParameters(
bytes _data
) external pure returns (MajorityVotingBase.VotingSettings votingSettings, TokenVotingSetup.TokenSettings tokenSettings, GovernanceERC20.MintSettings mintSettings, IPlugin.TargetConfig targetConfig, uint256 minApprovals, bytes pluginMetadata, address[] excludedAccounts)
```
Selector: `0xf2ad76f9`
Decodes the given byte array into the original installation parameters
| Returns | Type | Description |
| --- | --- | --- |
| `votingSettings` | `MajorityVotingBase.VotingSettings` | |
| `tokenSettings` | [`TokenVotingSetup.TokenSettings`](#tokensettings) | |
| `mintSettings` | `GovernanceERC20.MintSettings` | |
| `targetConfig` | `IPlugin.TargetConfig` | |
| `minApprovals` | `uint256` | |
| `pluginMetadata` | `bytes` | |
| `excludedAccounts` | `address[]` | |
### encodeInstallationParameters
```solidity
function encodeInstallationParameters(
MajorityVotingBase.VotingSettings votingSettings,
TokenVotingSetup.TokenSettings tokenSettings,
GovernanceERC20.MintSettings mintSettings,
IPlugin.TargetConfig targetConfig,
uint256 minApprovals,
bytes pluginMetadata,
address[] excludedAccounts
) external pure returns (bytes)
```
Selector: `0xb37edb51`
Encodes the given installation parameters into a byte array
| Parameter | Type | Description |
| --- | --- | --- |
| `votingSettings` | `MajorityVotingBase.VotingSettings` | |
| `tokenSettings` | [`TokenVotingSetup.TokenSettings`](#tokensettings) | |
| `mintSettings` | `GovernanceERC20.MintSettings` | |
| `targetConfig` | `IPlugin.TargetConfig` | |
| `minApprovals` | `uint256` | |
| `pluginMetadata` | `bytes` | |
| `excludedAccounts` | `address[]` | |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external view returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Revoke the upgrade plugin permission to the DAO for all builds prior the current one (3).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportsIVotesInterface
```solidity
function supportsIVotesInterface(address token) external view returns (bool)
```
Selector: `0x1c5d4013`
Unsatisfiably determines if the token is an IVotes interface.
> **Dev:** Many tokens don't use ERC165 even though they still support IVotes.
## Errors
### InvalidImplementation
```solidity
error InvalidImplementation()
```
Thrown if the implementation address is empty.
### InvalidUpdatePath
```solidity
error InvalidUpdatePath(uint16 fromBuild, uint16 thisBuild)
```
Thrown when an update path is not available, for example, if this is the initial build.
| Parameter | Type | Description |
| --- | --- | --- |
| `fromBuild` | `uint16` | The build number to update from. |
| `thisBuild` | `uint16` | The build number of this setup to update to. |
### TokenNotContract
```solidity
error TokenNotContract(address token)
```
Thrown if the passed token address is not a token contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
### TokenNotERC20
```solidity
error TokenNotERC20(address token)
```
Thrown if token address is not ERC20.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
## Constants
_Public, so each is also readable through a generated getter._
### governanceERC20Base
```solidity
address public immutable governanceERC20Base;
```
The address of the `GovernanceERC20` base contract.
### governanceWrappedERC20Base
```solidity
address public immutable governanceWrappedERC20Base;
```
The address of the `GovernanceWrappedERC20` base contract.
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
### TokenSettings
```solidity
struct TokenSettings {
address addr;
string name;
string symbol;
}
```
Configuration settings for a token used within the governance system.
| Field | Type | Description |
| --- | --- | --- |
| `addr` | `address` | The token address. If set to `address(0)`, a new `GovernanceERC20` token is deployed. If the address implements `IVotes`, it will be used directly; otherwise, it is wrapped as `GovernanceWrappedERC20`. |
| `name` | `string` | The name of the token. |
| `symbol` | `string` | The symbol of the token. |
# TokenVotingSetupZkSync
**Contract** · [`src/TokenVotingSetupZkSync.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/TokenVotingSetupZkSync.sol)
**TokenVotingSetup**
**Author:** Aragon X - 2022-2025
**Inherits:** `PluginUpgradeableSetup`
The setup contract of the `TokenVoting` plugin.
> **Dev:** v1.4 (Release 1, Build 4)
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(TokenVoting _tokenVotingBase)
```
The contract constructor deploying the plugin implementation contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_tokenVotingBase` | [`TokenVoting`](/abi/token-voting-plugin/TokenVoting.md) | The base `TokenVoting` contract to create proxies for. |
## Functions
### decodeInstallationParameters
```solidity
function decodeInstallationParameters(
bytes _data
) external pure returns (MajorityVotingBase.VotingSettings votingSettings, TokenVotingSetupZkSync.TokenSettings tokenSettings, GovernanceERC20.MintSettings mintSettings, IPlugin.TargetConfig targetConfig, uint256 minApprovals, bytes pluginMetadata, address[] excludedAccounts)
```
Selector: `0xf2ad76f9`
Decodes the given byte array into the original installation parameters
| Returns | Type | Description |
| --- | --- | --- |
| `votingSettings` | `MajorityVotingBase.VotingSettings` | |
| `tokenSettings` | [`TokenVotingSetupZkSync.TokenSettings`](#tokensettings) | |
| `mintSettings` | `GovernanceERC20.MintSettings` | |
| `targetConfig` | `IPlugin.TargetConfig` | |
| `minApprovals` | `uint256` | |
| `pluginMetadata` | `bytes` | |
| `excludedAccounts` | `address[]` | |
### encodeInstallationParameters
```solidity
function encodeInstallationParameters(
MajorityVotingBase.VotingSettings votingSettings,
TokenVotingSetupZkSync.TokenSettings tokenSettings,
GovernanceERC20.MintSettings mintSettings,
IPlugin.TargetConfig targetConfig,
uint256 minApprovals,
bytes pluginMetadata,
address[] excludedAccounts
) external pure returns (bytes)
```
Selector: `0xb37edb51`
Encodes the given installation parameters into a byte array
| Parameter | Type | Description |
| --- | --- | --- |
| `votingSettings` | `MajorityVotingBase.VotingSettings` | |
| `tokenSettings` | [`TokenVotingSetupZkSync.TokenSettings`](#tokensettings) | |
| `mintSettings` | `GovernanceERC20.MintSettings` | |
| `targetConfig` | `IPlugin.TargetConfig` | |
| `minApprovals` | `uint256` | |
| `pluginMetadata` | `bytes` | |
| `excludedAccounts` | `address[]` | |
### implementation
```solidity
function implementation() external view returns (address)
```
Selector: `0x5c60da1b`
Returns the plugin implementation address.
> **Dev:** The implementation can be instantiated via the `new` keyword, cloned via the minimal proxy pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS proxy pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `address` | The address of the plugin implementation contract. |
### prepareInstallation
```solidity
function prepareInstallation(
address _dao,
bytes _data
) external returns (address plugin, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xf10832f1`
Prepares the installation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the installing DAO. |
| `_data` | `bytes` | The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file. |
| Returns | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin` contract being prepared for installation. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### prepareUninstallation
```solidity
function prepareUninstallation(
address _dao,
IPluginSetup.SetupPayload _payload
) external view returns (PermissionLib.MultiTargetPermission[] permissions)
```
Selector: `0x9cb0a124`
Prepares the uninstallation of a plugin.
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the uninstalling DAO. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUninstallation`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO. |
### prepareUpdate
```solidity
function prepareUpdate(
address _dao,
uint16 _fromBuild,
IPluginSetup.SetupPayload _payload
) external returns (bytes initData, IPluginSetup.PreparedSetupData preparedSetupData)
```
Selector: `0xa8a9c29e`
Prepares the update of a plugin.
> **Dev:** Revoke the upgrade plugin permission to the DAO for all builds prior the current one (3).
| Parameter | Type | Description |
| --- | --- | --- |
| `_dao` | `address` | The address of the updating DAO. |
| `_fromBuild` | `uint16` | The build number of the plugin to update from. |
| `_payload` | [`IPluginSetup.SetupPayload`](#setuppayload) | The relevant data necessary for the `prepareUpdate`. See above. |
| Returns | Type | Description |
| --- | --- | --- |
| `initData` | `bytes` | The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`. |
| `preparedSetupData` | [`IPluginSetup.PreparedSetupData`](#preparedsetupdata) | The deployed plugin's relevant data which consists of helpers and permissions. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
### supportsIVotesInterface
```solidity
function supportsIVotesInterface(address token) external view returns (bool)
```
Selector: `0x1c5d4013`
Unsatisfiably determines if the token is an IVotes interface.
> **Dev:** Many tokens don't use ERC165 even though they still support IVotes.
## Errors
### InvalidImplementation
```solidity
error InvalidImplementation()
```
Thrown if the implementation address is empty.
### InvalidUpdatePath
```solidity
error InvalidUpdatePath(uint16 fromBuild, uint16 thisBuild)
```
Thrown when an update path is not available, for example, if this is the initial build.
| Parameter | Type | Description |
| --- | --- | --- |
| `fromBuild` | `uint16` | The build number to update from. |
| `thisBuild` | `uint16` | The build number of this setup to update to. |
### TokenNotContract
```solidity
error TokenNotContract(address token)
```
Thrown if the passed token address is not a token contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
### TokenNotERC20
```solidity
error TokenNotERC20(address token)
```
Thrown if token address is not ERC20.
| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | The token address |
## Structs
### PreparedSetupData
_Inherited from `IPluginSetup`._
```solidity
struct PreparedSetupData {
address[] helpers;
PermissionLib.MultiTargetPermission[] permissions;
}
```
The data associated with a prepared setup.
| Field | Type | Description |
| --- | --- | --- |
| `helpers` | `address[]` | The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update. |
| `permissions` | `PermissionLib.MultiTargetPermission[]` | The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO. |
### SetupPayload
_Inherited from `IPluginSetup`._
```solidity
struct SetupPayload {
address plugin;
address[] currentHelpers;
bytes data;
}
```
The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.
| Field | Type | Description |
| --- | --- | --- |
| `plugin` | `address` | The address of the `Plugin`. |
| `currentHelpers` | `address[]` | The address array of all current helpers (contracts or EOAs) associated with the plugin to update from. |
| `data` | `bytes` | The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata. |
### TokenSettings
```solidity
struct TokenSettings {
address addr;
string name;
string symbol;
}
```
Configuration settings for a token used within the governance system.
| Field | Type | Description |
| --- | --- | --- |
| `addr` | `address` | The token address. If set to `address(0)`, a new `GovernanceERC20` token is deployed. If the address implements `IVotes`, it will be used directly; otherwise, it is wrapped as `GovernanceWrappedERC20`. |
| `name` | `string` | The name of the token, relevant only if a new token is deployed (i.e., `addr` is `address(0)`). |
| `symbol` | `string` | The symbol of the token, relevant only if a new token is deployed (i.e., `addr` is `address(0)`). |
# VotingPowerCondition
**Contract** · [`src/condition/VotingPowerCondition.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/condition/VotingPowerCondition.sol)
**Explained in:** [Voting power (Token Voting Plugin)](/plugins/token-voting-plugin/voting-power.md)
**Author:** Aragon X - 2025
**Inherits:** `PermissionCondition`
Checks if an account's voting power or token balance meets the threshold set
in an associated TokenVoting plugin.
**security-contact:** sirt@aragon.org
## Constructor
### constructor
```solidity
constructor(address _tokenVoting)
```
Initializes the contract with the `TokenVoting` plugin address and fetches the associated token.
| Parameter | Type | Description |
| --- | --- | --- |
| `_tokenVoting` | `address` | The address of the `TokenVoting` plugin. |
## Functions
### isGranted
```solidity
function isGranted(
address _where,
address _who,
bytes32 _permissionId,
bytes _data
) external view returns (bool)
```
Selector: `0x2675fdd0`
Checks if a call is permitted.
> **Dev:** The function checks both the voting power and token balance to ensure `_who` meets the minimum voting
> threshold defined in the `TokenVoting` plugin. Returns `false` if the minimum requirement is unmet.
| Parameter | Type | Description |
| --- | --- | --- |
| `_where` | `address` | The address of the target contract. |
| `_who` | `address` | The address (EOA or contract) for which the permissions are checked. |
| `_permissionId` | `bytes32` | The permission identifier. |
| `_data` | `bytes` | Optional data passed to the `PermissionCondition` implementation. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `bool` | Returns true if the call is permitted. |
### 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.
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | `uint8[3]` | Returns the semantic Aragon OSx protocol version number. |
### supportsInterface
```solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
```
Selector: `0x01ffc9a7`
Checks if an interface is supported by this or its parent contract.
| Parameter | Type | Description |
| --- | --- | --- |
| `_interfaceId` | `bytes4` | The ID of the interface. |
# IERC20MintableUpgradeable
**Interface** · [`src/erc20/IERC20MintableUpgradeable.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/erc20/IERC20MintableUpgradeable.sol)
**Explained in:** [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md)
Interface to allow minting of [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
**security-contact:** sirt@aragon.org
## Functions
### mint
```solidity
function mint(address _to, uint256 _amount) external
```
Selector: `0x40c10f19`
Mints [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens for a receiving address.
| Parameter | Type | Description |
| --- | --- | --- |
| `_to` | `address` | The receiving address. |
| `_amount` | `uint256` | The amount of tokens. |
# IGovernanceWrappedERC20
**Interface** · [`src/erc20/IGovernanceWrappedERC20.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/erc20/IGovernanceWrappedERC20.sol)
**Explained in:** [Governance tokens](/plugins/token-voting-plugin/governance-tokens.md)
**Author:** Aragon X
An interface for the token wrapping contract wrapping existing
[ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
**security-contact:** sirt@aragon.org
## Functions
### depositFor
```solidity
function depositFor(address account, uint256 amount) external returns (bool)
```
Selector: `0x2f4f21e2`
Deposits an amount of underlying token
and mints the corresponding number of wrapped tokens for a receiving address.
| Parameter | Type | Description |
| --- | --- | --- |
| `account` | `address` | The address receiving the minted, wrapped tokens. |
| `amount` | `uint256` | The amount of tokens to deposit. |
### withdrawTo
```solidity
function withdrawTo(address account, uint256 amount) external returns (bool)
```
Selector: `0x205c2878`
Withdraws an amount of underlying tokens to a receiving address
and burns the corresponding number of wrapped tokens.
| Parameter | Type | Description |
| --- | --- | --- |
| `account` | `address` | The address receiving the withdrawn, underlying tokens. |
| `amount` | `uint256` | The amount of underlying tokens to withdraw. |
# IMajorityVoting
**Interface** · [`src/base/IMajorityVoting.sol`](https://github.com/aragon/token-voting-plugin/blob/e97b783d76872d694f41dfc4bc846405019ca741/src/base/IMajorityVoting.sol)
**Explained in:** [Create, vote, and execute a proposal](/guides/create-vote-execute.md), [Majority voting](/plugins/majority-voting.md)
**Author:** Aragon X - 2022-2025
The interface of majority voting plugin.
**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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be checked. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The proposal Id. |
| `_account` | `address` | The account address to be checked. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | Whether the voter abstains, supports or opposes the proposal. |
### execute
```solidity
function execute(uint256 _proposalId) external
```
Selector: `0xfe0d94c1`
Executes a proposal.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal to be executed. |
### getVoteOption
```solidity
function getVoteOption(
uint256 _proposalId,
address _account
) 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_account` | `address` | The account address to be checked. |
| Returns | Type | Description |
| --- | --- | --- |
| `[0]` | [`IMajorityVoting.VoteOption`](#voteoption) | |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### 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.
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
### minApproval
```solidity
function minApproval() external view returns (uint256)
```
Selector: `0x03ff90f6`
Returns the configured minimum approval value.
### minParticipation
```solidity
function minParticipation() external view returns (uint32)
```
Selector: `0x054fd2c2`
Returns the minimum participation parameter stored in the voting settings.
### supportThreshold
```solidity
function supportThreshold() external view returns (uint32)
```
Selector: `0x7c36e8e8`
Returns the support threshold parameter stored in the voting settings.
### 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
| Parameter | Type | Description |
| --- | --- | --- |
| `_proposalId` | `uint256` | The ID of the proposal. |
| `_voteOption` | [`IMajorityVoting.VoteOption`](#voteoption) | The chosen vote option. |
| `_tryEarlyExecution` | `bool` | If `true`, early execution is tried after the vote cast. The call does not revert if early execution is not possible. |
## Events
### VoteCast
```solidity
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`](#voteoption) | The casted vote option. |
| `votingPower` | `uint256` | The voting power behind this vote. |
## Enums
### VoteOption
```solidity
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. |
# Source repositories
Every part of the protocol is open source. The table lists each component's **canonical GitHub repository**, where you can read the code, file issues, or vendor it as a dependency. Most follow the `aragon/` pattern.
The **Snapshot** column pins the exact commit each component's docs were generated from, the baseline to diff against when refreshing (see [Keeping the docs in sync](#keeping-the-docs-in-sync)).
| Component | Repository | Snapshot (docs generated from) |
|---|---|---|
| [OSx, core / framework / common](/core/index.md) | [`aragon/osx`](https://github.com/aragon/osx) | [`4100bcf0`](https://github.com/aragon/osx/commit/4100bcf0bc) |
| [Token Voting](/plugins/token-voting-plugin.md) | [`aragon/token-voting-plugin`](https://github.com/aragon/token-voting-plugin) | [`e97b783d`](https://github.com/aragon/token-voting-plugin/commit/e97b783d76) |
| [Multisig](/plugins/multisig-plugin.md) | [`aragon/multisig-plugin`](https://github.com/aragon/multisig-plugin) | [`d0342706`](https://github.com/aragon/multisig-plugin/commit/d034270646) |
| [Admin](/plugins/admin-plugin.md) | [`aragon/admin-plugin`](https://github.com/aragon/admin-plugin) | [`ef1727ab`](https://github.com/aragon/admin-plugin/commit/ef1727abaf) |
| [Staged Proposal Processor](/plugins/spp-plugin.md) | [`aragon/staged-proposal-processor-plugin`](https://github.com/aragon/staged-proposal-processor-plugin) | [`676617a9`](https://github.com/aragon/staged-proposal-processor-plugin/commit/676617a9ca) |
| [Lock to Vote](/plugins/lock-to-vote-plugin.md) | [`aragon/lock-to-vote-plugin`](https://github.com/aragon/lock-to-vote-plugin) | [`5a513e3d`](https://github.com/aragon/lock-to-vote-plugin/commit/5a513e3d9f) |
| [Condition library](/helpers/condition-library.md) | [`aragon/conditions`](https://github.com/aragon/conditions) | [`7a9bb0df`](https://github.com/aragon/conditions/commit/7a9bb0dfb1) |
| [Protocol Factory](/deployment/protocol-factory.md) | [`aragon/protocol-factory`](https://github.com/aragon/protocol-factory) | [`444bc98a`](https://github.com/aragon/protocol-factory/commit/444bc98a4b) |
| [DAO Launchpad](/deployment/dao-launchpad.md) | [`aragon/dao-launchpad`](https://github.com/aragon/dao-launchpad) | [`b9fb5947`](https://github.com/aragon/dao-launchpad/commit/b9fb59475a) |
| [Plugin template](/tooling/plugin-template.md) | [`aragon/osx-plugin-template`](https://github.com/aragon/osx-plugin-template) | [`e43cf300`](https://github.com/aragon/osx-plugin-template/commit/e43cf30032) |
| [just-foundry](/tooling/just-foundry.md) | [`aragon/just-foundry`](https://github.com/aragon/just-foundry) | [`885dea0d`](https://github.com/aragon/just-foundry/commit/885dea0d8e) |
| [EVM Mirror](/tooling/evm-mirror.md) | [`aragon/evm-mirror`](https://github.com/aragon/evm-mirror) | [`0072576d`](https://github.com/aragon/evm-mirror/commit/0072576dbd) |
| [Capital Tree](/plugins/capital-tree.md) | [`aragon/capital-tree`](https://github.com/aragon/capital-tree) | [`47eb5ef`](https://github.com/aragon/capital-tree/commit/47eb5ef56e8f83822d832e23da49dc76b103d37c) |
## Keeping the docs in sync
These docs are a **distillation of source at a point in time**, the Snapshot commit above. To refresh a component after its repo moves on:
1. `git -C diff HEAD -- src/` (or the relevant paths) to see what actually changed.
2. Update the affected entries (their `source:` fields name the exact files), and re-verify examples.
3. **Bump the Snapshot commit** in the table above to the new baseline, and record the pass in log.md.
Pinning the commit (not just the repo) is what makes this a small, followable delta each time instead of a re-read from scratch.
# Change log
## 2026-11-30
- Corrected the Capital Tree pages against the source: added the fee branch to the avKAT example, the Open Fill checkpoint grant and the minimum OSx versions to setup, the full voter check to the compose guide, and token-behavior, solver-custody and event caveats.
## 2026-11-19
- Added Capital Tree concepts, execution, component interfaces, setup and recipe composition guidance from source snapshot `47eb5ef`, with recurring-buyback and distribution examples.
- Consolidated solver integration into one guide covering GenericFillSolver, offer queries, node-data encoding and submission with viem; linked component definitions and pinned source files. Capital Tree repository consolidation remains separate.
## 2026-10-16
- Extended the approved voice pilot across the repository's authored prose; preserved source-derived ABI content, technical examples, and operating rules. Independent fidelity and voice reviews are complete; human review of the draft PR is pending.
- Applied a targeted voice pilot to the root index, ratio reference, and PluginSetupProcessor concept; approved by the user before the wider prose pass.
- Reworked the existing-token importing guide around compatibility, wrapping trade-offs, and the community's token choice; added an independent installation example and a continuous path through delegation and snapshot readiness. An adversarial section-by-section review refined the delegation assumptions, both token paths, and the handoff to the proposal guide.
- Removed the earlier plugin documentation rewrite from this branch, including the staged-governance walkthrough. Retained distinct audit corrections and made the reviewed importing guide's dependency instructions independent of that rewrite.
## 2026-09-08
- Clarified proposal snapshots, excluded voting power, permission boundaries, and installation encoding after the plugin content audit.