MezzDeployer
Inherits: ReentrancyGuardUpgradeable, HubOwnableUUPSUpgradeable, IMezzDeployer
Author: Daniel Yamagata & Naveen Ailawadi
Deploys all 'core' contracts for a Mezzanine Instance. The Mezz Deployer is the initial contract that a user interacts with to deploy a Mezz Company
The Mezz Deployer includes defaults for Mezz guards based on their core ID. Refer to src/core/guards/base/MezzGuard.sol for more information If the guard is a 'blacklist', defaults are meant to include malicious contracts and functions which should be blocked. If the guard is a 'whitelist', defaults are meant to include contracts and function which should be enabled By default, every guard in Mezzanine is a 'blacklist' as it is less heavy-handed than a 'whitelist'
State Variables
MEZZ_MIGRATOR
MezzDeployerStorageLocation
Functions
_getMezzDeployerStorage
constructor
init
Sets the Reentrancy Guard's status to '_NOT_ENTERED'
__MezzDeployer_init
deployMezzInstance
Deploys a Mezz Instance with the given 'initArgs'. This is the first function that a user should interact with in Mezzanine
The address of the common shares is not returned but is queryable via the Treasury
Parameters
Name | Type | Description |
---|---|---|
|
| The arguments to initialize the Mezz Instance with |
Returns
Name | Type | Description |
---|---|---|
|
| The Mezz Instance, which includes the treasury, finance department, governor, and the token timelock |
deployGuard
Deploys and initializes a Mezzanine Guard.
Parameters
Name | Type | Description |
---|---|---|
|
| The coreId of the guard implementation to deploy |
|
| The address to set as the controlled |
|
| The address to set as the controller |
|
| Additional params used during the guard's initialization |
Returns
Name | Type | Description |
---|---|---|
|
| The address of the deployed guard |
_deployGuard
Deploys and initializes a guard atomically. Used in deployGuard(), deployMezzInstance(), and deployDepartment()
deployDepartment
Deploy and initializes a department atomically
The department is not atomically inserted as a child to the provided Treasury or Department. This must be done via a separate transaction or can be done atomically via a multicall
Parameters
Name | Type | Description |
---|---|---|
|
| The core ID of the department to deploy |
|
| The core ID of the guard to deploy, whose 'controlled' will be the deployed department and 'controller' will be 'parent' |
|
| The treasury contract that the department is associated with |
|
| The signers for the department's multisignature functionality |
|
| The threshold for the department's multisignature functionality |
|
| The parent of the department to deploy |
|
| Bespoke abi.encoded parameters to pass to the department's init() function |
Returns
Name | Type | Description |
---|---|---|
|
| The address of the deployed department |
deployModule
Deploys and initializes a module atomically
The module is not atomically inserted as a child to the provided Treasury or Department. This must be done via a separate transaction or can be done atomically via a multicall
Parameters
Name | Type | Description |
---|---|---|
|
| The core ID of the module to deploy |
|
| |
|
| The bespoke abi.encoded parameters to pass to the module's init() function |
Returns
Name | Type | Description |
---|---|---|
|
| The address of the deployed module |
deployAsset
Deploys and initialize an asset associated with 'assetCoreId' and returns the deployed contract
Used by Treasury contracts when adding assets to the capital stack
Parameters
Name | Type | Description |
---|---|---|
|
| The core ID of the asset to deploy |
|
| The treasury contract that the asset is associated with. Used during the asset initialization |
|
| The bespoke abi-encoded parameters used for the asset's initialization |
Returns
Name | Type | Description |
---|---|---|
|
| The address of the deployed asset |
deployGovernor
Deploys and initializes a governor associated with 'governorCoreId' and returns the deployed contract
Used by Treasury contracts when changing governors
Parameters
Name | Type | Description |
---|---|---|
|
| The core ID of the governor to deploy |
|
| The treasury contract that the governor is associated with |
|
| Bespoke abi.encoded params for the governor's initialization function |
Returns
Name | Type | Description |
---|---|---|
|
| The address of the deployed governor |
addGuardSelectorDefault
Adds a selector default to the Guard with the given 'coreId'. Only callable by the Mezz Hub Owner
Will revert if the selector default is already set
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
addGuardContractDefault
Adds a contract default to the Guard with the given 'coreId'. Only callable by the Mezz Hub Owner
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| The default to add |
removeGuardSelectorDefault
Removes a selector default for the Guard with the given 'coreId'. Only callable by the Mezz Hub Owner
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| The default to remove |
removeGuardContractDefault
Removes a contract default for the Guard with the given 'coreId'. Only callable by the Mezz Hub Owner
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| The default to remove |
getTreasuryFromSymbol
Returns a company's treasury contract from its symbol. From there, the company's organizations, governor, etc. can be reconstructed on a frontend
Returns
Name | Type | Description |
---|---|---|
|
| The treasury contract address |
isCompanyNameTaken
Returns true if 'companyName' is taken, false otherwise
isCompanySymbolTaken
Returns true if 'companySymbol' is taken, false otherwise
getGuardSelectorDefaults
Returns the selector defaults for the guard associated with the given 'coreId'
Returns
Name | Type | Description |
---|---|---|
|
| The defaults as an array of DataTypes.GuardSelector |
getGuardContractDefaults
Returns the contract defaults for the guard associated with the given 'coreId'
Returns
Name | Type | Description |
---|---|---|
|
| The defaults as an array of addresses |
_validateGuardImplementation
Validates that 'guardImplementation' supports the IMezzGuard interface
_validateGovernorCoreId
Reverts if 'governorCoreId' does not correspond to an implemented governor implementation
_validateOwners
Valdiates that '_owners' does not contain address(0)
_validateCompanyName
Validates the company's name's length and that it does not end in a space
_setCompanyName
Validates 'companyName'. Sets state accordingly
_validateCompanySymbol
Validate that the company's symbol does not contain a banned character This functions runs in O(n), where n is the number of bytes in the company symbol, since the number of bytes in BANNED_CHARS is constant Using two for-loops is more gas-efficcient than storing banned chars in an enumerable set, since MLOADs are so much cheaper than SLOADs
_setCompanySymbol
Validates 'companySymbol'. Sets state accordingly
Returns
Name | Type | Description |
---|---|---|
|
| The symbol hash |
Structs
MezzDeployerStorage
Last updated