diff --git a/contracts/access/manager/AccessManager.sol b/contracts/access/manager/AccessManager.sol index 418e6ebe4..d80e8e358 100644 --- a/contracts/access/manager/AccessManager.sol +++ b/contracts/access/manager/AccessManager.sol @@ -372,7 +372,7 @@ contract AccessManager is Context, Multicall, IAccessManager { _groups[groupId].members[account] = Access({since: since, delay: executionDelay.toDelay()}); } - emit GroupGranted(groupId, account, executionDelay, since); + emit GroupGranted(groupId, account, executionDelay, since, !inGroup); return !inGroup; } diff --git a/contracts/access/manager/IAccessManager.sol b/contracts/access/manager/IAccessManager.sol index e819f804e..17b9e1aff 100644 --- a/contracts/access/manager/IAccessManager.sol +++ b/contracts/access/manager/IAccessManager.sol @@ -29,7 +29,7 @@ interface IAccessManager { event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce); event GroupLabel(uint64 indexed groupId, string label); - event GroupGranted(uint64 indexed groupId, address indexed account, uint32 delay, uint48 since); + event GroupGranted(uint64 indexed groupId, address indexed account, uint32 delay, uint48 since, bool newMember); event GroupRevoked(uint64 indexed groupId, address indexed account); event GroupAdminChanged(uint64 indexed groupId, uint64 indexed admin); event GroupGuardianChanged(uint64 indexed groupId, uint64 indexed guardian); diff --git a/test/access/manager/AccessManager.test.js b/test/access/manager/AccessManager.test.js index 4ff97cd29..697f871ea 100644 --- a/test/access/manager/AccessManager.test.js +++ b/test/access/manager/AccessManager.test.js @@ -106,7 +106,13 @@ contract('AccessManager', function (accounts) { const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager }); const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN); - expectEvent(receipt, 'GroupGranted', { groupId: GROUPS.SOME, account: user, since: timestamp, delay: '0' }); + expectEvent(receipt, 'GroupGranted', { + groupId: GROUPS.SOME, + account: user, + since: timestamp, + delay: '0', + newMember: true, + }); expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([true, '0']); @@ -127,6 +133,7 @@ contract('AccessManager', function (accounts) { account: user, since: timestamp, delay: executeDelay, + newMember: true, }); expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([ @@ -169,7 +176,7 @@ contract('AccessManager', function (accounts) { await time.increase(MINSETBACK); }); - it('granted group is not active immediatly', async function () { + it('granted group is not active immediately', async function () { const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager }); const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN); expectEvent(receipt, 'GroupGranted', { @@ -177,6 +184,7 @@ contract('AccessManager', function (accounts) { account: user, since: timestamp.add(grantDelay), delay: '0', + newMember: true, }); expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([false, '0']); @@ -196,6 +204,7 @@ contract('AccessManager', function (accounts) { account: user, since: timestamp.add(grantDelay), delay: '0', + newMember: true, }); await time.increase(grantDelay); @@ -374,6 +383,7 @@ contract('AccessManager', function (accounts) { account: member, since: timestamp, delay: newDelay, + newMember: false, }); // immediate effect @@ -406,6 +416,7 @@ contract('AccessManager', function (accounts) { account: member, since: timestamp.add(setback), delay: newDelay, + newMember: false, }); // no immediate effect @@ -435,6 +446,7 @@ contract('AccessManager', function (accounts) { account: other, since: timestamp, delay: executeDelay, + newMember: false, }); }); });