Framework Contracts API

The natspec generated API for the framework contracts. You can also find the contracts on the following repository.

Factories

DAOFactory

constructor(contract DAORegistry _registry, contract PluginSetupProcessor _pluginSetupProcessor) public

The constructor setting the registry and plugin setup processor and creating the base contracts for the factory.

supportsInterface(bytes4 _interfaceId) → bool public

Checks if this or the parent contract supports an interface by its ID.

createDao(struct DAOFactory.DAOSettings _daoSettings, struct DAOFactory.PluginSettings[] _pluginSettings) → contract DAO createdDao, struct DAOFactory.InstalledPlugin[] installedPlugins external

Creates a new DAO, registers it in the DAO registry, and optionally installs plugins via the plugin setup processor.

If _pluginSettings is empty, the caller is granted EXECUTE_PERMISSION on the DAO.

_createDAO(struct DAOFactory.DAOSettings _daoSettings) → contract DAO dao internal

Deploys a new DAO ERC1967 proxy, and initialize it with this contract as the initial owner.

_setDAOPermissions(address _daoAddress) internal

Sets the required permissions for the new DAO.

daoBase() → address public

The DAO base contract, to be used for creating new DAO`s via `createERC1967Proxy function.

daoRegistry() → contract DAORegistry public

The DAO registry listing the DAO contracts created via this contract.

pluginSetupProcessor() → contract PluginSetupProcessor public

The plugin setup processor for installing plugins on the newly created `DAO`s.

NoPluginProvided() error

Thrown if PluginSettings array is empty, and no plugin is provided.

bytes32 ROOT_PERMISSION_ID internal

bytes32 UPGRADE_DAO_PERMISSION_ID internal

bytes32 SET_TRUSTED_FORWARDER_PERMISSION_ID internal

bytes32 SET_METADATA_PERMISSION_ID internal

bytes32 REGISTER_STANDARD_CALLBACK_PERMISSION_ID internal

bytes32 EXECUTE_PERMISSION_ID internal

bytes32 APPLY_INSTALLATION_PERMISSION_ID internal

PluginRepoFactory

constructor(contract PluginRepoRegistry _pluginRepoRegistry) public

Initializes the addresses of the Aragon plugin registry and PluginRepo base contract to proxy to.

supportsInterface(bytes4 _interfaceId) → bool public

Checks if this or the parent contract supports an interface by its ID.

createPluginRepo(string _subdomain, address _initialOwner) → contract PluginRepo external

Creates a plugin repository proxy pointing to the pluginRepoBase implementation and registers it in the Aragon plugin registry.

createPluginRepoWithFirstVersion(string _subdomain, address _pluginSetup, address _maintainer, bytes _releaseMetadata, bytes _buildMetadata) → contract PluginRepo pluginRepo external

Creates and registers a PluginRepo with an ENS subdomain and publishes an initial version 1.1.

After the creation of the PluginRepo and release of the first version by the factory, ownership is transferred to the _maintainer address.

_setPluginRepoPermissions(contract PluginRepo pluginRepo, address maintainer) internal

Set the final permissions for the published plugin repository maintainer. All permissions are revoked from the plugin factory and granted to the specified plugin maintainer.

The plugin maintainer is granted the MAINTAINER_PERMISSION_ID, UPGRADE_REPO_PERMISSION_ID, and ROOT_PERMISSION_ID.

_createPluginRepo(string _subdomain, address _initialOwner) → contract PluginRepo pluginRepo internal

Internal method creating a PluginRepo via the [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy pattern from the provided base contract and registering it in the Aragon plugin registry.

Passing an empty _subdomain will cause the transaction to revert.

pluginRepoRegistry() → contract PluginRepoRegistry public

The Aragon plugin registry contract.

pluginRepoBase() → address public

The address of the PluginRepo base contract to proxy to..

Registries

DAORegistry

constructor() public

Used to disallow initializing the implementation contract by an attacker for extra safety.

initialize(contract IDAO _managingDao, contract ENSSubdomainRegistrar _subdomainRegistrar) external

Initializes the contract.

register(contract IDAO dao, address creator, string subdomain) external

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.

A subdomain is unique within the Aragon DAO framework and can get stored here.

REGISTER_DAO_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the register function.

subdomainRegistrar() → contract ENSSubdomainRegistrar public

The ENS subdomain registrar registering the DAO subdomains.

DAORegistered(address indexed dao, address indexed creator, string subdomain) event

Emitted when a new DAO is registered.

InvalidDaoSubdomain(string subdomain) error

Thrown if the DAO subdomain doesn’t match the regex [0-9a-z\-]

PluginRepoRegistry

constructor() public

Used to disallow initializing the implementation contract by an attacker for extra safety.

initialize(contract IDAO _dao, contract ENSSubdomainRegistrar _subdomainRegistrar) external

Initializes the contract by setting calling the InterfaceBasedRegistry base class initialize method.

registerPluginRepo(string subdomain, address pluginRepo) external

Registers a plugin repository with a subdomain and address.

REGISTER_PLUGIN_REPO_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the register function.

subdomainRegistrar() → contract ENSSubdomainRegistrar public

The ENS subdomain registrar registering the PluginRepo subdomains.

PluginRepoRegistered(string subdomain, address pluginRepo) event

Emitted if a new plugin repository is registered.

InvalidPluginSubdomain(string subdomain) error

Thrown if the plugin subdomain doesn’t match the regex [0-9a-z\-]

EmptyPluginRepoSubdomain() error

Thrown if the plugin repository subdomain is empty.

Framework

PluginRepo

constructor() public

Used to disallow initializing the implementation contract by an attacker for extra safety.

initialize(address initialOwner) external

Initializes the contract by - initializing the permission manager - granting the MAINTAINER_PERMISSION_ID permission to the initial owner.

This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).

