From 5f3ecd9c64cc9051cff97e6c92452eda6cec44fa Mon Sep 17 00:00:00 2001 From: Christopher Glisch Date: Thu, 18 Oct 2018 10:26:39 -0400 Subject: [PATCH] Added address of pauser/unpauser in events (#1410) * Added address of pauser/unpauser in events * Added the account to the Pausable tests. (cherry picked from commit fcab9c89f25376227399914a6e4b8e89ee3b21d3) --- contracts/lifecycle/Pausable.sol | 8 ++++---- test/lifecycle/Pausable.test.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/lifecycle/Pausable.sol b/contracts/lifecycle/Pausable.sol index 0e7feb780..3703fed4b 100644 --- a/contracts/lifecycle/Pausable.sol +++ b/contracts/lifecycle/Pausable.sol @@ -7,8 +7,8 @@ import "../access/roles/PauserRole.sol"; * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is PauserRole { - event Paused(); - event Unpaused(); + event Paused(address account); + event Unpaused(address account); bool private _paused; @@ -44,7 +44,7 @@ contract Pausable is PauserRole { */ function pause() public onlyPauser whenNotPaused { _paused = true; - emit Paused(); + emit Paused(msg.sender); } /** @@ -52,6 +52,6 @@ contract Pausable is PauserRole { */ function unpause() public onlyPauser whenPaused { _paused = false; - emit Unpaused(); + emit Unpaused(msg.sender); } } diff --git a/test/lifecycle/Pausable.test.js b/test/lifecycle/Pausable.test.js index a7f6d637d..f279e09a7 100644 --- a/test/lifecycle/Pausable.test.js +++ b/test/lifecycle/Pausable.test.js @@ -57,7 +57,7 @@ contract('Pausable', function ([_, pauser, otherPauser, anyone, ...otherAccounts }); it('emits a Paused event', function () { - expectEvent.inLogs(this.logs, 'Paused'); + expectEvent.inLogs(this.logs, 'Paused', { account: pauser }); }); it('cannot perform normal process in pause', async function () { @@ -89,7 +89,7 @@ contract('Pausable', function ([_, pauser, otherPauser, anyone, ...otherAccounts }); it('emits an Unpaused event', function () { - expectEvent.inLogs(this.logs, 'Unpaused'); + expectEvent.inLogs(this.logs, 'Unpaused', { account: pauser }); }); it('should resume allowing normal process', async function () {