diff --git a/src/contracts/utils/ChainHelpers.sol b/src/contracts/utils/ChainHelpers.sol index b940944..de39a2c 100644 --- a/src/contracts/utils/ChainHelpers.sol +++ b/src/contracts/utils/ChainHelpers.sol @@ -21,6 +21,7 @@ library ChainIds { uint256 internal constant HARMONY = 1666600000; uint256 internal constant CELO = 42220; uint256 internal constant POLYGON_ZK_EVM = 1101; + uint256 internal constant LINEA = 59144; } library TestNetChainIds { @@ -38,6 +39,7 @@ library TestNetChainIds { uint256 internal constant OPTIMISM_SEPOLIA = 11155420; uint256 internal constant ARBITRUM_SEPOLIA = 421614; uint256 internal constant ZKSYNC_SEPOLIA = 300; + uint256 internal constant LINEA_SEPOLIA = 59141; } library ChainHelpers { @@ -79,6 +81,8 @@ library ChainHelpers { newFork = vm.createSelectFork(vm.rpcUrl('harmony')); } else if (chainId == ChainIds.ZKSYNC) { newFork = vm.createSelectFork(vm.rpcUrl('zksync')); + } else if (chainId == ChainIds.LINEA) { + newFork = vm.createSelectFork(vm.rpcUrl('linea')); } else { revert UnknownChainId(); } @@ -113,6 +117,8 @@ library ChainHelpers { networkName = 'celo'; } else if (chainId == ChainIds.ZKSYNC) { networkName = 'zksync'; + } else if (chainId == ChainIds.LINEA) { + networkName = 'linea'; } // testnets else if (chainId == TestNetChainIds.ETHEREUM_SEPOLIA) { @@ -139,6 +145,8 @@ library ChainHelpers { networkName = 'celo_alfajores'; } else if (chainId == TestNetChainIds.ZKSYNC_SEPOLIA) { networkName = 'zksync_sepolia'; + } else if (chainId == TestNetChainIds.LINEA_SEPOLIA) { + networkName = 'linea_sepolia'; } else { revert('chain id is not supported'); } diff --git a/src/contracts/utils/ScriptUtils.sol b/src/contracts/utils/ScriptUtils.sol index 71dcf02..e9f00b6 100644 --- a/src/contracts/utils/ScriptUtils.sol +++ b/src/contracts/utils/ScriptUtils.sol @@ -75,6 +75,10 @@ abstract contract ZkSyncScript is WithChainIdValidation { constructor() WithChainIdValidation(ChainIds.ZKSYNC) {} } +abstract contract LineaScript is WithChainIdValidation { + constructor() WithChainIdValidation(ChainIds.LINEA) {} +} + abstract contract SepoliaScript is WithChainIdValidation { constructor() WithChainIdValidation(ChainIds.SEPOLIA) {} } @@ -127,22 +131,20 @@ library Create2Utils { return (_addr.code.length > 0); } - function computeCreate2Address(bytes32 salt, bytes32 initcodeHash) - internal - pure - returns (address) - { + function computeCreate2Address( + bytes32 salt, + bytes32 initcodeHash + ) internal pure returns (address) { return addressFromLast20Bytes( keccak256(abi.encodePacked(bytes1(0xff), CREATE2_FACTORY, salt, initcodeHash)) ); } - function computeCreate2Address(bytes32 salt, bytes memory bytecode) - internal - pure - returns (address) - { + function computeCreate2Address( + bytes32 salt, + bytes memory bytecode + ) internal pure returns (address) { return computeCreate2Address(salt, keccak256(abi.encodePacked(bytecode))); }