setOperator
Contract: JBOperatorStore
Interface: IJBOperatorStore
- Step by step
- Code
- Events
- Bug bounty
Sets permissions for an operator.
Only an address can set its own operators.
Definition
function setOperator(JBOperatorData calldata _operatorData) external override { ... }
_operatorData
is theJBOperatorData
that specifies the params for the 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
-
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.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.operator][msg.sender][_operatorData.domain] = _packed;Internal references:
-
Emit a
SetOperator
event with the relevant parameters.emit SetOperator(
_operatorData.operator,
msg.sender,
_operatorData.domain,
_operatorData.permissionIndexes,
_packed
);Event references:
/**
@notice
Sets permissions for an operator.
@dev
Only an address can set its own operators.
@param _operatorData The data that specifies the params for the operator being set.
*/
function setOperator(JBOperatorData calldata _operatorData) external override {
// Pack the indexes into a uint256.
uint256 _packed = _packedPermissions(_operatorData.permissionIndexes);
// Store the new value.
permissionsOf[_operatorData.operator][msg.sender][_operatorData.domain] = _packed;
emit SetOperator(
_operatorData.operator,
msg.sender,
_operatorData.domain,
_operatorData.permissionIndexes,
_packed
);
}
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 |