initializeFrom(uint8[3] _previousProtocolVersion, bytes _initData) external

Initializes the pluginRepo after an upgrade from a previous protocol version.

This function is a placeholder until we require reinitialization.

createVersion(uint8 _release, address _pluginSetup, bytes _buildMetadata, bytes _releaseMetadata) external

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.

updateReleaseMetadata(uint8 _release, bytes _releaseMetadata) external

Updates the metadata for release with content @fromHex(_releaseMetadata).

getLatestVersion(uint8 _release) → struct PluginRepo.Version public

Returns the latest version for a given release number.

getLatestVersion(address _pluginSetup) → struct PluginRepo.Version public

Returns the latest version for a given plugin setup.

getVersion(struct PluginRepo.Tag _tag) → struct PluginRepo.Version public

Returns the version associated with a tag.

getVersion(bytes32 _tagHash) → struct PluginRepo.Version public

Returns the version for a tag hash.

buildCount(uint8 _release) → uint256 public

Gets the total number of builds for a given release number.

tagHash(struct PluginRepo.Tag _tag) → bytes32 internal

The hash of the version tag obtained from the packed, bytes-encoded release and build number.

_authorizeUpgrade(address) internal

Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).

The caller must have the UPGRADE_REPO_PERMISSION_ID permission.

supportsInterface(bytes4 _interfaceId) → bool public

Checks if this or the parent contract supports an interface by its ID.

MAINTAINER_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the createVersion function.

UPGRADE_REPO_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the createVersion function.

latestRelease() → uint8 public

The ID of the latest release.

The maximum release number is 255.

VersionHashDoesNotExist(bytes32 versionHash) error

Thrown if a version does not exist.

InvalidPluginSetupInterface() error

Thrown if a plugin setup contract does not inherit from PluginSetup.

ReleaseZeroNotAllowed() error

Thrown if a release number is zero.

InvalidReleaseIncrement(uint8 latestRelease, uint8 newRelease) error

Thrown if a release number is incremented by more than one.

PluginSetupAlreadyInPreviousRelease(uint8 release, uint16 build, address pluginSetup) error

Thrown if the same plugin setup contract exists already in a previous releases.

EmptyReleaseMetadata() error

Thrown if the metadata URI is empty.

ReleaseDoesNotExist() error

Thrown if release does not exist.

mapping(uint8 => uint16) buildsPerRelease internal

The mapping between release and build numbers.

mapping(bytes32 => struct PluginRepo.Version) versions internal

The mapping between the version hash and the corresponding version information.

mapping(address => bytes32) latestTagHashForPluginSetup internal

The mapping between the plugin setup address and its corresponding version hash.

PluginSetupProcessor

This contract is temporarily granted the ROOT_PERMISSION_ID permission on the applying DAO and therefore is highly security critical.

canApply(address _dao, bytes32 _permissionId) modifier

A modifier to check if a caller has the permission to apply a prepared setup.

constructor(contract PluginRepoRegistry _repoRegistry) public

Constructs the plugin setup processor by setting the associated plugin repo registry.

prepareInstallation(address _dao, struct PluginSetupProcessor.PrepareInstallationParams _params) → address plugin, struct IPluginSetup.PreparedSetupData preparedSetupData external

Prepares the installation of a plugin.

applyInstallation(address _dao, struct PluginSetupProcessor.ApplyInstallationParams _params) external

Applies the permissions of a prepared installation to a DAO.

prepareUpdate(address _dao, struct PluginSetupProcessor.PrepareUpdateParams _params) → bytes initData, struct IPluginSetup.PreparedSetupData preparedSetupData external

Prepares the update of an UUPS upgradeable plugin.

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.

applyUpdate(address _dao, struct PluginSetupProcessor.ApplyUpdateParams _params) external

Applies the permissions of a prepared update of an UUPS upgradeable proxy contract to a DAO.

prepareUninstallation(address _dao, struct PluginSetupProcessor.PrepareUninstallationParams _params) → struct PermissionLib.MultiTargetPermission[] permissions external

Prepares the uninstallation of a plugin.

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.

applyUninstallation(address _dao, struct PluginSetupProcessor.ApplyUninstallationParams _params) external

Applies the permissions of a prepared uninstallation to a DAO.

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.

validatePreparedSetupId(bytes32 pluginInstallationId, bytes32 preparedSetupId) public

Validates that a setup ID can be applied for applyInstallation, applyUpdate, or applyUninstallation.

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.

APPLY_INSTALLATION_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the applyInstallation function.

APPLY_UPDATE_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the applyUpdate function.

APPLY_UNINSTALLATION_PERMISSION_ID() → bytes32 public

The ID of the permission required to call the applyUninstallation function.

states() → mapping(bytes32 => struct PluginSetupProcessor.PluginState) public

A mapping between the plugin installation ID (obtained from the DAO and plugin address) and the plugin state information.

This variable is public on purpose to allow future versions to access and migrate the storage.

repoRegistry() → contract PluginRepoRegistry public

The plugin repo registry listing the PluginRepo contracts versioning the PluginSetup contracts.

InstallationPrepared(address indexed sender, address indexed dao, bytes32 preparedSetupId, contract PluginRepo indexed pluginSetupRepo, struct PluginRepo.Tag versionTag, bytes data, address plugin, struct IPluginSetup.PreparedSetupData preparedSetupData) event

Emitted with a prepared plugin installation to store data relevant for the application step.

InstallationApplied(address indexed dao, address indexed plugin, bytes32 preparedSetupId, bytes32 appliedSetupId) event

Emitted after a plugin installation was applied.

UpdatePrepared(address indexed sender, address indexed dao, bytes32 preparedSetupId, contract PluginRepo indexed pluginSetupRepo, struct PluginRepo.Tag versionTag, struct IPluginSetup.SetupPayload setupPayload, struct IPluginSetup.PreparedSetupData preparedSetupData, bytes initData) event

Emitted with a prepared plugin update to store data relevant for the application step.

UpdateApplied(address indexed dao, address indexed plugin, bytes32 preparedSetupId, bytes32 appliedSetupId) event

Emitted after a plugin update was applied.

UninstallationPrepared(address indexed sender, address indexed dao, bytes32 preparedSetupId, contract PluginRepo indexed pluginSetupRepo, struct PluginRepo.Tag versionTag, struct IPluginSetup.SetupPayload setupPayload, struct PermissionLib.MultiTargetPermission[] permissions) event

Emitted with a prepared plugin uninstallation to store data relevant for the application step.

UninstallationApplied(address indexed dao, address indexed plugin, bytes32 preparedSetupId) event

Emitted after a plugin installation was applied.

SetupApplicationUnauthorized(address dao, address caller, bytes32 permissionId) error

Thrown if a setup is unauthorized and cannot be applied because of a missing permission of the associated DAO.

This is thrown if the APPLY_INSTALLATION_PERMISSION_ID, APPLY_UPDATE_PERMISSION_ID, or APPLY_UNINSTALLATION_PERMISSION_ID is missing.

PluginNonupgradeable(address plugin) error

Thrown if a plugin is not upgradeable.

PluginProxyUpgradeFailed(address proxy, address implementation, bytes initData) error

Thrown if the upgrade of an UUPSUpgradeable proxy contract (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) failed.

IPluginNotSupported(address plugin) error

Thrown if a contract does not support the IPlugin interface.

PluginRepoNonexistent() error

Thrown if a plugin repository does not exist on the plugin repo registry.

SetupAlreadyPrepared(bytes32 preparedSetupId) error

Thrown if a plugin setup was already prepared indicated by the prepared setup ID.

SetupNotApplicable(bytes32 preparedSetupId) error

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.

InvalidUpdateVersion(struct PluginRepo.Tag currentVersionTag, struct PluginRepo.Tag newVersionTag) error

Thrown if the update version is invalid.

PluginAlreadyInstalled() error

Thrown if plugin is already installed and one tries to prepare or apply install on it.

InvalidAppliedSetupId(bytes32 currentAppliedSetupId, bytes32 appliedSetupId) error

Thrown if the applied setup ID resulting from the supplied setup payload does not match with the current applied setup ID.