diff --git a/contracts/src/L1/gateways/IL1GatewayRouter.sol b/contracts/src/L1/gateways/IL1GatewayRouter.sol index f6a6115275..b2d253c43a 100644 --- a/contracts/src/L1/gateways/IL1GatewayRouter.sol +++ b/contracts/src/L1/gateways/IL1GatewayRouter.sol @@ -10,11 +10,6 @@ interface IL1GatewayRouter is IL1ETHGateway, IL1ERC20Gateway { * Events * **********/ - /// @notice Emitted when the address of ETH Gateway is updated. - /// @param oldETHGateway The address of the old ETH Gateway. - /// @param newEthGateway The address of the new ETH Gateway. - event SetETHGateway(address indexed oldETHGateway, address indexed newEthGateway); - /// @notice Emitted when the address of default ERC20 Gateway is updated. /// @param oldDefaultERC20Gateway The address of the old default ERC20 Gateway. /// @param newDefaultERC20Gateway The address of the new default ERC20 Gateway. @@ -26,6 +21,13 @@ interface IL1GatewayRouter is IL1ETHGateway, IL1ERC20Gateway { /// @param newGateway The corresponding address of the new gateway. event SetERC20Gateway(address indexed token, address indexed oldGateway, address indexed newGateway); + /********** + * Errors * + **********/ + + /// @dev Thrown when the given address is `address(0)`. + error ErrorZeroAddress(); + /************************* * Public View Functions * *************************/ @@ -52,11 +54,6 @@ interface IL1GatewayRouter is IL1ETHGateway, IL1ERC20Gateway { * Restricted Functions * ************************/ - /// @notice Update the address of ETH gateway contract. - /// @dev This function should only be called by contract owner. - /// @param _ethGateway The address to update. - function setETHGateway(address _ethGateway) external; - /// @notice Update the address of default ERC20 gateway contract. /// @dev This function should only be called by contract owner. /// @param _defaultERC20Gateway The address to update. diff --git a/contracts/src/L1/gateways/L1GatewayRouter.sol b/contracts/src/L1/gateways/L1GatewayRouter.sol index f0d8cf99e8..3316c7ec87 100644 --- a/contracts/src/L1/gateways/L1GatewayRouter.sol +++ b/contracts/src/L1/gateways/L1GatewayRouter.sol @@ -19,13 +19,6 @@ import {IL1GatewayRouter} from "./IL1GatewayRouter.sol"; contract L1GatewayRouter is OwnableUpgradeable, IL1GatewayRouter { using SafeERC20Upgradeable for IERC20Upgradeable; - /********** - * Errors * - **********/ - - /// @dev Thrown when the given address is `address(0)`. - error ErrorZeroAddress(); - /************* * Constants * *************/ @@ -244,14 +237,6 @@ contract L1GatewayRouter is OwnableUpgradeable, IL1GatewayRouter { * Restricted Functions * ************************/ - /// @inheritdoc IL1GatewayRouter - function setETHGateway(address _newEthGateway) external onlyOwner { - address _oldETHGateway = ethGateway; - ethGateway = _newEthGateway; - - emit SetETHGateway(_oldETHGateway, _newEthGateway); - } - /// @inheritdoc IL1GatewayRouter function setDefaultERC20Gateway(address _newDefaultERC20Gateway) external onlyOwner { address _oldDefaultERC20Gateway = defaultERC20Gateway; diff --git a/contracts/src/L2/gateways/IL2GatewayRouter.sol b/contracts/src/L2/gateways/IL2GatewayRouter.sol index 1091989542..7e81f86dfd 100644 --- a/contracts/src/L2/gateways/IL2GatewayRouter.sol +++ b/contracts/src/L2/gateways/IL2GatewayRouter.sol @@ -10,11 +10,6 @@ interface IL2GatewayRouter is IL2ETHGateway, IL2ERC20Gateway { * Events * **********/ - /// @notice Emitted when the address of ETH Gateway is updated. - /// @param oldETHGateway The address of the old ETH Gateway. - /// @param newEthGateway The address of the new ETH Gateway. - event SetETHGateway(address indexed oldETHGateway, address indexed newEthGateway); - /// @notice Emitted when the address of default ERC20 Gateway is updated. /// @param oldDefaultERC20Gateway The address of the old default ERC20 Gateway. /// @param newDefaultERC20Gateway The address of the new default ERC20 Gateway. @@ -25,4 +20,11 @@ interface IL2GatewayRouter is IL2ETHGateway, IL2ERC20Gateway { /// @param oldGateway The corresponding address of the old gateway. /// @param newGateway The corresponding address of the new gateway. event SetERC20Gateway(address indexed token, address indexed oldGateway, address indexed newGateway); + + /********** + * Errors * + **********/ + + /// @dev Thrown when the given address is `address(0)`. + error ErrorZeroAddress(); } diff --git a/contracts/src/L2/gateways/L2GatewayRouter.sol b/contracts/src/L2/gateways/L2GatewayRouter.sol index 4a13a91c5b..1237956567 100644 --- a/contracts/src/L2/gateways/L2GatewayRouter.sol +++ b/contracts/src/L2/gateways/L2GatewayRouter.sol @@ -15,13 +15,6 @@ import {IL2ERC20Gateway} from "./IL2ERC20Gateway.sol"; /// @dev One can also use this contract to query L1/L2 token address mapping. /// In the future, ERC-721 and ERC-1155 tokens will be added to the router too. contract L2GatewayRouter is OwnableUpgradeable, IL2GatewayRouter { - /********** - * Errors * - **********/ - - /// @dev Thrown when the given address is `address(0)`. - error ErrorZeroAddress(); - /************* * Constants * *************/ @@ -55,7 +48,16 @@ contract L2GatewayRouter is OwnableUpgradeable, IL2GatewayRouter { messenger = _messenger; } - function initialize(address _ethGateway, address _defaultERC20Gateway) external initializer { + /// @notice Initialize the storage of L2GatewayRouter. + /// + /// @dev The parameters `_ethGateway` is no longer used. + /// + /// @param _defaultERC20Gateway The address of default ERC20 Gateway contract. + function initialize( + address, + /*_ethGateway*/ + address _defaultERC20Gateway + ) external initializer { OwnableUpgradeable.__Ownable_init(); // it can be zero during initialization @@ -64,11 +66,13 @@ contract L2GatewayRouter is OwnableUpgradeable, IL2GatewayRouter { emit SetDefaultERC20Gateway(address(0), _defaultERC20Gateway); } + /* comment out since it is no longer used. // it can be zero during initialization if (_ethGateway != address(0)) { ethGateway = _ethGateway; emit SetETHGateway(address(0), _ethGateway); } + */ } /************************* @@ -190,16 +194,6 @@ contract L2GatewayRouter is OwnableUpgradeable, IL2GatewayRouter { * Restricted Functions * ************************/ - /// @notice Update the address of ETH gateway contract. - /// @dev This function should only be called by contract owner. - /// @param _newEthGateway The address to update. - function setETHGateway(address _newEthGateway) external onlyOwner { - address _oldEthGateway = ethGateway; - ethGateway = _newEthGateway; - - emit SetETHGateway(_oldEthGateway, _newEthGateway); - } - /// @notice Update the address of default ERC20 gateway contract. /// @dev This function should only be called by contract owner. /// @param _newDefaultERC20Gateway The address to update. diff --git a/contracts/src/test/L2GatewayRouter.t.sol b/contracts/src/test/L2GatewayRouter.t.sol index 3bd912c8d2..8553287bec 100644 --- a/contracts/src/test/L2GatewayRouter.t.sol +++ b/contracts/src/test/L2GatewayRouter.t.sol @@ -114,7 +114,6 @@ contract L2GatewayRouterTest is L2GatewayTestBase { } function testInitialized() public { - assertEq(address(l2ETHGateway), router.ethGateway()); assertEq(address(l2StandardERC20Gateway), router.defaultERC20Gateway()); assertEq(address(l2StandardERC20Gateway), router.getERC20Gateway(address(l2Token))); @@ -181,20 +180,4 @@ contract L2GatewayRouterTest is L2GatewayTestBase { hevm.expectRevert("should never be called"); router.finalizeDepositETH(address(0), address(0), 0, ""); } - - function testSetETHGateway(address gateway) public { - // set by non-owner, should revert - hevm.startPrank(address(1)); - hevm.expectRevert("Ownable: caller is not the owner"); - router.setETHGateway(gateway); - hevm.stopPrank(); - - // set by owner, should succeed - hevm.expectEmit(true, true, false, true); - emit SetETHGateway(address(l2ETHGateway), gateway); - - assertEq(address(l2ETHGateway), router.ethGateway()); - router.setETHGateway(gateway); - assertEq(gateway, router.ethGateway()); - } }