From a60707dd1593a2c3531fc4b9cc0ab76ea7e21356 Mon Sep 17 00:00:00 2001 From: ernestognw Date: Wed, 2 Aug 2023 00:20:45 -0600 Subject: [PATCH] Fix N-17 --- contracts/proxy/beacon/UpgradeableBeacon.sol | 2 +- test/proxy/beacon/UpgradeableBeacon.test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contracts/proxy/beacon/UpgradeableBeacon.sol b/contracts/proxy/beacon/UpgradeableBeacon.sol index 81ce5090218..a7816a1e6d0 100644 --- a/contracts/proxy/beacon/UpgradeableBeacon.sol +++ b/contracts/proxy/beacon/UpgradeableBeacon.sol @@ -51,7 +51,6 @@ contract UpgradeableBeacon is IBeacon, Ownable { */ function upgradeTo(address newImplementation) public virtual onlyOwner { _setImplementation(newImplementation); - emit Upgraded(newImplementation); } /** @@ -66,5 +65,6 @@ contract UpgradeableBeacon is IBeacon, Ownable { revert BeaconInvalidImplementation(newImplementation); } _implementation = newImplementation; + emit Upgraded(newImplementation); } } diff --git a/test/proxy/beacon/UpgradeableBeacon.test.js b/test/proxy/beacon/UpgradeableBeacon.test.js index 4c58f1740b6..0737f6fdfe6 100644 --- a/test/proxy/beacon/UpgradeableBeacon.test.js +++ b/test/proxy/beacon/UpgradeableBeacon.test.js @@ -20,6 +20,13 @@ contract('UpgradeableBeacon', function (accounts) { this.beacon = await UpgradeableBeacon.new(this.v1.address, owner); }); + it('emits Upgraded event to the first implementation', async function () { + const beacon = await UpgradeableBeacon.new(this.v1.address, owner); + await expectEvent.inTransaction(beacon.contract.transactionHash, beacon, 'Upgraded', { + implementation: this.v1.address, + }); + }); + it('returns implementation', async function () { expect(await this.beacon.implementation()).to.equal(this.v1.address); });