Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Aug 9, 2024
1 parent 15b10b6 commit 9b35fcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion v2/src/zevm/GatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ contract GatewayZEVM is
emit Withdrawal(
msg.sender,
chainId,
abi.encodePacked(FUNGIBLE_MODULE_ADDRESS),
receiver,
address(zetaToken),
amount,
0,
Expand Down
16 changes: 8 additions & 8 deletions v2/test/GatewayZEVM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors

vm.expectEmit(true, true, true, true, address(gateway));
emit Withdrawal(
owner, chainId, abi.encodePacked(fungibleModule), address(zetaToken), amount, 0, 0, "", revertOptions
owner, chainId, abi.encodePacked(addr1), address(zetaToken), amount, 0, 0, "", revertOptions
);
gateway.withdraw(amount, chainId, revertOptions);
gateway.withdraw(abi.encodePacked(addr1), amount, chainId, revertOptions);

uint256 ownerBalanceAfter = zetaToken.balanceOf(owner);
assertEq(ownerBalanceBefore - 1, ownerBalanceAfter);
Expand All @@ -238,7 +238,7 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
zetaToken.approve(address(gateway), 0);

vm.expectRevert();
gateway.withdraw(abi.encodePacked(addr1), amount, chainId);
gateway.withdraw(abi.encodePacked(addr1), amount, chainId, revertOptions);

// Verify balances not changed
uint256 ownerBalanceAfter = zetaToken.balanceOf(owner);
Expand All @@ -257,7 +257,7 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
uint256 chainId = 1;

vm.expectRevert();
gateway.withdraw(abi.encodePacked(addr1), amount, chainId);
gateway.withdraw(abi.encodePacked(addr1), amount, chainId, revertOptions);
}

function testWithdrawZETAWithMessage() public {
Expand All @@ -269,8 +269,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
uint256 chainId = 1;

vm.expectEmit(true, true, true, true, address(gateway));
emit Withdrawal(owner, chainId, abi.encodePacked(addr1), address(zetaToken), amount, 0, 0, message);
gateway.withdrawAndCall(abi.encodePacked(addr1), amount, chainId, message);
emit Withdrawal(owner, chainId, abi.encodePacked(addr1), address(zetaToken), amount, 0, 0, message, revertOptions);
gateway.withdrawAndCall(abi.encodePacked(addr1), amount, chainId, message, revertOptions);

uint256 ownerBalanceAfter = zetaToken.balanceOf(owner);
assertEq(ownerBalanceBefore - 1, ownerBalanceAfter);
Expand All @@ -295,7 +295,7 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
zetaToken.approve(address(gateway), 0);

vm.expectRevert();
gateway.withdrawAndCall(abi.encodePacked(addr1), amount, chainId, message);
gateway.withdrawAndCall(abi.encodePacked(addr1), amount, chainId, message, revertOptions);

// Verify balances not changed
uint256 ownerBalanceAfter = zetaToken.balanceOf(owner);
Expand All @@ -310,7 +310,7 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
function testCallFailsIfReceiverIsZeroAddress() public {
bytes memory message = abi.encodeWithSignature("hello(address)", addr1);
vm.expectRevert(ZeroAddress.selector);
gateway.call(abi.encodePacked(""), 1, message);
gateway.call(abi.encodePacked(""), 1, message, revertOptions);
}

function testCall() public {
Expand Down

0 comments on commit 9b35fcb

Please sign in to comment.