Skip to main content

setOperators

Contract: JBOperatorStore​‌

Interface: IJBOperatorStore

Sets permissions for many operators.

Only an address can set its own operators.

Definition

function setOperators(JBOperatorData[] calldata _operatorData) external override { ... }
  • _operatorData are the JBOperatorData that specify the params for each operator being set.
  • The function can be accessed externally by anyone.
  • The function overrides a function definition from the IJBOperatorStore interface.
  • The function doesn't return anything.

Body

  1. Loop through the provided operator data.

    for (uint256 _i; _i < _operatorData.length; ) { ... }
    1. Pack the provided permissions into a uint256. Each bit of the resulting value represents whether or not permission has been granted for that index.

      // Pack the indexes into a uint256.
      uint256 _packed = _packedPermissions(_operatorData[_i].permissionIndexes);

      Internal references:

    2. Store the packed permissions as the permissions of the provided operator, on behalf of the msg.sender, specifically for the provided domain.

      // Store the new value.
      permissionsOf[_operatorData[_i].operator][msg.sender][_operatorData[_i].domain] = _packed;

      Internal references:

    3. Emit a SetOperator event with the relevant parameters.

      emit SetOperator(
      _operatorData[_i].operator,
      msg.sender,
      _operatorData[_i].domain,
      _operatorData[_i].permissionIndexes,
      _packed
      );

      Event references:

    4. Increment the loop counter.

      unchecked {
      ++_i;
      }