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

Make sure ether is not sent in ERC20 token bridge #44

Merged
merged 2 commits into from
Oct 9, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ contract L1OrbitCustomGateway is L1CustomGateway {
uint256 _gasPriceBid,
uint256 _maxSubmissionCost,
uint256 _feeAmount
) external payable onlyOwner returns (uint256) {
) external onlyOwner returns (uint256) {
return
_forceRegisterTokenToL2(
_l1Addresses,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ contract L1OrbitERC20Gateway is L1ERC20Gateway {
uint256 _gasPriceBid,
bytes calldata _data
) public payable override returns (bytes memory res) {
// fees are paid in native token, so there is no use for ether
require(msg.value == 0, "NO_VALUE");
gzeoneth marked this conversation as resolved.
Show resolved Hide resolved

// We don't allow bridging of native token to avoid having multiple representations of it
// on child chain. Native token can be bridged directly through inbox using depositERC20().
require(_l1Token != _getNativeFeeToken(), "NOT_ALLOWED_TO_BRIDGE_FEE_TOKEN");
Expand Down
6 changes: 3 additions & 3 deletions test-foundry/L1ArbitrumExtendedGateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ abstract contract L1ArbitrumExtendedGatewayTest is Test {

vm.prank(router);
vm.expectRevert("EXTRA_DATA_DISABLED");
l1Gateway.outboundTransferCustomRefund{ value: 1 ether }(
l1Gateway.outboundTransferCustomRefund(
address(token),
user,
user,
Expand All @@ -162,7 +162,7 @@ abstract contract L1ArbitrumExtendedGatewayTest is Test {

vm.prank(router);
vm.expectRevert("L1_NOT_CONTRACT");
l1Gateway.outboundTransferCustomRefund{ value: 1 ether }(
l1Gateway.outboundTransferCustomRefund(
address(invalidTokenAddress),
user,
user,
Expand All @@ -175,7 +175,7 @@ abstract contract L1ArbitrumExtendedGatewayTest is Test {

function test_outboundTransferCustomRefund_revert_NotFromRouter() public {
vm.expectRevert("NOT_FROM_ROUTER");
l1Gateway.outboundTransferCustomRefund{ value: 1 ether }(
l1Gateway.outboundTransferCustomRefund(
address(token),
user,
user,
Expand Down
2 changes: 1 addition & 1 deletion test-foundry/L1ERC20Gateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ contract L1ERC20GatewayTest is L1ArbitrumExtendedGatewayTest {

vm.prank(router);
vm.expectRevert("ERC20: insufficient allowance");
l1Gateway.outboundTransferCustomRefund{ value: 1 ether }(
l1Gateway.outboundTransferCustomRefund(
address(token),
user,
user,
Expand Down
Loading