跳到主要内容

stateOf

Contract: JBReconfigurationBufferBallot

Interface: IJBFundingCycleBallot

The approval state of a particular funding cycle.

Definition

function stateOf(
uint256 _projectId,
uint256 _configured,
uint256 _start
) public view override returns (JBBallotState) { ... }
  • 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.
    • _start is the start timestamp of the funding cycle to check the state of.
  • The view function can be accessed externally by anyone.
  • The view function does not alter state on the blockchain.
  • The function overrides a function definition from the IJBFundingCycleBallot interface.
  • The function returns the state of the provided ballot.

Body

  1. The ballot is failed if the start time of the funding cycle is

    // If the provided configured timestamp is after the start timestamp, the ballot is Failed.
    if (_configured > _start) return JBBallotState.Failed;

    Enums used:

  2. If the configuration took place before the funding cycle's start with sufficient time to cover this ballot's duration, it is approved. Otherwise, it is failed.

    unchecked {
    // If there was sufficient time between configuration and the start of the cycle, it is approved. Otherwise, it is failed.
    return (_start - _configured < duration) ? JBBallotState.Failed : JBBallotState.Approved;
    }

    Enums used: