Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlinaric committed Mar 25, 2024
1 parent e38417a commit 0a404d5
Show file tree
Hide file tree
Showing 44 changed files with 246 additions and 220 deletions.
1 change: 0 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as dotenv from "dotenv";

import type { HardhatUserConfig } from "hardhat/config";
import "hardhat-preprocessor";
import "@nomicfoundation/hardhat-toolbox";
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrations/01_deployCoreContracts.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
3 changes: 2 additions & 1 deletion scripts/migrations/02_deployHandlers.ts
Original file line number Diff line number Diff line change
@@ -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 ({
Expand Down
3 changes: 2 additions & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -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<string>): {
Expand Down
15 changes: 8 additions & 7 deletions test/contractBridge/admin.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/contractBridge/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 3 additions & 2 deletions test/contractBridge/depositERC20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
9 changes: 4 additions & 5 deletions test/contractBridge/executeProposalERC20.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
11 changes: 7 additions & 4 deletions test/contractBridge/executeProposals.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
21 changes: 10 additions & 11 deletions test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
// 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,
accountProof4,
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;
Expand Down
23 changes: 11 additions & 12 deletions test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
// 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,
accountProof6,
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;
Expand Down
23 changes: 11 additions & 12 deletions test/e2e/erc20/decimals/roundingLoss.test.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
// 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,
accountProof8,
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;
Expand Down
19 changes: 9 additions & 10 deletions test/e2e/erc20/differentChainsMock.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
9 changes: 4 additions & 5 deletions test/e2e/erc20/sameChain.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 0a404d5

Please sign in to comment.