From 6d6238e87c6a4d4a1f2480807746af070a0509a0 Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:49:06 -0500 Subject: [PATCH 1/3] chore: factory coverage --- .../superform-factory.createSuperforms.t.sol | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/unit/superform-factory/superform-factory.createSuperforms.t.sol b/test/unit/superform-factory/superform-factory.createSuperforms.t.sol index 133e723e1..a5aed5da6 100644 --- a/test/unit/superform-factory/superform-factory.createSuperforms.t.sol +++ b/test/unit/superform-factory/superform-factory.createSuperforms.t.sol @@ -197,6 +197,28 @@ contract SuperformFactoryCreateSuperformTest is BaseSetup { SuperformFactory(getContract(chainId, "SuperformFactory")).getSuperform(superformId); } + function test_getAllSuperformsFromVault() public { + vm.startPrank(deployer); + vm.selectFork(FORKS[chainId]); + address superRegistry = getContract(chainId, "SuperRegistry"); + /// @dev Deploying Forms + address formImplementation = address(new ERC4626Form(superRegistry)); + address formImplementation2 = address(new ERC4626Form(superRegistry)); + + // Deploying Forms Using AddImplementation. Not Testing Reverts As Already Tested + SuperformFactory(getContract(chainId, "SuperformFactory")).addFormImplementation( + formImplementation, 420, 1 + ); + + SuperformFactory(getContract(chainId, "SuperformFactory")).addFormImplementation( + formImplementation2, 69, 1 + ); + + SuperformFactory(getContract(chainId, "SuperformFactory")).createSuperform(420, vault); + SuperformFactory(getContract(chainId, "SuperformFactory")).createSuperform(69, vault); + SuperformFactory(getContract(chainId, "SuperformFactory")).getAllSuperformsFromVault(vault); + } + function test_initializeWithZeroAddressAsset() public { vm.selectFork(FORKS[chainId]); address zeroAssetVault = address(new ZeroAssetVault()); From 0a08831a953eab74929115786b4d891daa5d0da6 Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:55:26 -0500 Subject: [PATCH 2/3] chore: superregistry --- test/unit/super-registry/SuperRegistry.t.sol | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unit/super-registry/SuperRegistry.t.sol b/test/unit/super-registry/SuperRegistry.t.sol index 218b9c9b8..a11806e30 100644 --- a/test/unit/super-registry/SuperRegistry.t.sol +++ b/test/unit/super-registry/SuperRegistry.t.sol @@ -346,7 +346,7 @@ contract SuperRegistryTest is BaseSetup { superRegistry.setRequiredMessagingQuorum(OP, 5); } - function test_set_delay() public { + function test_setDelay() public { vm.prank(deployer); vm.expectRevert(Error.INVALID_TIMELOCK_DELAY.selector); superRegistry.setDelay(5 minutes); @@ -359,6 +359,12 @@ contract SuperRegistryTest is BaseSetup { superRegistry.setDelay(11 hours); } + function test_setQuorum_invalid_chainId() public { + vm.prank(deployer); + vm.expectRevert(Error.INVALID_CHAIN_ID.selector); + superRegistry.setRequiredMessagingQuorum(0,2); + } + function test_getAmbId() public { uint256 ambId_ = superRegistry.getAmbId(getContract(ETH, "LayerzeroImplementation")); assertEq(ambId_, 1); From fcf1533b47f510d564739c248ca8ff49260bc5b8 Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:02:02 -0500 Subject: [PATCH 3/3] chore: fix test merge --- test/unit/super-registry/SuperRegistry.t.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unit/super-registry/SuperRegistry.t.sol b/test/unit/super-registry/SuperRegistry.t.sol index a11806e30..e626606e0 100644 --- a/test/unit/super-registry/SuperRegistry.t.sol +++ b/test/unit/super-registry/SuperRegistry.t.sol @@ -143,13 +143,13 @@ contract SuperRegistryTest is BaseSetup { address[] memory bridgeAddress = new address[](3); address[] memory bridgeValidator = new address[](3); - bridgeId[0] = 8; + bridgeId[0] = 20; bridgeAddress[0] = address(0x1); bridgeValidator[0] = address(0x2); - bridgeId[1] = 6; + bridgeId[1] = 30; bridgeAddress[1] = address(0x3); bridgeValidator[1] = address(0x4); - bridgeId[2] = 7; + bridgeId[2] = 40; bridgeAddress[2] = address(0x5); bridgeValidator[2] = address(0x6); @@ -161,8 +161,8 @@ contract SuperRegistryTest is BaseSetup { superRegistry.setBridgeAddresses(bridgeId, bridgeAddress, bridgeValidator); vm.prank(deployer); - assertEq(superRegistry.getBridgeAddress(6), address(0x3)); - assertEq(superRegistry.getBridgeValidator(7), address(0x6)); + assertEq(superRegistry.getBridgeAddress(30), address(0x3)); + assertEq(superRegistry.getBridgeValidator(40), address(0x6)); vm.expectRevert(Error.NOT_PROTOCOL_ADMIN.selector); vm.prank(bond);