Skip to content

Commit

Permalink
fix: emit DepositWrappedToken event (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweichi authored Aug 13, 2024
1 parent 61ebdd1 commit 4d2b3c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker/templates/bridge-history-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000",
"GasTokenGatewayAddr": null
"GasTokenGatewayAddr": null,
"WrappedTokenGatewayAddr": null
},
"L2": {
"confirmation": 0,
Expand Down
1 change: 1 addition & 0 deletions scripts/deterministic/GenerateConfigs.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
12 changes: 12 additions & 0 deletions src/alternative-gas-token/L1WrappedTokenGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
*********/
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4d2b3c6

Please sign in to comment.