From d3a6b9365e5562aab8ee54ce8918e3e91cbdfc25 Mon Sep 17 00:00:00 2001 From: Morty Date: Tue, 13 Aug 2024 00:07:08 +0800 Subject: [PATCH] fix: emit DepositWrappedToken event --- docker/templates/bridge-history-config.json | 3 ++- scripts/deterministic/GenerateConfigs.s.sol | 1 + src/alternative-gas-token/L1WrappedTokenGateway.sol | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docker/templates/bridge-history-config.json b/docker/templates/bridge-history-config.json index 73291d8..66de7d2 100644 --- a/docker/templates/bridge-history-config.json +++ b/docker/templates/bridge-history-config.json @@ -19,7 +19,8 @@ "LIDOGatewayAddr": "0x0000000000000000000000000000000000000000", "DAIGatewayAddr": "0x0000000000000000000000000000000000000000", "PufferGatewayAddr": "0x0000000000000000000000000000000000000000", - "GasTokenGatewayAddr": null + "GasTokenGatewayAddr": null, + "WrappedTokenGatewayAddr": null }, "L2": { "confirmation": 0, diff --git a/scripts/deterministic/GenerateConfigs.s.sol b/scripts/deterministic/GenerateConfigs.s.sol index a2de2b4..80866f1 100644 --- a/scripts/deterministic/GenerateConfigs.s.sol +++ b/scripts/deterministic/GenerateConfigs.s.sol @@ -187,6 +187,7 @@ contract GenerateBridgeHistoryConfig is DeployScroll { vm.writeJson(vm.toString(L1_ERC721_GATEWAY_PROXY_ADDR), BRIDGE_HISTORY_CONFIG_PATH, ".L1.ERC721GatewayAddr"); vm.writeJson(vm.toString(L1_ERC1155_GATEWAY_PROXY_ADDR), BRIDGE_HISTORY_CONFIG_PATH, ".L1.ERC1155GatewayAddr"); vm.writeJson(vm.toString(L1_GAS_TOKEN_GATEWAY_PROXY_ADDR), BRIDGE_HISTORY_CONFIG_PATH, ".L1.GasTokenGatewayAddr"); + vm.writeJson(vm.toString(L1_WRAPPED_TOKEN_GATEWAY_ADDR), BRIDGE_HISTORY_CONFIG_PATH, ".L1.WrappedTokenGatewayAddr"); // L2 contracts vm.writeJson(vm.toString(L2_MESSAGE_QUEUE_ADDR), BRIDGE_HISTORY_CONFIG_PATH, ".L2.MessageQueueAddr"); diff --git a/src/alternative-gas-token/L1WrappedTokenGateway.sol b/src/alternative-gas-token/L1WrappedTokenGateway.sol index 21ccca9..065a00f 100644 --- a/src/alternative-gas-token/L1WrappedTokenGateway.sol +++ b/src/alternative-gas-token/L1WrappedTokenGateway.sol @@ -12,6 +12,16 @@ import {IWETH} from "../interfaces/IWETH.sol"; contract L1WrappedTokenGateway { using SafeERC20 for IERC20; + /********** + * Events * + **********/ + + /// @notice Emitted when someone wrap ETH to WETH and then deposit WETH from L1 to L2. + /// @param from The address of sender in L1. + /// @param to The address of recipient in L2. + /// @param amount The amount of ETH will be deposited from L1 to L2. + event DepositWrappedToken(address indexed from, address indexed to, uint256 amount); + /********* * Error * *********/ @@ -79,6 +89,8 @@ contract L1WrappedTokenGateway { IL1ERC20Gateway(gateway).depositERC20{value: msg.value - _amount}(WETH, _to, _amount, SAFE_GAS_LIMIT); sender = DEFAULT_SENDER; + emit DepositWrappedToken(msg.sender, _to, _amount); + // refund exceed fee uint256 balance = address(this).balance; if (balance > 0) {