DAOFactory
Contract · src/framework/dao/DAOFactory.sol
Explained in: A hands-on tour of OSx, DAOFactory (creating a DAO), Deploy your first DAO, Install a plugin into a live DAO, Launch a governance token with your DAO, Manage permissions through governance
Author: Aragon X - 2022-2023
Inherits: ERC165, ProtocolVersion
This contract is used to create a DAO.
security-contact: sirt@aragon.org
Constructor
constructor
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 | The DAO registry to register the DAO by its name. |
_pluginSetupProcessor | PluginSetupProcessor | The address of PluginSetupProcessor. |
Functions
createDao
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
_pluginSettingsis empty, the caller is grantedEXECUTE_PERMISSIONon the DAO.
| Parameter | Type | Description |
|---|---|---|
_daoSettings | DAOFactory.DAOSettings | The settings to configure during DAO initialization. |
_pluginSettings | DAOFactory.PluginSettings[] | An array containing plugin references and settings. If provided, each plugin is installed after the DAO creation. |
| Returns | Type | Description |
|---|---|---|
createdDao | DAO | The address of the newly created DAO instance. |
installedPlugins | DAOFactory.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
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
releaseandbuildnumbers found in theVersion.Tagstruct inside thePluginRepocontract 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
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
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
address public immutable daoBase;The DAO base contract, to be used for creating new DAOs via createERC1967Proxy function.
daoRegistry
DAORegistry public immutable daoRegistry;The DAO registry listing the DAO contracts created via this contract.
pluginSetupProcessor
PluginSetupProcessor public immutable pluginSetupProcessor;The plugin setup processor for installing plugins on the newly created DAOs.
Structs
DAOSettings
struct DAOSettings {
address trustedForwarder;
string daoURI;
string subdomain;
bytes metadata;
}InstalledPlugin
struct InstalledPlugin {
address plugin;
IPluginSetup.PreparedSetupData preparedSetupData;
}PluginSettings
struct PluginSettings {
PluginSetupRef pluginSetupRef;
bytes data;
}| Field | Type | Description |
|---|---|---|
pluginSetupRef | PluginSetupRef | |
data | bytes |