跳到主要内容

prepForMigrationOf

Contract: JBController​‌

Interface: IJBController

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

  1. 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:

  2. 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:

    Internal references:

    External references:

  3. Emit a PrepMigration event with the relevant parameters.

    emit PrepMigration(_projectId, _from, msg.sender);

    Event references: