Skip to content

Commit 798a563

Browse files
committed
contracts/test: assert event SentMessageExtension1
1 parent b6d603f commit 798a563

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

contracts/test/L2StandardBridgeBot.t.sol

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ contract L2StandardBridgeBotTest is Test {
1313
address user = 0x3977f9B1F4912a783B44aBa813dA388AC73a1428;
1414
uint withdrawFee = 10000;
1515
address constant LEGACY_ERC20_ETH = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;
16+
address constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
1617

1718
event WithdrawTo(address indexed from, address l2Token, address to, uint256 amount, uint32 minGasLimit, bytes extraData);
1819

20+
event SentMessageExtension1(address indexed sender , uint256 value);
21+
1922
function setUp() public {
2023
opbnbMainnetFork = vm.createFork("https://opbnb-testnet-rpc.bnbchain.org");
2124
vm.selectFork(opbnbMainnetFork);
@@ -83,14 +86,18 @@ contract L2StandardBridgeBotTest is Test {
8386

8487
vm.prank(user);
8588
uint amount = 0;
86-
bot.withdrawTo{value: withdrawFee + amount}(LEGACY_ERC20_ETH, user, amount, 200000, "");
87-
bot.withdrawTo{value: withdrawFee + amount}(LEGACY_ERC20_ETH, user, amount, 200000, "");
89+
uint round = 10;
90+
for (uint i = 0; i < round; i++) {
91+
bot.withdrawTo{value: withdrawFee + amount}(LEGACY_ERC20_ETH, user, amount, 200000, "");
92+
}
8893

8994
uint256 postBalance = address(bot).balance;
90-
assertEq(postBalance, prevBalance + withdrawFee * 2);
95+
assertEq(postBalance, prevBalance + withdrawFee * round);
9196

9297
// WithdrawFeeToL1
9398
vm.prank(deployer);
99+
vm.expectEmit(true, true, true, true);
100+
emit SentMessageExtension1(L2_STANDARD_BRIDGE, postBalance - withdrawFee);
94101
bot.withdrawFeeToL1(user, 0, "");
95102
}
96103
}

0 commit comments

Comments
 (0)