Skip to content

Commit

Permalink
got rid of override clash with context
Browse files Browse the repository at this point in the history
  • Loading branch information
uintgroup committed Aug 10, 2023
1 parent 4e1ff6a commit 8dde866
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -29,4 +29,4 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
}
23 changes: 16 additions & 7 deletions src/SelectivePausable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -52,7 +52,11 @@ abstract contract SelectivePausable {
bool _isPaused
) internal virtual {
functionIsPaused[_functionSelector] = _isPaused;
emit FunctionIsPausedUpdate(_msgSender(), _functionSelector, _isPaused);
emit FunctionIsPausedUpdate(
_msgSenderPausableSelective(),
_functionSelector,
_isPaused
);
}

/**
Expand All @@ -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]
);
Expand All @@ -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;
}
}

0 comments on commit 8dde866

Please sign in to comment.