Skip to main content

finalize

Contract: JBReconfigurationBufferBallot

Interface: IJBReconfigurationBufferBallot

Finalizes a configuration state if the current state has settled.

Definition​

function finalize(uint256 _projectId, uint256 _configured)
external
override
returns (JBBallotState ballotState) { ... }
  • Arguments:
    • _projectId is the ID of the project to which the funding cycle being checked belongs.
    • _configured is the configuration of the funding cycle to check the state of.
  • The function overrides a function definition from the IJBReconfigurationBufferBallot interface.
  • The function returns the state of the finalized ballot. If Active, the ballot can still later be finalized when it's state resolves.

Body​

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

    // Get the funding cycle for the configuration.
    JBFundingCycle memory _fundingCycle = fundingCycleStore.get(_projectId, _configured);

    Internal references:

    External references:

  2. Get a reference to the current finalized ballot state.

    // Get the current ballot state.
    ballotState = finalState[_projectId][_configured];

    Internal references:

  3. If the currency final state is still unresolved, store the updated value it if it has now resolved and emit a Finalize event with the relevant parameters.

    // If the final ballot skate is still `Active`.
    if (ballotState == JBBallotState.Active) {
    ballotState = stateOf(_projectId, _configured, _fundingCycle.start);
    // If the ballot is active after the cycle has started, it should be finalized as failed.
    if (ballotState != JBBallotState.Active) {
    // Store the updated value.
    finalState[_projectId][_configured] = ballotState;

    emit Finalize(_projectId, _configured, ballotState, msg.sender);
    }
    }

    Enums used:

    Internal references:

    Event references: