IMigratable

Git Source

Inherits: IERC1967

Unlike a simple upgrade, a migration is defined as:

  • Logic to determine the migration flow based on any conditions, and/or
  • Logic to determine the implementation to upgrade to, and/or
  • Logic to determine if the upgrade or migration should occur, and/or
  • State changes to the proxy storage, and/or
  • Setting the proxy's implementation slot. All the above can be kicked off by anyone, and without parameters, which is useful in governance models.

Functions

migrate

Initiates a migration of the proxy, in a way defined by the implementation.

Normally, the implementation has a way of determining the migrator that needs to be delegatecalled.

function migrate() external;

Events

Migrated

Emitted when the implementation is migrated.

The migrator contains fixed arbitrary code to manipulate storage, including the implementation slot.

event Migrated(address indexed migrator);

Parameters

NameTypeDescription
migratoraddressThe address of the migrator, which the proxy has delegatecalled to perform the migration.

Errors

ZeroMigrator

Thrown when the migrator being delegatecalled is zero (i.e. address(0)).

error ZeroMigrator();

MigrationFailed

Thrown when the migration fails (i.e. the delegatecall to the migrator reverts).

error MigrationFailed(address migrator_, bytes revertData_);

Parameters

NameTypeDescription
migrator_addressThe address of the migrator, which the proxy has delegatecalled to perform the migration.
revertData_bytesThe revert data from the migration.

EmptyCode

Thrown when the migrator is empty (i.e. has no code).

error EmptyCode(address migrator_);

Parameters

NameTypeDescription
migrator_addressThe address of the migrator, which the proxy has delegatecalled to perform the migration.