Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: superformfactory and superregistry #438

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions test/unit/super-registry/SuperRegistry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down