_eligibleOf
Contract: JBFundingCycleStore
- Step by step
- Code
- Bug bounty
The project's stored funding cycle that has started and hasn't yet expired.
A value of 0 is returned if no funding cycle was found.
Assumes the project has a latest configuration.
Definition
function _eligibleOf(uint256 _projectId) private view returns (uint256 configuration) { ... }
- Arguments:
_projectId
is the ID of the project to look through.
- The view function is private to this contract.
- The view function does not alter state on the blockchain.
- The function returns the configuration of an eligible funding cycle if one exists, or 0 if one doesn't exist.
Body
-
Get a reference to the latest funding cycle for the project.
// Get a reference to the project's latest funding cycle.
configuration = latestConfigurationOf[_projectId];Internal references:
-
Get the struct for the latest funding cycle.
// Get the latest funding cycle.
JBFundingCycle memory _fundingCycle = _getStructFor(_projectId, configuration);Internal references:
-
If the latest is expired, return an empty funding cycle since there can't be a stored eligible cycle.
// If the latest is expired, return an empty funding cycle.
// A duration of 0 cannot be expired.
if (
_fundingCycle.duration > 0 && block.timestamp >= _fundingCycle.start + _fundingCycle.duration
) return 0; -
If the funding cycle has started, it must be eligible.
// Return the funding cycle's configuration if it has started.
if (block.timestamp >= _fundingCycle.start) return _fundingCycle.configuration;