Skip to main content

recordMigration

Contract: JBSingleTokenPaymentTerminalStore​‌

Interface: IJBSingleTokenPaymentTerminalStore

Records the migration of funds from this store.

The msg.sender must be an IJBSingleTokenPaymentTerminal.

Definition

function recordMigration(uint256 _projectId)
external
override
nonReentrant
returns (uint256 balance) { ... }
  • Arguments:
    • _projectId is the ID of the project being migrated.
  • The resulting function overrides a function definition from the JBSingleTokenPaymentTerminalStore interface.
  • The function returns the project's migrated balance, as a fixed point number with the same amount of decimals as its relative terminal.

Body

  1. Get a reference to the project's current funding cycle.

    // Get a reference to the project's current funding cycle.
    JBFundingCycle memory _fundingCycle = fundingCycleStore.currentOf(_projectId);

    External references:

  2. Make sure that migrating terminals is allowed by the current funding cycle.

    // Migration must be allowed.
    if (!_fundingCycle.terminalMigrationAllowed()) revert PAYMENT_TERMINAL_MIGRATION_NOT_ALLOWED();

    Library references:

  3. Get a reference to the project's current balance. Set this to the value that the function will return.

    // Return the current balance.
    balance = balanceOf[IJBSingleTokenPaymentTerminal(msg.sender)][_projectId];

    Internal references:

  4. Set the project's balance to 0 since funds are moving away from this terminal.

    // Set the balance to 0.
    balanceOf[IJBSingleTokenPaymentTerminal(msg.sender)][_projectId] = 0;

    Internal references: