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

fix: emit DepositWrappedToken event #23

Merged
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
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
Loading