MezzHub
Inherits: CommonValidation, ModifiedOwnable2StepUpgradeable, DelayedUUPSUpgradeable, IMezzHub
Author: Daniel Yamagata & Jerry Qi & Naveen Ailawadi
The central contract of the Mezzanine protocol. It manages the protocol state and whitelists and is used by 'core' contracts to query 'non-core' contracts
The addresses of the 'non-core' contracts can only be updated via an upgrade, which must be proposed and executed by the 'owner'. Upgrades require a delay before they can be executed. Similarly, the transfer of ownership requires a delay before it can be accepted. The renouncement of ownership is disabled to prevent griefing by a compromised 'owner'. The re-enablement of this functionality must be done via an upgrade
State Variables
PRECISION_FACTOR
MezzHubStorageLocation
Functions
_getMezzHubStorage
constructor
onlyOwnerOrDefender
Reverts if the caller is not the 'owner' or a 'defender'
ownershipTransferSnapshot
Returns the snapshot of the ownership transfer. This snapshot must pass before a pending ownership transfer can occur. If there is no pending ownership transfer, this will will return zero
frozenSnapshot
Returns the snapshot of the protocol freeze. This snapshot must pass before the protocol can
owner
Returns the address of the Mezz Hub owner
init
Initializes the Mezz Hub state. Can only be called once
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the initial Mezz Hub owner |
|
| The address of the Document Registry |
|
| The address of the Mezz Deployer |
|
| The address of the Fee Controller |
__MezzHub_init
transferOwnership
Overridden 'transferOwnership' such that a snapshot is taken upon the transfer of ownership
acceptOwnership
Overridden '_acceptOwnership' such that the snapshot is validated before the ownership transfer is accepted
cancelOwnershipTransfer
Cancels a pending ownership transfer. Only callable by the 'owner' or a 'defender' Deletes the snapshot of the ownership transfer and the pending owner
renounceOwnership
Deprecation of 'renounceOwnership' from OwnableUpgradeable to prevent griefing by a compromised 'owner'
freezeProtocol
Freezes the protocol for 'freezeDuration', which can be up to 14 days. Only callable by the 'owner' or a 'defender' The protocol can be re-frozen at any point while it is frozen.
Parameters
Name | Type | Description |
---|---|---|
|
| The duration to freeze the protocol for in seconds |
setProtocolState
Sets the protocol state. Only callabe by the owner.
Protocol state is defined by the following enum:
0: Active
1: Paused
2: Frozen
If protocol state is set by this function, it will be permanently set until this function is called again to change state.
Parameters
Name | Type | Description |
---|---|---|
|
| The protocol state to set |
proposeUpgrade
Proposes an upgrade to the contract's implementation
The caller must be authorized to propose an upgrade. This authorization is determined by inheriting contracts
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the new implementation |
Returns
Name | Type | Description |
---|---|---|
|
| The snapshot of the pending upgrade as a unix-timestamp |
cancelProposedUpgrade
Cancels the pending upgrade, deleting the 'pendingUpgrade' and 'pendingUpgradeSnapshot' in storage
The caller must be authorized to cancel a pending upgrade. This authorization is determined by inheriting contracts
setFrozenImplementation
Sets the 'implementationToSet' to 'setting'. If true and 'implementationToSet' is StateAware, the implementation's pausable and freezable functions will revert Only callable by the 'owner'
setFrozenDeployment
Sets the 'deploymentToSet' to 'setting'. If true, the deployment's pausable and freezable functions will revert Only callable by the 'owner' or a 'defender'
addWhitelistedDenominationAsset
Adds 'denominationAssetToAdd' to the denomination asset whitelist. Only callable by the 'owner'
The owner should be cautious to never add ERC777s to the whitelist to prevent possible reentrancy attacks
removeWhitelistedDenominationAsset
Removes 'denominationAssetToRemove' from the denomination asset whitelist. Only callable by the 'owner'
addDefender
Adds 'defenderToAdd' to the set of defenders. Only callable by the 'owner'
removeDefender
Removes 'defenderToRemove' from the set of defenders. Only callable by the 'owner'
isDefender
Returns true if 'defenderToCheck' is a defender, false otherwise
isDenominationAsset
Returns true 'denominationAssetToCheck' is whitelisted, false otherwise
isDeploymentFrozen
Returns true if 'deploymentToCheck' is frozen, false otherwise
isImplementationFrozen
Returns true if 'implementationToCheck' is frozen, false otherwise
getDefenders
Returns the set of defenders as an array of addresses
getDenominationAssets
Returns the set of denomination assets in no specific order
getDocumentRegistry
Returns the address of the Document Registry
Used by core contracts
getFeeController
Returns the address of the fee controller
Used by core contracts
getMezzDeployer
Returns the address of the Mezz Deployer
Used by the core contracts
getProtocolState
Returns the Protocol State as an enum, DataTypes.ProtocolState
*The protocol state is defined by the following enum:
0: Active
1: Paused
2: Frozen
The protocol can be frozen in two ways:
(1) The protocol's state was set to 'Frozen' by the owner via 'setProtocolState()'. If this is the case, it can be unfrozen at any point in time
(2) The 'owner' or a 'defender' set the protocol's state to 'Frozen' via 'freezeProtocol()', which freezes the protocol for a period of time. It cannot be unfrozen until this time passes*
_setDocumentRegistry
_setMezzDeployer
_setFeeController
_validateCallerIsOwnerOrDefender
Reverts if the caller is not the 'owner' or a 'defender'
_isCallerDefender
_isCallerOwner
_authorizeUpgrade
Overridden '_authorizeUpgrade()' from DelayedUUPSUpgradeable such that only the 'owner' can execute an upgrade
Structs
MezzHubStorage
Last updated