Skip to content

Commit 4aad0dd

Browse files
committed
fix: remove not used beacon address from storage
1 parent 1e0c267 commit 4aad0dd

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

contracts/tokenbridge/libraries/vault/MasterVaultFactory.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ contract MasterVaultFactory is IMasterVaultFactory, OwnableUpgradeable {
1515
error ZeroAddress();
1616
error BeaconNotDeployed();
1717

18-
UpgradeableBeacon public beacon;
1918
BeaconProxyFactory public beaconProxyFactory;
2019

2120
function initialize(address _owner) public initializer {
2221
_transferOwnership(_owner);
2322

2423
MasterVault masterVaultImplementation = new MasterVault();
25-
beacon = new UpgradeableBeacon(address(masterVaultImplementation));
24+
UpgradeableBeacon beacon = new UpgradeableBeacon(address(masterVaultImplementation));
2625
beaconProxyFactory = new BeaconProxyFactory();
2726
beaconProxyFactory.initialize(address(beacon));
2827
beacon.transferOwnership(_owner);

test-foundry/libraries/vault/MasterVaultFactory.t.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,23 @@ contract MasterVaultFactoryTest is Test {
7272
}
7373

7474
function test_beaconOwnership() public {
75-
assertEq(factory.beacon().owner(), owner, "Beacon owner should be the factory owner");
75+
assertEq(UpgradeableBeacon(factory.beaconProxyFactory().beacon()).owner(), owner, "Beacon owner should be the factory owner");
7676
}
7777

7878
function test_ownerCanUpgradeBeacon() public {
7979
MasterVault newImplementation = new MasterVault();
8080

81-
UpgradeableBeacon beacon = factory.beacon();
81+
UpgradeableBeacon beacon = UpgradeableBeacon(factory.beaconProxyFactory().beacon());
8282
vm.prank(owner);
8383
beacon.upgradeTo(address(newImplementation));
8484

85-
assertEq(factory.beacon().implementation(), address(newImplementation), "Beacon implementation should be updated");
85+
assertEq(UpgradeableBeacon(factory.beaconProxyFactory().beacon()).implementation(), address(newImplementation), "Beacon implementation should be updated");
8686
}
8787

8888
function test_nonOwnerCannotUpgradeBeacon() public {
8989
MasterVault newImplementation = new MasterVault();
9090

91-
UpgradeableBeacon beacon = factory.beacon();
91+
UpgradeableBeacon beacon = UpgradeableBeacon(factory.beaconProxyFactory().beacon());
9292
vm.prank(user);
9393
vm.expectRevert("Ownable: caller is not the owner");
9494
beacon.upgradeTo(address(newImplementation));
@@ -102,11 +102,11 @@ contract MasterVaultFactoryTest is Test {
102102

103103
MasterVault newImplementation = new MasterVault();
104104

105-
UpgradeableBeacon beacon = factory.beacon();
105+
UpgradeableBeacon beacon = UpgradeableBeacon(factory.beaconProxyFactory().beacon());
106106
vm.prank(owner);
107107
beacon.upgradeTo(address(newImplementation));
108108

109-
assertEq(factory.beacon().implementation(), address(newImplementation), "Beacon should point to new implementation");
109+
assertEq(UpgradeableBeacon(factory.beaconProxyFactory().beacon()).implementation(), address(newImplementation), "Beacon should point to new implementation");
110110

111111
MasterVault(vault1).owner();
112112
MasterVault(vault2).owner();

0 commit comments

Comments
 (0)