Skip to content

Commit

Permalink
refactor(contracts-rfq): reorganise imports (#3409)
Browse files Browse the repository at this point in the history
* refactor: separate imports

* refactor: sort imports

* refactor: imports in test files
  • Loading branch information
ChiTimesChi authored Nov 24, 2024
1 parent 2e16814 commit b59c9d0
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-rfq/contracts/Admin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.20;

import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol";

import {UniversalTokenLib} from "./libs/UniversalToken.sol";
import {IAdmin} from "./interfaces/IAdmin.sol";
import {UniversalTokenLib} from "./libs/UniversalToken.sol";

contract Admin is IAdmin, AccessControlEnumerable {
using UniversalTokenLib for address;
Expand Down
6 changes: 5 additions & 1 deletion packages/contracts-rfq/contracts/AdminV2.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// ════════════════════════════════════════════════ INTERFACES ═════════════════════════════════════════════════════

import {IAdminV2} from "./interfaces/IAdminV2.sol";
import {IAdminV2Errors} from "./interfaces/IAdminV2Errors.sol";

// ═════════════════════════════════════════════ EXTERNAL IMPORTS ══════════════════════════════════════════════════

import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

/// @title AdminV2
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/contracts/FastBridge.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./libs/Errors.sol";
import {UniversalTokenLib} from "./libs/UniversalToken.sol";
Expand Down
11 changes: 8 additions & 3 deletions packages/contracts-rfq/contracts/FastBridgeV2.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {BridgeTransactionV2Lib} from "./libs/BridgeTransactionV2.sol";
// ════════════════════════════════════════════════ INTERFACES ═════════════════════════════════════════════════════

import {AdminV2} from "./AdminV2.sol";
import {IFastBridge} from "./interfaces/IFastBridge.sol";
import {IFastBridgeV2} from "./interfaces/IFastBridgeV2.sol";
import {IFastBridgeV2Errors} from "./interfaces/IFastBridgeV2Errors.sol";
import {IZapRecipient} from "./interfaces/IZapRecipient.sol";

// ═════════════════════════════════════════════ INTERNAL IMPORTS ══════════════════════════════════════════════════

import {AdminV2} from "./AdminV2.sol";
import {BridgeTransactionV2Lib} from "./libs/BridgeTransactionV2.sol";
import {MulticallTarget} from "./utils/MulticallTarget.sol";

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// ═════════════════════════════════════════════ EXTERNAL IMPORTS ══════════════════════════════════════════════════

import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

/// @title FastBridgeV2
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/contracts/libs/UniversalToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.20;

import {TokenNotContract} from "./Errors.sol";

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library UniversalTokenLib {
using SafeERC20 for IERC20;
Expand Down
9 changes: 8 additions & 1 deletion packages/contracts-rfq/contracts/zaps/TokenZapV1.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

// ════════════════════════════════════════════════ INTERFACES ═════════════════════════════════════════════════════

import {IZapRecipient} from "../interfaces/IZapRecipient.sol";

// ═════════════════════════════════════════════ INTERNAL IMPORTS ══════════════════════════════════════════════════

import {ZapDataV1} from "../libs/ZapDataV1.sol";

// ═════════════════════════════════════════════ EXTERNAL IMPORTS ══════════════════════════════════════════════════

import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title TokenZapV1
/// @notice Facilitates atomic token operations known as "Zaps," allowing to execute predefined actions
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-rfq/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ignore = ["contracts/legacy/**/*.sol"]
line_length = 120
multiline_func_header = 'all'
number_underscore = 'thousands'
sort_imports = true

[rpc_endpoints]
arbitrum = "${ARBITRUM_RPC}"
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts-rfq/test/FastBridgeMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
pragma solidity ^0.8.20;

import {Admin} from "../contracts/Admin.sol";
import {IFastBridge} from "../contracts/interfaces/IFastBridge.sol";

import {FastBridge} from "../contracts/FastBridge.sol";
import {IFastBridge} from "../contracts/interfaces/IFastBridge.sol";

contract FastBridgeMock is IFastBridge, Admin {
// @dev the block the contract was deployed at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {FastBridgeV2SrcTest, BridgeTransactionV2Lib, IFastBridgeV2} from "./FastBridgeV2.Src.t.sol";
import {BridgeTransactionV2Lib, FastBridgeV2SrcTest, IFastBridgeV2} from "./FastBridgeV2.Src.t.sol";

// solhint-disable func-name-mixedcase, ordering
contract FastBridgeV2SrcRefundV1Test is FastBridgeV2SrcTest {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-rfq/test/FastBridgeV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {IFastBridge} from "../contracts/interfaces/IFastBridge.sol";
// solhint-disable-next-line no-unused-import
import {IFastBridgeV2} from "../contracts/interfaces/IFastBridgeV2.sol";

import {IFastBridgeV2Errors} from "../contracts/interfaces/IFastBridgeV2Errors.sol";
import {FastBridgeV2} from "../contracts/FastBridgeV2.sol";
import {IFastBridgeV2Errors} from "../contracts/interfaces/IFastBridgeV2Errors.sol";

import {MockERC20} from "./MockERC20.sol";

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {Test} from "forge-std/Test.sol";
import {stdStorage, StdStorage} from "forge-std/Test.sol";
import {StdStorage, stdStorage} from "forge-std/Test.sol";

// solhint-disable no-empty-blocks, max-states-count, ordering
abstract contract FastBridgeV2Test is Test, IFastBridgeV2Errors {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/MulticallTarget.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

import {IMulticallTarget} from "../contracts/interfaces/IMulticallTarget.sol";
import {MulticallTargetHarness, MulticallTarget} from "./harnesses/MulticallTargetHarness.sol";
import {MulticallTarget, MulticallTargetHarness} from "./harnesses/MulticallTargetHarness.sol";

import {Test} from "forge-std/Test.sol";

Expand Down
3 changes: 2 additions & 1 deletion packages/contracts-rfq/test/UniversalTokenLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
pragma solidity ^0.8.17;

import {TokenNotContract} from "../contracts/libs/Errors.sol";
import {UniversalTokenLibHarness} from "./UniversalTokenLibHarness.sol";

import {MockERC20} from "./MockERC20.sol";
import {MockRevertingRecipient} from "./MockRevertingRecipient.sol";
import {UniversalTokenLibHarness} from "./UniversalTokenLibHarness.sol";

import {Test} from "forge-std/Test.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.20;

import {FastBridge} from "../../contracts/FastBridge.sol";

import {MulticallTargetIntegrationTest, IFastBridge} from "./MulticallTarget.t.sol";
import {IFastBridge, MulticallTargetIntegrationTest} from "./MulticallTarget.t.sol";

contract FastBridgeMulticallTargetTest is MulticallTargetIntegrationTest {
function deployAndConfigureFastBridge() public override returns (address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.24;
import {FastBridgeV2, IFastBridgeV2} from "../../contracts/FastBridgeV2.sol";
import {BridgeTransactionV2Lib} from "../../contracts/libs/BridgeTransactionV2.sol";

import {MulticallTargetIntegrationTest, IFastBridge} from "./MulticallTarget.t.sol";
import {IFastBridge, MulticallTargetIntegrationTest} from "./MulticallTarget.t.sol";

contract FastBridgeV2MulticallTargetTest is MulticallTargetIntegrationTest {
function deployAndConfigureFastBridge() public override returns (address) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {TokenZapV1IntegrationTest, VaultManyArguments, IFastBridge, IFastBridgeV2} from "./TokenZapV1.t.sol";
import {IFastBridge, IFastBridgeV2, TokenZapV1IntegrationTest, VaultManyArguments} from "./TokenZapV1.t.sol";

// solhint-disable func-name-mixedcase, ordering
contract FastBridgeV2TokenZapV1DstTest is TokenZapV1IntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {TokenZapV1IntegrationTest, IFastBridge, IFastBridgeV2} from "./TokenZapV1.t.sol";
import {IFastBridge, IFastBridgeV2, TokenZapV1IntegrationTest} from "./TokenZapV1.t.sol";

// solhint-disable func-name-mixedcase, ordering
contract FastBridgeV2TokenZapV1SrcTest is TokenZapV1IntegrationTest {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/integration/TokenZapV1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {BridgeTransactionV2Lib} from "../../contracts/libs/BridgeTransactionV2.s
import {ZapDataV1} from "../../contracts/libs/ZapDataV1.sol";
import {TokenZapV1} from "../../contracts/zaps/TokenZapV1.sol";

import {VaultManyArguments} from "../mocks/VaultManyArguments.sol";
import {MockERC20} from "../MockERC20.sol";
import {VaultManyArguments} from "../mocks/VaultManyArguments.sol";

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/libs/ZapDataV1.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {ZapDataV1Harness, ZapDataV1} from "../harnesses/ZapDataV1Harness.sol";
import {ZapDataV1, ZapDataV1Harness} from "../harnesses/ZapDataV1Harness.sol";

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/mocks/VaultMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @notice Vault mock for testing purposes. DO NOT USE IN PRODUCTION.
abstract contract VaultMock {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/zaps/TokenZapV1.GasBench.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity 0.8.24;

import {TokenZapV1} from "../../contracts/zaps/TokenZapV1.sol";

import {SimpleVaultMock} from "../mocks/SimpleVaultMock.sol";
import {MockERC20} from "../MockERC20.sol";
import {SimpleVaultMock} from "../mocks/SimpleVaultMock.sol";

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/zaps/TokenZapV1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity 0.8.24;
import {ZapDataV1} from "../../contracts/libs/ZapDataV1.sol";
import {TokenZapV1} from "../../contracts/zaps/TokenZapV1.sol";

import {VaultManyArguments} from "../mocks/VaultManyArguments.sol";
import {MockERC20} from "../MockERC20.sol";
import {VaultManyArguments} from "../mocks/VaultManyArguments.sol";

import {Test} from "forge-std/Test.sol";

Expand Down

0 comments on commit b59c9d0

Please sign in to comment.