Skip to content

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 ​

solidity
constructor(DAORegistry _registry, PluginSetupProcessor _pluginSetupProcessor)

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

ParameterTypeDescription
_registryDAORegistryThe DAO registry to register the DAO by its name.
_pluginSetupProcessorPluginSetupProcessorThe 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.

ParameterTypeDescription
_daoSettingsDAOFactory.DAOSettingsThe settings to configure during DAO initialization.
_pluginSettingsDAOFactory.PluginSettings[]An array containing plugin references and settings. If provided, each plugin is installed after the DAO creation.
ReturnsTypeDescription
createdDaoDAOThe address of the newly created DAO instance.
installedPluginsDAOFactory.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.

ReturnsTypeDescription
[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.

ParameterTypeDescription
_interfaceIdbytes4The 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 DAOs 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 DAOs.

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;
}
FieldTypeDescription
pluginSetupRefPluginSetupRef
databytes