Skip to main content

set

Contract: JBSplitsStore​‌

Interface: IJBSplitsStore

Sets a project's splits.

Only the owner or operator of a project, or the current controller contract of the project, can set its splits.

The new splits must include any currently set splits that are locked.

Definition

function set(
uint256 _projectId,
uint256 _domain,
JBGroupedSplits[] calldata _groupedSplits
)
external
override
requirePermissionAllowingOverride(
projects.ownerOf(_projectId),
_projectId,
JBOperations.SET_SPLITS,
address(directory.controllerOf(_projectId)) == msg.sender
) { ... }
  • Arguments:
    • _projectId is the ID of the project for which splits are being added.
    • _domain is an identifier within which the splits should be considered active.
    • _groupedSplits An array of splits to set for any number of groups.
  • Through the requirePermissionAllowingOverride modifier, the function is only accessible by the project's owner, from an operator that has been given the JBOperations.SET_SPLITS permission by the project owner for the provided _projectId , or from the current controller of the _projectId of the specified.
  • The function overrides a function definition from the IJBSplitsStore interface.
  • The function doesn't return anything.

Body

  1. Loop through each grouped split and set it.

    // Push array length in stack
    uint256 _groupedSplitsLength = _groupedSplits.length;

    // Set each grouped splits.
    for (uint256 _i; _i < _groupedSplitsLength; ) {
    // Get a reference to the grouped split being iterated on.
    JBGroupedSplits memory _groupedSplit = _groupedSplits[_i];

    // Set the splits for the group.
    _set(_projectId, _domain, _groupedSplit.group, _groupedSplit.splits);

    unchecked {
    ++_i;
    }
    }

    Internal references: