Skip to main content

_ballotStateOf

Contract: JBFundingCycleStore

A project's latest funding cycle configuration approval status.

Definition

function _ballotStateOf(
uint256 _projectId,
uint256 _configuration,
uint256 _start,
uint256 _ballotFundingCycleConfiguration
) private view returns (JBBallotState) { ... }
  • Arguments:
    • _projectId is the ID of the project to which the funding cycle belongs.
    • _configuration is the funding cycle configuration to get the ballot state of.
    • _start is the start time of the funding cycle configuration to get the ballot state of.
    • _ballotFundingCycleConfiguration is the configuration of the funding cycle which is configured with the ballot that should be used.
  • The view function is private to this contract.
  • The view function does not alter state on the blockchain.
  • The function returns the JBBallotState of the project.

Body

  1. If there is no ballot configuration, the ballot state is implicitly approved.

    // If there is no ballot funding cycle, implicitly approve.
    if (_ballotFundingCycleConfiguration == 0) return JBBallotState.Approved;

    Enums used:

  2. Get the funding cycle that has a reference of the ballot that should be used.

    // Get the ballot funding cycle.
    JBFundingCycle memory _ballotFundingCycle = _getStructFor(
    _projectId,
    _ballotFundingCycleConfiguration
    );

    Internal references:

  3. If there's no ballot, the funding cycle configuration is implicitly approved. Otherwise if the ballot's duration has not yet expired, it is implicitly active. Otherwise, return the state that the ballot for the provided configuration.

    // If there is no ballot, the ID is auto approved.
    // Otherwise if the ballot's duration hasn't passed, its still active.
    // Otherwise, return the ballot's state.
    if (_ballotFundingCycle.ballot == IJBFundingCycleBallot(address(0)))
    return JBBallotState.Approved;
    else if (_ballotFundingCycle.ballot.duration() >= block.timestamp - _configuration)
    return JBBallotState.Active;
    else return _ballotFundingCycle.ballot.stateOf(_projectId, _configuration, _start);

    Enums used:

    External references: