From 0a404d59e785fe4177d95c0c9818b97905a7d77f Mon Sep 17 00:00:00 2001 From: nmlinaric Date: Mon, 25 Mar 2024 17:00:44 +0100 Subject: [PATCH] Lint --- hardhat.config.ts | 1 - scripts/migrations/01_deployCoreContracts.ts | 2 +- scripts/migrations/02_deployHandlers.ts | 3 ++- scripts/utils.ts | 3 ++- test/contractBridge/admin.test.ts | 15 ++++++------ test/contractBridge/constructor.test.ts | 2 +- test/contractBridge/depositERC20.test.ts | 5 ++-- .../executeProposalERC20.test.ts | 9 ++++---- test/contractBridge/executeProposals.test.ts | 11 +++++---- .../decimals/bothChainsNot18Decimals.test.ts | 22 +++++++++--------- .../decimals/oneChainNot18Decimals.test.ts | 21 ++++++++--------- .../decimals/oneChainWith0Decimals.test.ts | 23 +++++++++---------- test/e2e/erc20/decimals/roundingLoss.test.ts | 23 +++++++++---------- test/e2e/erc20/differentChainsMock.test.ts | 19 ++++++++------- test/e2e/erc20/sameChain.test.ts | 9 ++++---- test/handlers/erc20/admin.test.ts | 5 ++-- test/handlers/erc20/constructor.test.ts | 3 ++- test/handlers/erc20/decimals.test.ts | 5 ++-- test/handlers/erc20/deposit.test.ts | 15 ++++++------ test/handlers/erc20/depositBurn.test.ts | 6 ++--- test/handlers/erc20/isBurnable.test.ts | 5 ++-- test/handlers/erc20/isWhitelisted.test.ts | 5 ++-- .../setResourceIdAndContractAddress.test.ts | 5 ++-- test/handlers/fee/basic/admin.test.ts | 8 +++---- test/handlers/fee/basic/calculateFee.test.ts | 15 ++++++------ test/handlers/fee/basic/changeFee.test.ts | 7 +++--- test/handlers/fee/basic/collectFee.test.ts | 15 ++++++------ test/handlers/fee/basic/constructor.test.ts | 2 +- test/handlers/fee/basic/distributeFee.test.ts | 15 ++++++------ test/handlers/fee/handlerRouter.test.ts | 13 ++++++----- test/handlers/fee/percentage/admin.test.ts | 7 +++--- .../fee/percentage/calculateFee.test.ts | 15 ++++++------ .../handlers/fee/percentage/changeFee.test.ts | 7 +++--- .../fee/percentage/collectFee.test.ts | 15 ++++++------ .../fee/percentage/distributeFee.test.ts | 15 ++++++------ .../generic/permissionlessDeposit.test.ts | 15 ++++++------ .../executionWithEvents.test.ts | 21 +++++++++-------- .../gasTooSmall.test.ts | 23 ++++++++++--------- .../packedDepositData.test.ts | 23 ++++++++++--------- .../unpackedDepositData.test.ts | 23 ++++++++++--------- test/helpers.ts | 3 ++- test/proxies/spectre/spectreProxy.test.ts | 3 ++- .../constructor.test.ts | 1 + .../grantAccess.test.ts | 3 ++- 44 files changed, 246 insertions(+), 220 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index f15bbee7..e779a3ca 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,5 +1,4 @@ import * as dotenv from "dotenv"; - import type { HardhatUserConfig } from "hardhat/config"; import "hardhat-preprocessor"; import "@nomicfoundation/hardhat-toolbox"; diff --git a/scripts/migrations/01_deployCoreContracts.ts b/scripts/migrations/01_deployCoreContracts.ts index e8704472..6c376ad2 100644 --- a/scripts/migrations/01_deployCoreContracts.ts +++ b/scripts/migrations/01_deployCoreContracts.ts @@ -1,6 +1,6 @@ import { ethers } from "hardhat"; -import type { DeployFunction } from "hardhat-deploy/dist/types"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +import type { DeployFunction } from "hardhat-deploy/dist/types"; import { generateAccessControlFuncSignatures, verifyContract } from "../utils"; diff --git a/scripts/migrations/02_deployHandlers.ts b/scripts/migrations/02_deployHandlers.ts index 4beaf7bf..f8e04ed1 100644 --- a/scripts/migrations/02_deployHandlers.ts +++ b/scripts/migrations/02_deployHandlers.ts @@ -1,5 +1,6 @@ -import type { DeployFunction } from "hardhat-deploy/dist/types"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +import type { DeployFunction } from "hardhat-deploy/dist/types"; + import { verifyContract } from "../utils"; const deployFunc: DeployFunction = async function ({ diff --git a/scripts/utils.ts b/scripts/utils.ts index c14cdcc7..b369379f 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,8 +1,9 @@ import fs from "fs"; import { resolve } from "path"; -import { deployments, run } from "hardhat"; + import { keccak256, ContractFactory } from "ethers"; import type { InterfaceAbi, Fragment } from "ethers"; +import { deployments, run } from "hardhat"; import type { DeployResult } from "hardhat-deploy/dist/types"; export function generateAccessControlFuncSignatures(contracts: Array): { diff --git a/test/contractBridge/admin.test.ts b/test/contractBridge/admin.test.ts index 4f493c04..2885e51d 100644 --- a/test/contractBridge/admin.test.ts +++ b/test/contractBridge/admin.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCWithdrawData, -} from "../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -18,6 +14,11 @@ import type { ERC20PresetMinterPauser__factory, Executor, } from "../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCWithdrawData, +} from "../helpers"; // This test does NOT include all getter methods, just // getters that should work with only the constructor called diff --git a/test/contractBridge/constructor.test.ts b/test/contractBridge/constructor.test.ts index 3e054966..dbc7c75c 100644 --- a/test/contractBridge/constructor.test.ts +++ b/test/contractBridge/constructor.test.ts @@ -1,8 +1,8 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { expect } from "chai"; +import { ethers } from "hardhat"; describe("Bridge/Router/Executor - [constructor]", () => { const domainID = 1; diff --git a/test/contractBridge/depositERC20.test.ts b/test/contractBridge/depositERC20.test.ts index 8163610d..ed9bd85e 100755 --- a/test/contractBridge/depositERC20.test.ts +++ b/test/contractBridge/depositERC20.test.ts @@ -4,9 +4,10 @@ import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; import { ethers } from "hardhat"; + import type { Bridge, - Depositor, + Router, ERC20Handler, ERC20PresetMinterPauser, ERC20Safe__factory, @@ -31,7 +32,7 @@ describe("Bridge - [deposit - ERC20]", () => { const routerAddress = "0x1a60efB48c61A79515B170CA61C84DD6dCA80418"; let bridgeInstance: Bridge; - let routerInstance: Depositor; + let routerInstance: Router; let executorInstance: Executor; let ERC20MintableInstance1: ERC20PresetMinterPauser; let ERC20MintableInstance2: ERC20PresetMinterPauser; diff --git a/test/contractBridge/executeProposalERC20.test.ts b/test/contractBridge/executeProposalERC20.test.ts index a7b4e49c..ab8d1822 100755 --- a/test/contractBridge/executeProposalERC20.test.ts +++ b/test/contractBridge/executeProposalERC20.test.ts @@ -1,12 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createERCDepositData } from "../helpers"; - -import { accountProof1, storageProof1 } from "../testingProofs"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; import type { Bridge, @@ -17,6 +14,8 @@ import type { StateRootStorage, MerkleTrie__factory, } from "../../typechain-types"; +import { deployBridgeContracts, createERCDepositData } from "../helpers"; +import { accountProof1, storageProof1 } from "../testingProofs"; describe("Bridge - [execute proposal - ERC20]", () => { const originDomainID = 1; diff --git a/test/contractBridge/executeProposals.test.ts b/test/contractBridge/executeProposals.test.ts index 4c0705cd..d8ac6728 100755 --- a/test/contractBridge/executeProposals.test.ts +++ b/test/contractBridge/executeProposals.test.ts @@ -1,11 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createERCDepositData } from "../helpers"; -import { accountProof1, storageProof1 } from "../testingProofs"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; import type { Bridge, @@ -15,6 +13,8 @@ import type { ERC20PresetMinterPauser, StateRootStorage, } from "../../typechain-types"; +import { deployBridgeContracts, createERCDepositData } from "../helpers"; +import { accountProof1, storageProof1 } from "../testingProofs"; describe("Bridge - [execute proposals]", () => { const originDomainID = 1; @@ -145,6 +145,7 @@ describe("Bridge - [execute proposals]", () => { await expect(executeTx).not.to.be.reverted; // check that deposit nonces had been marked as used in bitmap + // eslint-disable-next-line @typescript-eslint/no-floating-promises expectedDepositNonces.map(async (_, index) => { assert.isTrue( await executorInstance.isProposalExecuted( @@ -184,6 +185,7 @@ describe("Bridge - [execute proposals]", () => { await expect(executeTx).not.to.be.reverted; // check that deposit nonces had been marked as used in bitmap + // eslint-disable-next-line @typescript-eslint/no-floating-promises expectedDepositNonces.map(async (_, index) => { assert.isTrue( await executorInstance.isProposalExecuted( @@ -252,6 +254,7 @@ describe("Bridge - [execute proposals]", () => { ); // check that deposit nonces had been marked as used in bitmap + // eslint-disable-next-line @typescript-eslint/no-floating-promises expectedDepositNonces.map(async (_, index) => { assert.isTrue( await executorInstance.isProposalExecuted( diff --git a/test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts b/test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts index 741814cf..319bfdb0 100755 --- a/test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts +++ b/test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts @@ -1,9 +1,18 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + +import type { + StateRootStorage, + Bridge, + ERC20Handler, + ERC20PresetMinterPauser, + Executor, + Router, +} from "../../../../typechain-types"; import { deployBridgeContracts, createERCDepositData, @@ -16,15 +25,6 @@ import { storageProof4, } from "../../../testingProofs"; -import type { - StateRootStorage, - Bridge, - ERC20Handler, - ERC20PresetMinterPauser, - Executor, - Router, -} from "../../../../typechain-types"; - describe("E2E ERC20 - Two EVM Chains both with decimal places != 18", () => { const originDomainID = 1; const destinationDomainID = 2; diff --git a/test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts b/test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts index ab31652e..93de97b6 100755 --- a/test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts +++ b/test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts @@ -1,15 +1,23 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { expect, assert } from "chai"; import { ethers } from "hardhat"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; + +import type { + StateRootStorage, + Bridge, + ERC20Handler, + ERC20PresetMinterPauser, + Executor, + Router, +} from "../../../../typechain-types"; import { deployBridgeContracts, createERCDepositData, getDepositEventData, } from "../../../helpers"; - import { accountProof3, storageProof3, @@ -17,15 +25,6 @@ import { storageProof4, } from "../../../testingProofs"; -import type { - StateRootStorage, - Bridge, - ERC20Handler, - ERC20PresetMinterPauser, - Executor, - Router, -} from "../../../../typechain-types"; - describe("E2E ERC20 - Two EVM Chains, one with decimal places == 18, other with != 18", () => { const originDomainID = 1; const destinationDomainID = 2; diff --git a/test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts b/test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts index 9461a3dd..af83e082 100755 --- a/test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts +++ b/test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts @@ -1,15 +1,23 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + +import type { + Bridge, + ERC20Handler, + ERC20PresetMinterPauser, + Executor, + Router, + StateRootStorage, +} from "../../../../typechain-types"; import { deployBridgeContracts, createERCDepositData, getDepositEventData, } from "../../../helpers"; - import { accountProof5, storageProof5, @@ -17,15 +25,6 @@ import { storageProof6, } from "../../../testingProofs"; -import type { - Bridge, - ERC20Handler, - ERC20PresetMinterPauser, - Executor, - Router, - StateRootStorage, -} from "../../../../typechain-types"; - describe("E2E ERC20 - Two EVM Chains, one with decimal places == 18, other with == 0", () => { const originDomainID = 1; const destinationDomainID = 2; diff --git a/test/e2e/erc20/decimals/roundingLoss.test.ts b/test/e2e/erc20/decimals/roundingLoss.test.ts index 0d14bb5d..1bc2722f 100755 --- a/test/e2e/erc20/decimals/roundingLoss.test.ts +++ b/test/e2e/erc20/decimals/roundingLoss.test.ts @@ -1,16 +1,24 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + +import type { + Bridge, + ERC20Handler, + ERC20PresetMinterPauser, + Router, + Executor, + StateRootStorage, +} from "../../../../typechain-types"; import { deployBridgeContracts, createERCDepositData, toHex, getDepositEventData, } from "../../../helpers"; - import { accountProof7, storageProof7, @@ -18,15 +26,6 @@ import { storageProof8, } from "../../../testingProofs"; -import type { - Bridge, - ERC20Handler, - ERC20PresetMinterPauser, - Router, - Executor, - StateRootStorage, -} from "../../../../typechain-types"; - describe("E2E ERC20 - Two EVM Chains both with decimal places != 18 with rounding loss", () => { const originDomainID = 1; const destinationDomainID = 2; diff --git a/test/e2e/erc20/differentChainsMock.test.ts b/test/e2e/erc20/differentChainsMock.test.ts index a6d5bdc9..97fe3a0f 100755 --- a/test/e2e/erc20/differentChainsMock.test.ts +++ b/test/e2e/erc20/differentChainsMock.test.ts @@ -1,17 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createERCDepositData } from "../../helpers"; - -import { - accountProof1, - storageProof1, - accountProof2, - storageProof2, -} from "../../testingProofs"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; import type { Bridge, @@ -21,6 +13,13 @@ import type { ERC20PresetMinterPauser, StateRootStorage, } from "../../../typechain-types"; +import { deployBridgeContracts, createERCDepositData } from "../../helpers"; +import { + accountProof1, + storageProof1, + accountProof2, + storageProof2, +} from "../../testingProofs"; describe("E2E ERC20 - Two EVM Chains", () => { const originDomainID = 1; diff --git a/test/e2e/erc20/sameChain.test.ts b/test/e2e/erc20/sameChain.test.ts index 65e83c53..4556603a 100755 --- a/test/e2e/erc20/sameChain.test.ts +++ b/test/e2e/erc20/sameChain.test.ts @@ -1,12 +1,9 @@ -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; -import { deployBridgeContracts, createERCDepositData } from "../../helpers"; - -import { accountProof1, storageProof1 } from "../../testingProofs"; +import { ethers } from "hardhat"; import type { Bridge, @@ -16,6 +13,8 @@ import type { ERC20PresetMinterPauser, StateRootStorage, } from "../../../typechain-types"; +import { deployBridgeContracts, createERCDepositData } from "../../helpers"; +import { accountProof1, storageProof1 } from "../../testingProofs"; describe("E2E ERC20 - Same Chain", () => { const originDomainID = 1; diff --git a/test/handlers/erc20/admin.test.ts b/test/handlers/erc20/admin.test.ts index 81193e77..8dcc6a85 100644 --- a/test/handlers/erc20/admin.test.ts +++ b/test/handlers/erc20/admin.test.ts @@ -1,9 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, Router, diff --git a/test/handlers/erc20/constructor.test.ts b/test/handlers/erc20/constructor.test.ts index dfb4998c..268087d0 100755 --- a/test/handlers/erc20/constructor.test.ts +++ b/test/handlers/erc20/constructor.test.ts @@ -1,8 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, Router, diff --git a/test/handlers/erc20/decimals.test.ts b/test/handlers/erc20/decimals.test.ts index 120bab0a..3adcfe16 100755 --- a/test/handlers/erc20/decimals.test.ts +++ b/test/handlers/erc20/decimals.test.ts @@ -1,10 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert } from "chai"; import { ethers } from "hardhat"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createResourceID } from "../../helpers"; + import type { Bridge, Router, @@ -12,6 +12,7 @@ import type { ERC20Handler, ERC20PresetMinterPauser, } from "../../../typechain-types"; +import { deployBridgeContracts, createResourceID } from "../../helpers"; describe("ERC20Handler - [decimals]", () => { const originDomainID = 1; diff --git a/test/handlers/erc20/deposit.test.ts b/test/handlers/erc20/deposit.test.ts index 9e41b261..639e0f1e 100755 --- a/test/handlers/erc20/deposit.test.ts +++ b/test/handlers/erc20/deposit.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -17,6 +13,11 @@ import type { ERC20PresetMinterPauser, ERC20Safe__factory, } from "../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../helpers"; describe("ERC20Handler - [Deposit ERC20]", () => { const originDomainID = 1; diff --git a/test/handlers/erc20/depositBurn.test.ts b/test/handlers/erc20/depositBurn.test.ts index d872dba6..b4cd34f2 100755 --- a/test/handlers/erc20/depositBurn.test.ts +++ b/test/handlers/erc20/depositBurn.test.ts @@ -1,10 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert } from "chai"; import { ethers } from "hardhat"; -import { assert } from "chai"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createResourceID } from "../../helpers"; import type { Bridge, Router, @@ -12,6 +11,7 @@ import type { ERC20Handler, ERC20PresetMinterPauser, } from "../../../typechain-types"; +import { deployBridgeContracts, createResourceID } from "../../helpers"; describe("ERC20Handler - [Deposit Burn ERC20]", () => { const domainID = 1; diff --git a/test/handlers/erc20/isBurnable.test.ts b/test/handlers/erc20/isBurnable.test.ts index 14a23855..83185630 100755 --- a/test/handlers/erc20/isBurnable.test.ts +++ b/test/handlers/erc20/isBurnable.test.ts @@ -1,9 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { assert, expect } from "chai"; -import { deployBridgeContracts } from "../../helpers"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -11,6 +11,7 @@ import type { ERC20Handler, ERC20PresetMinterPauser, } from "../../../typechain-types"; +import { deployBridgeContracts } from "../../helpers"; describe("ERC20Handler - [Burn ERC20]", () => { const domainID = 1; diff --git a/test/handlers/erc20/isWhitelisted.test.ts b/test/handlers/erc20/isWhitelisted.test.ts index cbad0a58..0564dea1 100755 --- a/test/handlers/erc20/isWhitelisted.test.ts +++ b/test/handlers/erc20/isWhitelisted.test.ts @@ -1,9 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { assert, expect } from "chai"; -import { deployBridgeContracts } from "../../helpers"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -11,6 +11,7 @@ import type { ERC20Handler, ERC20PresetMinterPauser, } from "../../../typechain-types"; +import { deployBridgeContracts } from "../../helpers"; describe("ERC20Handler - [isWhitelisted]", () => { const domainID = 1; diff --git a/test/handlers/erc20/setResourceIdAndContractAddress.test.ts b/test/handlers/erc20/setResourceIdAndContractAddress.test.ts index 27f079bc..d842e7ee 100755 --- a/test/handlers/erc20/setResourceIdAndContractAddress.test.ts +++ b/test/handlers/erc20/setResourceIdAndContractAddress.test.ts @@ -1,9 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { assert } from "chai"; -import { createResourceID, deployBridgeContracts } from "../../helpers"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -11,6 +11,7 @@ import type { ERC20Handler, ERC20PresetMinterPauser, } from "../../../typechain-types"; +import { createResourceID, deployBridgeContracts } from "../../helpers"; describe("ERC20Handler - [setResourceIDAndContractAddress]", () => { const domainID = 1; diff --git a/test/handlers/fee/basic/admin.test.ts b/test/handlers/fee/basic/admin.test.ts index 784e0949..1a530ce5 100755 --- a/test/handlers/fee/basic/admin.test.ts +++ b/test/handlers/fee/basic/admin.test.ts @@ -1,12 +1,11 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; - -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert, expect } from "chai"; import { ZeroAddress } from "ethers"; -import { createResourceID, deployBridgeContracts } from "../../../helpers"; +import { ethers } from "hardhat"; + import type { BasicFeeHandler, Bridge, @@ -14,6 +13,7 @@ import type { FeeHandlerRouter, ERC20PresetMinterPauser, } from "../../../../typechain-types"; +import { createResourceID, deployBridgeContracts } from "../../../helpers"; describe("BasicFeeHandler - [admin]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/basic/calculateFee.test.ts b/test/handlers/fee/basic/calculateFee.test.ts index 3429c049..6b44c5ea 100755 --- a/test/handlers/fee/basic/calculateFee.test.ts +++ b/test/handlers/fee/basic/calculateFee.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, BasicFeeHandler, @@ -18,6 +14,11 @@ import type { Router, Executor, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("BasicFeeHandler - [calculateFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/basic/changeFee.test.ts b/test/handlers/fee/basic/changeFee.test.ts index b7af0e81..3d7fe053 100755 --- a/test/handlers/fee/basic/changeFee.test.ts +++ b/test/handlers/fee/basic/changeFee.test.ts @@ -1,10 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { createResourceID, deployBridgeContracts } from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { BasicFeeHandler, Bridge, @@ -12,6 +12,7 @@ import type { FeeHandlerRouter, ERC20PresetMinterPauser, } from "../../../../typechain-types"; +import { createResourceID, deployBridgeContracts } from "../../../helpers"; describe("BasicFeeHandler - [changeFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/basic/collectFee.test.ts b/test/handlers/fee/basic/collectFee.test.ts index df2cfbd3..69266814 100755 --- a/test/handlers/fee/basic/collectFee.test.ts +++ b/test/handlers/fee/basic/collectFee.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { BasicFeeHandler, Bridge, @@ -18,6 +14,11 @@ import type { ERC20PresetMinterPauser, FeeHandlerRouter, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("BasicFeeHandler - [collectFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/basic/constructor.test.ts b/test/handlers/fee/basic/constructor.test.ts index 5dc50713..6601be6d 100644 --- a/test/handlers/fee/basic/constructor.test.ts +++ b/test/handlers/fee/basic/constructor.test.ts @@ -1,8 +1,8 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; import { expect } from "chai"; +import { ethers } from "hardhat"; describe("BasicFeeHandler - [constructor]", () => { it("[sanity] should revert deploying BasicFeeHandler contract if zero address is provided in constructor", async () => { diff --git a/test/handlers/fee/basic/distributeFee.test.ts b/test/handlers/fee/basic/distributeFee.test.ts index 937683d6..b7dedbf1 100755 --- a/test/handlers/fee/basic/distributeFee.test.ts +++ b/test/handlers/fee/basic/distributeFee.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { BasicFeeHandler, Bridge, @@ -18,6 +14,11 @@ import type { ERC20PresetMinterPauser, FeeHandlerRouter, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("BasicFeeHandler - [distributeFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/handlerRouter.test.ts b/test/handlers/fee/handlerRouter.test.ts index 0e794d05..4ed9d684 100755 --- a/test/handlers/fee/handlerRouter.test.ts +++ b/test/handlers/fee/handlerRouter.test.ts @@ -1,20 +1,21 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; import { ethers } from "hardhat"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - createResourceID, - createERCDepositData, - deployBridgeContracts, -} from "../../helpers"; + import type { BasicFeeHandler, ERC20PresetMinterPauser, FeeHandlerRouter, Router, } from "../../../typechain-types"; +import { + createResourceID, + createERCDepositData, + deployBridgeContracts, +} from "../../helpers"; describe("FeeHandlerRouter", () => { const originDomainID = 1; diff --git a/test/handlers/fee/percentage/admin.test.ts b/test/handlers/fee/percentage/admin.test.ts index 353371d2..4163df31 100755 --- a/test/handlers/fee/percentage/admin.test.ts +++ b/test/handlers/fee/percentage/admin.test.ts @@ -1,10 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createResourceID } from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, ERC20PresetMinterPauser, @@ -12,6 +12,7 @@ import type { PercentageERC20FeeHandlerEVM, Router, } from "../../../../typechain-types"; +import { deployBridgeContracts, createResourceID } from "../../../helpers"; describe("PercentageFeeHandler - [admin]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/percentage/calculateFee.test.ts b/test/handlers/fee/percentage/calculateFee.test.ts index 49be4c33..f913ac15 100755 --- a/test/handlers/fee/percentage/calculateFee.test.ts +++ b/test/handlers/fee/percentage/calculateFee.test.ts @@ -1,13 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, ERC20Handler, @@ -17,6 +13,11 @@ import type { PercentageERC20FeeHandlerEVM, Router, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("PercentageFeeHandler - [calculateFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/percentage/changeFee.test.ts b/test/handlers/fee/percentage/changeFee.test.ts index d8f153a0..b641f8ae 100755 --- a/test/handlers/fee/percentage/changeFee.test.ts +++ b/test/handlers/fee/percentage/changeFee.test.ts @@ -1,10 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { deployBridgeContracts, createResourceID } from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, ERC20PresetMinterPauser, @@ -13,6 +13,7 @@ import type { PercentageERC20FeeHandlerEVM__factory, Router, } from "../../../../typechain-types"; +import { deployBridgeContracts, createResourceID } from "../../../helpers"; describe("PercentageFeeHandler - [change fee and bounds]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/percentage/collectFee.test.ts b/test/handlers/fee/percentage/collectFee.test.ts index 3e9b39c9..a121a359 100755 --- a/test/handlers/fee/percentage/collectFee.test.ts +++ b/test/handlers/fee/percentage/collectFee.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, ERC20Handler, @@ -18,6 +14,11 @@ import type { PercentageERC20FeeHandlerEVM, Router, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("PercentageFeeHandler - [collectFee]", () => { const originDomainID = 1; diff --git a/test/handlers/fee/percentage/distributeFee.test.ts b/test/handlers/fee/percentage/distributeFee.test.ts index b9eca9ff..8b6e5891 100644 --- a/test/handlers/fee/percentage/distributeFee.test.ts +++ b/test/handlers/fee/percentage/distributeFee.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createERCDepositData, -} from "../../../helpers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, ERC20Handler, @@ -18,6 +14,11 @@ import type { PercentageERC20FeeHandlerEVM, Router, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createERCDepositData, +} from "../../../helpers"; describe("PercentageFeeHandler - [distributeFee]", () => { const originDomainID = 1; diff --git a/test/handlers/generic/permissionlessDeposit.test.ts b/test/handlers/generic/permissionlessDeposit.test.ts index 11bd2f60..d55bb84a 100755 --- a/test/handlers/generic/permissionlessDeposit.test.ts +++ b/test/handlers/generic/permissionlessDeposit.test.ts @@ -1,14 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - createResourceID, - createPermissionlessGenericDepositData, -} from "../../helpers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + import type { Bridge, Router, @@ -16,6 +12,11 @@ import type { PermissionlessGenericHandler, TestStore, } from "../../../typechain-types"; +import { + deployBridgeContracts, + createResourceID, + createPermissionlessGenericDepositData, +} from "../../helpers"; describe("PermissionlessGenericHandler - [deposit]", () => { const originDomainID = 1; diff --git a/test/handlers/generic/permissionlessExecuteProposal/executionWithEvents.test.ts b/test/handlers/generic/permissionlessExecuteProposal/executionWithEvents.test.ts index 266f2091..53fe9ea1 100755 --- a/test/handlers/generic/permissionlessExecuteProposal/executionWithEvents.test.ts +++ b/test/handlers/generic/permissionlessExecuteProposal/executionWithEvents.test.ts @@ -1,9 +1,18 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { assert, expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { assert, expect } from "chai"; +import { ethers } from "hardhat"; + +import type { + Bridge, + Router, + Executor, + StateRootStorage, + PermissionlessGenericHandler, + TestStore, +} from "../../../../typechain-types"; import { deployBridgeContracts, constructGenericHandlerSetResourceData, @@ -13,14 +22,6 @@ import { deployMockTestContracts, } from "../../../helpers"; import { gmpStorageProof1, gmpAccountProof1 } from "../../../testingProofs"; -import type { - Bridge, - Router, - Executor, - StateRootStorage, - PermissionlessGenericHandler, - TestStore, -} from "../../../../typechain-types"; describe("PermissionlessGenericHandler - [Execute Proposal] - TestStore", () => { const originDomainID = 1; diff --git a/test/handlers/generic/permissionlessExecuteProposal/gasTooSmall.test.ts b/test/handlers/generic/permissionlessExecuteProposal/gasTooSmall.test.ts index 6f3cdda5..4b661693 100644 --- a/test/handlers/generic/permissionlessExecuteProposal/gasTooSmall.test.ts +++ b/test/handlers/generic/permissionlessExecuteProposal/gasTooSmall.test.ts @@ -1,18 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - constructGenericHandlerSetResourceData, - createPermissionlessGenericDepositData, - blankFunctionDepositorOffset, - blankFunctionSig, - deployMockTestContracts, -} from "../../../helpers"; -import { gmpStorageProof2, gmpAccountProof2 } from "../../../testingProofs"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + import type { TestDeposit, Bridge, @@ -22,6 +14,15 @@ import type { PermissionlessGenericHandler, TestStore, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + constructGenericHandlerSetResourceData, + createPermissionlessGenericDepositData, + blankFunctionDepositorOffset, + blankFunctionSig, + deployMockTestContracts, +} from "../../../helpers"; +import { gmpStorageProof2, gmpAccountProof2 } from "../../../testingProofs"; describe("PermissionlessGenericHandler - [Execute Proposal] - Gas to small", () => { const originDomainID = 1; diff --git a/test/handlers/generic/permissionlessExecuteProposal/packedDepositData.test.ts b/test/handlers/generic/permissionlessExecuteProposal/packedDepositData.test.ts index 514222ab..fa67a459 100644 --- a/test/handlers/generic/permissionlessExecuteProposal/packedDepositData.test.ts +++ b/test/handlers/generic/permissionlessExecuteProposal/packedDepositData.test.ts @@ -1,18 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { - deployBridgeContracts, - constructGenericHandlerSetResourceData, - createPermissionlessGenericDepositData, - blankFunctionDepositorOffset, - blankFunctionSig, - deployMockTestContracts, -} from "../../../helpers"; -import { gmpStorageProof3, gmpAccountProof3 } from "../../../testingProofs"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + import type { TestDeposit, Bridge, @@ -22,6 +14,15 @@ import type { PermissionlessGenericHandler, TestStore, } from "../../../../typechain-types"; +import { + deployBridgeContracts, + constructGenericHandlerSetResourceData, + createPermissionlessGenericDepositData, + blankFunctionDepositorOffset, + blankFunctionSig, + deployMockTestContracts, +} from "../../../helpers"; +import { gmpStorageProof3, gmpAccountProof3 } from "../../../testingProofs"; describe("PermissionlessGenericHandler - [Execute Proposal] - packed deposit data", () => { const originDomainID = 1; diff --git a/test/handlers/generic/permissionlessExecuteProposal/unpackedDepositData.test.ts b/test/handlers/generic/permissionlessExecuteProposal/unpackedDepositData.test.ts index fc816269..bbacd759 100644 --- a/test/handlers/generic/permissionlessExecuteProposal/unpackedDepositData.test.ts +++ b/test/handlers/generic/permissionlessExecuteProposal/unpackedDepositData.test.ts @@ -1,9 +1,19 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers } from "hardhat"; -import { expect } from "chai"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import type { + TestDeposit, + Bridge, + Router, + Executor, + StateRootStorage, + PermissionlessGenericHandler, + TestStore, +} from "../../../../typechain-types"; import { deployBridgeContracts, constructGenericHandlerSetResourceData, @@ -14,15 +24,6 @@ import { deployMockTestContracts, } from "../../../helpers"; import { gmpStorageProof4, gmpAccountProof4 } from "../../../testingProofs"; -import type { - TestDeposit, - Bridge, - Router, - Executor, - StateRootStorage, - PermissionlessGenericHandler, - TestStore, -} from "../../../../typechain-types"; describe("PermissionlessGenericHandler - [Execute Proposal] - Unpacked deposit data", () => { const originDomainID = 1; diff --git a/test/helpers.ts b/test/helpers.ts index 9c9d6c69..6606674a 100755 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,8 +1,9 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only -import { ethers, network } from "hardhat"; import type { TransactionReceipt, TransactionResponse } from "ethers"; +import { ethers, network } from "hardhat"; + import { generateAccessControlFuncSignatures } from "../scripts/utils"; import type { Bridge, diff --git a/test/proxies/spectre/spectreProxy.test.ts b/test/proxies/spectre/spectreProxy.test.ts index f6547320..0fdd6a33 100644 --- a/test/proxies/spectre/spectreProxy.test.ts +++ b/test/proxies/spectre/spectreProxy.test.ts @@ -1,6 +1,7 @@ +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; import { ethers } from "hardhat"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; + import type { ISpectre, SpectreProxy } from "../../../typechain-types"; describe("Spectre Proxy", () => { diff --git a/test/utils/accessControlSegregator/constructor.test.ts b/test/utils/accessControlSegregator/constructor.test.ts index 127811da..b05b6b0d 100755 --- a/test/utils/accessControlSegregator/constructor.test.ts +++ b/test/utils/accessControlSegregator/constructor.test.ts @@ -4,6 +4,7 @@ import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; import { ethers } from "hardhat"; + import type { AccessControlSegregator, AccessControlSegregator__factory, diff --git a/test/utils/accessControlSegregator/grantAccess.test.ts b/test/utils/accessControlSegregator/grantAccess.test.ts index 256178d7..11212146 100755 --- a/test/utils/accessControlSegregator/grantAccess.test.ts +++ b/test/utils/accessControlSegregator/grantAccess.test.ts @@ -1,9 +1,10 @@ // The Licensed Work is (c) 2022 Sygma // SPDX-License-Identifier: LGPL-3.0-only +import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { assert, expect } from "chai"; import { ethers } from "hardhat"; -import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; + import type { AccessControlSegregator } from "../../../typechain-types"; describe("AccessControlSegregator - [grant access]", () => {