-
-
Save krsnnik/0f28269368ba5331fc1b7322d8a32e84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @dev See `IERC777.authorizeOperator`. | |
*/ | |
function authorizeOperator(address operator) external { | |
require(msg.sender != operator, "ERC777: authorizing self as operator"); | |
if (_defaultOperators[operator]) { | |
delete _revokedDefaultOperators[msg.sender][operator]; | |
} else { | |
_operators[msg.sender][operator] = true; | |
} | |
emit AuthorizedOperator(operator, msg.sender); | |
} | |
/** | |
* @dev See `IERC777.revokeOperator`. | |
*/ | |
function revokeOperator(address operator) external { | |
require(operator != msg.sender, "ERC777: revoking self as operator"); | |
if (_defaultOperators[operator]) { | |
_revokedDefaultOperators[msg.sender][operator] = true; | |
} else { | |
delete _operators[msg.sender][operator]; | |
} | |
emit RevokedOperator(operator, msg.sender); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment