Skip to content

Commit

Permalink
remove unused imports across all tests and address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tsnewnami committed Nov 14, 2023
1 parent 941d911 commit 77cb9b3
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 73 deletions.
6 changes: 3 additions & 3 deletions src/interfaces/child/IChildERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ interface IChildERC20BridgeEvents {
);
/// @notice Emitted when a child chain native IMX token withdrawal is initiated.
event ChildChainNativeIMXWithdraw(
address indexed rootToken, address depositor, address indexed receiver, uint256 amount
address indexed rootToken, address indexed depositor, address indexed receiver, uint256 amount
);
/// @notice Emitted when a child chain wrapped IMX withdrawal is initiated.
event ChildChainWrappedIMXWithdraw(
address indexed rootToken, address depositor, address indexed receiver, uint256 amount
address indexed rootToken, address indexed depositor, address indexed receiver, uint256 amount
);
/// @notice Emitted when a root chain ERC20 deposit is completed on the child chain.
event ChildChainERC20Deposit(
Expand All @@ -99,7 +99,7 @@ interface IChildERC20BridgeEvents {
uint256 amount
);
/// @notice Emitted when a root chain IMX deposit is completed on the child chain.
event IMXDeposit(address indexed rootToken, address depositor, address indexed receiver, uint256 amount);
event IMXDeposit(address indexed rootToken, address indexed depositor, address indexed receiver, uint256 amount);
/// @notice Emitted when a root chain ETH deposit is completed on the child chain.
event NativeEthDeposit(
address indexed rootToken,
Expand Down
3 changes: 1 addition & 2 deletions test/integration/child/ChildAxelarBridge.t.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {ChildAxelarBridgeAdaptor} from "../../../src/child/ChildAxelarBridgeAdaptor.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20, ChildERC20} from "../../../src/child/ChildERC20.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Test} from "forge-std/Test.sol";
import {MockAxelarGateway} from "../../../../src/test/root/MockAxelarGateway.sol";
import {MockAxelarGasService} from "../../../../src/test/root/MockAxelarGasService.sol";
import {ChildERC20Bridge, IChildERC20BridgeEvents} from "../../../../src/child/ChildERC20Bridge.sol";
Expand All @@ -14,7 +11,6 @@ import {
IChildAxelarBridgeAdaptorErrors
} from "../../../../src/child/ChildAxelarBridgeAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
import {WETH} from "../../../../src/test/root/WETH.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";

contract ChildERC20BridgeWithdrawIntegrationTest is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {MockAxelarGateway} from "../../../../src/test/root/MockAxelarGateway.sol";
import {MockAxelarGasService} from "../../../../src/test/root/MockAxelarGasService.sol";
Expand All @@ -14,7 +12,6 @@ import {
IChildAxelarBridgeAdaptorErrors
} from "../../../../src/child/ChildAxelarBridgeAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
import {WETH} from "../../../../src/test/root/WETH.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";

contract ChildERC20BridgeWithdrawIMXIntegrationTest is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Test} from "forge-std/Test.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {MockAxelarGateway} from "../../../../src/test/root/MockAxelarGateway.sol";
Expand All @@ -14,7 +13,6 @@ import {
IChildAxelarBridgeAdaptorErrors
} from "../../../../src/child/ChildAxelarBridgeAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
import {WETH} from "../../../../src/test/root/WETH.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";

