JBSplits
Inherits: JBControlled, IJBSplits
Stores and manages splits for each project.
State Variables
FALLBACK_RULESET_ID
The ID of the ruleset that will be checked if nothing was found in the provided rulesetId.
uint256 public constant override FALLBACK_RULESET_ID = 0;
_packedSplitParts1Of
Packed split data given the split's project, ruleset, and group IDs, as well as the split's index within that group.
preferAddToBalance in bit 0, percent in bits 1-32, projectId in bits 33-88, and beneficiary in bits
89-248
Note:
return: The split's preferAddToBalance, percent, projectId, and beneficiary packed into one
uint256.
mapping(
uint256 projectId => mapping(uint256 rulesetId => mapping(uint256 groupId => mapping(uint256 index => uint256)))
) internal _packedSplitParts1Of;
_packedSplitParts2Of
More packed split data given the split's project, ruleset, and group IDs, as well as the split's index within that group.
lockedUntil in bits 0-47, hook address in bits 48-207.
This packed data is often 0.
Note:
return: The split's lockedUntil and hook packed into one uint256.
mapping(
uint256 projectId => mapping(uint256 rulesetId => mapping(uint256 groupId => mapping(uint256 index => uint256)))
) internal _packedSplitParts2Of;
_splitCountOf
The number of splits currently stored in a group given a project ID, ruleset ID, and group ID.
mapping(uint256 projectId => mapping(uint256 rulesetId => mapping(uint256 groupId => uint256))) internal _splitCountOf;
Functions
constructor
constructor(IJBDirectory directory) JBControlled(directory);
Parameters
| Name | Type | Description |
|---|---|---|
directory | IJBDirectory | A contract storing directories of terminals and controllers for each project. |
splitsOf
Get the split structs for the specified project ID, within the specified ruleset, for the specified group. The splits stored at ruleset 0 are used by default during a ruleset if the splits for the specific ruleset aren't set.
If splits aren't found at the given rulesetId, they'll be sought in the FALLBACK_RULESET_ID of 0.
function splitsOf(
uint256 projectId,
uint256 rulesetId,
uint256 groupId
)
external
view
override
returns (JBSplit[] memory splits);
Parameters
| Name | Type | Description |
|---|---|---|
projectId | uint256 | The ID of the project to get splits for. |
rulesetId | uint256 | An identifier within which the returned splits should be considered active. |
groupId | uint256 | The identifying group of the splits. |
Returns
| Name | Type | Description |
|---|---|---|
splits | JBSplit[] | An array of all splits for the project. |