Skip to main content

DAOFactory

Description

This contract is used to create a DAO.

Implementation

public variable daoBase

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

address daoBase

public variable daoRegistry

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

contract DAORegistry daoRegistry

public variable pluginSetupProcessor

The plugin setup processor for installing plugins on the newly created DAOs.

contract PluginSetupProcessor pluginSetupProcessor

public struct DAOSettings

struct DAOSettings {
address trustedForwarder;
string daoURI;
string subdomain;
bytes metadata;
}

public struct PluginSettings

struct PluginSettings {
struct PluginSetupRef pluginSetupRef;
bytes data;
}

error NoPluginProvided

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

error NoPluginProvided()

public function constructor

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

constructor(contract DAORegistry _registry, contract PluginSetupProcessor _pluginSetupProcessor) public
InputTypeDescription
_registrycontract DAORegistryThe DAO registry to register the DAO by its name.
_pluginSetupProcessorcontract PluginSetupProcessorThe address of PluginSetupProcessor.

public function supportsInterface

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

function supportsInterface(bytes4 _interfaceId) public view virtual returns (bool)
InputTypeDescription
_interfaceIdbytes4The ID of the interface.
Output
0boolReturns true if the interface is supported.

external function createDao

Creates a new DAO, registers it on the DAO registry, and installs a list of plugins via the plugin setup processor.

function createDao(struct DAOFactory.DAOSettings _daoSettings, struct DAOFactory.PluginSettings[] _pluginSettings) external returns (contract DAO createdDao)
InputTypeDescription
_daoSettingsstruct DAOFactory.DAOSettingsThe DAO settings to be set during the DAO initialization.
_pluginSettingsstruct DAOFactory.PluginSettings[]The array containing references to plugins and their settings to be installed after the DAO has been created.

internal function _createDAO

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

function _createDAO(struct DAOFactory.DAOSettings _daoSettings) internal returns (contract DAO dao)
InputTypeDescription
_daoSettingsstruct DAOFactory.DAOSettingsThe trusted forwarder, name and metadata hash of the DAO it creates.

internal function _setDAOPermissions

Sets the required permissions for the new DAO.

function _setDAOPermissions(contract DAO _dao) internal
InputTypeDescription
_daocontract DAOThe DAO instance just created.
© 2024