setOperators
Contract: JBOperatorStore
Interface: IJBOperatorStore
- Step by step
 - Code
 - Events
 - Bug bounty
 
Sets permissions for many operators.
Only an address can set its own operators.
Definition
function setOperators(JBOperatorData[] calldata _operatorData) external override { ... }
_operatorDataare theJBOperatorDatathat specify the params for each operator being set.- The function can be accessed externally by anyone.
 - The function overrides a function definition from the 
IJBOperatorStoreinterface. - The function doesn't return anything.
 
Body
- 
Loop through the provided operator data.
for (uint256 _i; _i < _operatorData.length; ) { ... }- 
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:
 - 
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:
 - 
Emit a
SetOperatorevent with the relevant parameters.emit SetOperator(
_operatorData[_i].operator,
msg.sender,
_operatorData[_i].domain,
_operatorData[_i].permissionIndexes,
_packed
);Event references:
 - 
Increment the loop counter.
unchecked {
++_i;
} 
 - 
 
/**
  @notice
  Sets permissions for many operators.
  @dev
  Only an address can set its own operators.
  @param _operatorData The data that specify the params for each operator being set.
*/
function setOperators(JBOperatorData[] calldata _operatorData) external override {
  for (uint256 _i; _i < _operatorData.length; ) {
    // Pack the indexes into a uint256.
    uint256 _packed = _packedPermissions(_operatorData[_i].permissionIndexes);
    // Store the new value.
    permissionsOf[_operatorData[_i].operator][msg.sender][_operatorData[_i].domain] = _packed;
    emit SetOperator(
      _operatorData[_i].operator,
      msg.sender,
      _operatorData[_i].domain,
      _operatorData[_i].permissionIndexes,
      _packed
    );
    unchecked {
      ++_i;
    }
  }
}
SetOperator | 
  | 
| Category | Description | Reward | 
|---|---|---|
| Optimization | Help make this operation more efficient. | 0.5ETH | 
| Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH | 
| High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |