跳到主要内容

_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, return the state that the ballot for the provided configuration.

    // If there is no ballot, the ID is auto approved.
    if (_ballotFundingCycle.ballot == IJBFundingCycleBallot(address(0)))
    return JBBallotState.Approved;
// Return the ballot's state
return _ballotFundingCycle.ballot.stateOf(_projectId, _configuration, _start);
```

_Enums used:_

* [`JBBallotState`](/zh/dev/api/enums/jbballotstate)
* `.Approved`

_External references:_

* [`stateOf`](/zh/dev/api/interfaces/ijbfundingcycleballot)