跳到主要内容

setOperator

Contract: JBOperatorStore​‌

Interface: IJBOperatorStore

Sets permissions for an operator.

Only an address can set its own operators.

Definition

 function setOperator(JBOperatorData calldata _operatorData) external override { ... }
  • _operatorData is the JBOperatorData 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

  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.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.operator][msg.sender][_operatorData.domain] = _packed;

    Internal references:

  3. Emit a SetOperator event with the relevant parameters.

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

    Event references: