prepForMigrationOf
Contract: JBController
Interface: IJBController
- Step by step
- Code
- Errors
- Events
- Bug bounty
Allows other controllers to signal to this one that a migration is expected for the specified project.
This controller should not yet be the project's controller.
Definition
function prepForMigrationOf(uint256 _projectId, address _from) external virtual override { ... }
- Arguments:
_projectId
is the ID of the project that will be migrated to this controller._from
is the controller being migrated from.
- The function can be accessed externally by anyone.
- The function can be overriden by inheriting contracts.
- The function overrides a function definition from the
IJBController
interface. - The function doesn't return anything.
Body
-
Make sure this controller isn't the project's current controller. If it is, there shouldn't be a need to prepare anything.
// This controller must not be the project's current controller.
if (directory.controllerOf(_projectId) == address(this))
revert CANT_MIGRATE_TO_CURRENT_CONTROLLER();Internal references:
External references:
-
Update the processed token tracker to equal the current total supply of tokens. This prevents any inadvertant outstanding reserved tokens from being distributable upon migrating to this controller.
// Set the tracker as the total supply.
_processedTokenTrackerOf[_projectId] = SafeCast.toInt256(tokenStore.totalSupplyOf(_projectId));Library references:
SafeCast
.toInt256(...)
Internal references:
External references:
-
Emit a
PrepMigration
event with the relevant parameters.emit PrepMigration(_projectId, _from, msg.sender);
Event references:
/**
@notice
Allows other controllers to signal to this one that a migration is expected for the specified project.
@dev
This controller should not yet be the project's controller.
@param _projectId The ID of the project that will be migrated to this controller.
@param _from The controller being migrated from.
*/
function prepForMigrationOf(uint256 _projectId, address _from) external virtual override {
// This controller must not be the project's current controller.
if (directory.controllerOf(_projectId) == address(this))
revert CANT_MIGRATE_TO_CURRENT_CONTROLLER();
// Set the tracker as the total supply.
_processedTokenTrackerOf[_projectId] = SafeCast.toInt256(tokenStore.totalSupplyOf(_projectId));
emit PreppedMigration(_projectId, _from, msg.sender);
}
String | Description |
---|---|
CANT_MIGRATE_TO_CURRENT_CONTROLLER | Thrown if the controller is the current controller for the project. |
Name | Data |
---|---|
PrepMigration |
|
Category | Description | Reward |
---|---|---|
Optimization | Help make this operation more efficient. | 0.5ETH |
Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH |
High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |