MezzMigrator
Inherits: ReentrancyGuardUpgradeable, HubOwnableUUPSUpgradeable, IMezzMigrator
Author: Daniel Yamagata & Naveen Ailawadi
The Mezz Migrator is responsible for upgrading core contracts to newer versions, resetting the latest versions to patched implementations, and providing the address of the latest version of an implementation
The data used for a reinitialization function is validated such that a team cannot manage its owners, modules, or guard during an upgrade
State Variables
MezzMigratorStorageLocation
Functions
_getMezzMigratorStorage
constructor
init
Initializer for the Mezz Migrator. Sets up the V1 implementations for the given Core IDs. Only callabe by the owner of the Mezz Hub
Even though Mezz Migrator is not UUPSUpgradeable, an initializer is used to set up the V1 implementations This is due to the fact that implementations need to be aware of the Mezz Migrator upon construction Therefore, the Mezz Migrator is unable to use them in its own construction
Parameters
coreIds
bytes32[]
The coreIds of the implementations
implementations
address[]
The addresses of the implementations
__MezzMigrator_init
setNewCoreVersion
Sets a 'newImplementation' for the latest version of 'coreId'. Only callable by the Mezz Hub Owner
Parameters
coreId
bytes32
The coreId of the implementation
newImplementation
address
The address of the new implementation
resetLatestCoreVersion
Resets the latest version associated with the Core ID back to the prior version. Only callable by the Mezz Hub Owner
Does not change the latest core version. Only resets the latest version's implementation for a given core ID
Parameters
coreId
bytes32
The core ID to reset the latest version for
newImplementation
address
The new implementation to set the latest version to
upgradeToNewerVersion
Upgrades the caller, who is assumed to be a contract, to a newer version
This function is not access controlled
resetToPatchedLatestVersion
Resets the caller's contract to the latest version, which should be patched beforehand. Only callabe if the protocol state is paused or frozen
The caller must be the latest version to be able to reset the latest patched version
Parameters
data
bytes
Data used for the initialization
getLatestVersion
Returns the latest version for a given core implementation
Returns
<none>
uint256
The latest version as a uint256
getLatestCoreImplementation
Returns the latest implementation for a given core ID
getCoreImplementationByVersion
Returns the implementation for a given core ID and version
_setUpV1CoreIds
Validates and sets the initial core IDs and implementations in the constructor
_validateImplementationSupportsCredentialedInterface
Validates that the implementation supports the 'ICredentialed' interface
_validateLatestVersion
Reverts if the latest version is zero
_validateVersion
Reverts if 'version is zero or greater than 'latestVersion'
_validateImplementationVersion
Validates that the implementation version is equal to the 'expectedVersion'
_validateImplementationCoreId
Validates that the implementation core ID is equal to the passed in core ID