contract ChildERC20BridgewithdrawIMXToIntegrationTest is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Test} from "forge-std/Test.sol";
import {MockAxelarGateway} from "../../../../src/test/root/MockAxelarGateway.sol";
import {MockAxelarGasService} from "../../../../src/test/root/MockAxelarGasService.sol";
import {ChildERC20Bridge, IChildERC20BridgeEvents} from "../../../../src/child/ChildERC20Bridge.sol";
Expand All @@ -14,7 +11,6 @@ import {
IChildAxelarBridgeAdaptorErrors
} from "../../../../src/child/ChildAxelarBridgeAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
import {WETH} from "../../../../src/test/root/WETH.sol";
import {WIMX} from "../../../../src/child/WIMX.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
Expand All @@ -26,25 +22,22 @@ contract ChildERC20BridgeWithdrawWIMXIntegrationTest is
IChildAxelarBridgeAdaptorErrors,
Utils
{
// TODO: consider moving this to a setup function
address constant CHILD_BRIDGE = address(3);
address constant CHILD_BRIDGE_ADAPTOR = address(4);
string constant CHILD_CHAIN_NAME = "test";
address constant ROOT_IMX_TOKEN = address(555555);
address constant NATIVE_ETH = address(0xeee);
address constant WRAPPED_ETH = address(0xddd);
address constant WRAPPED_IMX = address(0xabc);

ChildERC20Bridge public childBridge;
ChildAxelarBridgeAdaptor public axelarAdaptor;
address public rootToken;
address public rootImxToken;
ChildERC20 public childTokenTemplate;
MockAxelarGasService public axelarGasService;
MockAxelarGasService public mockAxelarGasService;
MockAxelarGateway public mockAxelarGateway;
WIMX public wIMXToken;

function setUp() public {
(childBridge, axelarAdaptor, rootToken, rootImxToken, childTokenTemplate, axelarGasService, mockAxelarGateway) =
(childBridge, axelarAdaptor, , , , mockAxelarGasService, mockAxelarGateway) =
childIntegrationSetup();
wIMXToken = WIMX(payable(WRAPPED_IMX));
Address.sendValue(payable(wIMXToken), 100 ether);
Expand Down Expand Up @@ -96,10 +89,10 @@ contract ChildERC20BridgeWithdrawWIMXIntegrationTest is
abi.encode(WITHDRAW_SIG, ROOT_IMX_TOKEN, address(this), address(this), withdrawAmount);

vm.expectCall(
address(axelarGasService),
address(mockAxelarGasService),
withdrawFee,
abi.encodeWithSelector(
axelarGasService.payNativeGasForContractCall.selector,
mockAxelarGasService.payNativeGasForContractCall.selector,
address(axelarAdaptor),
childBridge.rootChain(),
childBridge.rootERC20BridgeAdaptor(),
Expand Down Expand Up @@ -131,14 +124,14 @@ contract ChildERC20BridgeWithdrawWIMXIntegrationTest is

uint256 preBal = address(this).balance;
uint256 preTokenBal = wIMXToken.balanceOf(address(this));
uint256 preGasBal = address(axelarGasService).balance;
uint256 preGasBal = address(mockAxelarGasService).balance;

wIMXToken.approve(address(childBridge), withdrawAmount);
childBridge.withdrawWIMX{value: withdrawFee}(withdrawAmount);

uint256 postBal = address(this).balance;
uint256 postTokenBal = wIMXToken.balanceOf(address(this));
uint256 postGasBal = address(axelarGasService).balance;
uint256 postGasBal = address(mockAxelarGasService).balance;

assertEq(postBal, preBal - withdrawFee, "Balance not reduced");
assertEq(postTokenBal, preTokenBal - withdrawAmount);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
Expand All @@ -27,11 +27,7 @@ contract ChildERC20BridgeWithdrawWIMXToIntegrationTest is
Utils
{
address constant CHILD_BRIDGE = address(3);
address constant CHILD_BRIDGE_ADAPTOR = address(4);
string constant CHILD_CHAIN_NAME = "test";
address constant ROOT_IMX_TOKEN = address(555555);
address constant NATIVE_ETH = address(0xeee);
address constant WRAPPED_ETH = address(0xddd);
address constant WRAPPED_IMX = address(0xabc);

ChildERC20Bridge public childBridge;
Expand Down Expand Up @@ -105,7 +101,7 @@ contract ChildERC20BridgeWithdrawWIMXToIntegrationTest is
}

function test_WithdrawWIMXToWithDifferentAccount_CallsAxelarGateway() public {
address receiver = address(0xabcd);
address receiver = address(0xabcde);
uint256 withdrawFee = 300;
uint256 withdrawAmount = 7 ether;

Expand Down Expand Up @@ -151,7 +147,7 @@ contract ChildERC20BridgeWithdrawWIMXToIntegrationTest is
}

function test_WithdrawWIMXToWithDifferentAccount_CallsGasService() public {
address receiver = address(0xabcd);
address receiver = address(0xabcdf);
uint256 withdrawFee = 300;
uint256 withdrawAmount = 7 ether;

Expand Down Expand Up @@ -190,7 +186,7 @@ contract ChildERC20BridgeWithdrawWIMXToIntegrationTest is
}

function test_WithdrawWIMXToWithDifferentAccount_EmitsAxelarMessageSentEvent() public {
address receiver = address(0xabcd);
address receiver = address(0xabcda);
uint256 withdrawFee = 300;
uint256 withdrawAmount = 7 ether;

Expand Down
3 changes: 1 addition & 2 deletions test/unit/child/ChildAxelarBridgeAdaptor.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {ChildAxelarBridgeAdaptor} from "../../../src/child/ChildAxelarBridgeAdaptor.sol";
Expand Down
5 changes: 1 addition & 4 deletions test/unit/child/ChildERC20Bridge.t.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../src/child/ChildERC20.sol";
import {Utils} from "../../utils.t.sol";

Expand Down
8 changes: 2 additions & 6 deletions test/unit/child/withdrawals/ChildERC20BridgeWithdraw.t.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {IChildERC20, ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
Expand Down
8 changes: 2 additions & 6 deletions test/unit/child/withdrawals/ChildERC20BridgeWithdrawTo.t.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {IChildERC20,ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.19;

import {Test, console2} from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {
ChildERC20Bridge,
IChildERC20Bridge,
IChildERC20BridgeEvents,
IERC20Metadata,
IChildERC20BridgeErrors
IChildERC20BridgeErrors
} from "../../../../src/child/ChildERC20Bridge.sol";
import {IChildERC20} from "../../../../src/interfaces/child/IChildERC20.sol";
import {ChildERC20} from "../../../../src/child/ChildERC20.sol";
import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol";
import {Utils} from "../../../utils.t.sol";
Expand Down

0 comments on commit 77cb9b3

Please sign in to comment.