From 8dde866fa1bd501b733595d40f426b01196fa768 Mon Sep 17 00:00:00 2001 From: uintgroup Date: Thu, 10 Aug 2023 19:04:26 -0400 Subject: [PATCH] got rid of override clash with context --- package.json | 4 ++-- src/SelectivePausable.sol | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 01b7517..cbce434 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uintgroup/selective-pausable", - "version": "1.0.0", + "version": "1.0.2", "description": "An expansion on OpenZeppelin's Pausable.sol. This contract adds the ability to pause each function by its selector.", "main": "index.js", "directories": { @@ -29,4 +29,4 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" } -} +} \ No newline at end of file diff --git a/src/SelectivePausable.sol b/src/SelectivePausable.sol index be0bc95..4347cad 100644 --- a/src/SelectivePausable.sol +++ b/src/SelectivePausable.sol @@ -37,11 +37,11 @@ abstract contract SelectivePausable { * @dev Reverts if the function of the function selector in _msgSig() is paused. */ modifier whenNotPausedSelective(bool _pauseAfterCall) { - if (functionIsPaused[_msgSig()]) { - revert FunctionIsPaused(_msgSig()); + if (functionIsPaused[_msgSigPausableSelective()]) { + revert FunctionIsPaused(_msgSigPausableSelective()); } _; - functionIsPaused[_msgSig()] = _pauseAfterCall; + functionIsPaused[_msgSigPausableSelective()] = _pauseAfterCall; } /** @@ -52,7 +52,11 @@ abstract contract SelectivePausable { bool _isPaused ) internal virtual { functionIsPaused[_functionSelector] = _isPaused; - emit FunctionIsPausedUpdate(_msgSender(), _functionSelector, _isPaused); + emit FunctionIsPausedUpdate( + _msgSenderPausableSelective(), + _functionSelector, + _isPaused + ); } /** @@ -69,7 +73,7 @@ abstract contract SelectivePausable { for (uint256 i = 0; i < _selectors.length; i++) { functionIsPaused[_selectors[i]] = _isPaused[i]; emit FunctionIsPausedUpdate( - _msgSender(), + _msgSenderPausableSelective(), _selectors[i], _isPaused[i] ); @@ -79,14 +83,19 @@ abstract contract SelectivePausable { /** * @dev Replaces need to import OpenZeppelin's Context.sol. Returns the msg.sender. */ - function _msgSender() internal view virtual returns (address) { + function _msgSenderPausableSelective() + internal + view + virtual + returns (address) + { return msg.sender; } /** * @dev Returns the msg.sig (function selector). */ - function _msgSig() internal view virtual returns (bytes4) { + function _msgSigPausableSelective() internal view virtual returns (bytes4) { return msg.sig; } }