From e4d39cbb31ca3d70f1347a049561e0171191e42c Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 03:48:23 +0530 Subject: [PATCH] update --- status-checks/check.ts | 2 +- status-checks/index.ts | 1 - test/mainnet/aave/v1.test.ts | 19 +++++++++---------- test/mainnet/b.protocol/b.compound.test.ts | 17 ++++++++--------- test/mainnet/b.protocol/b.liquity.test.ts | 12 +++++------- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/status-checks/check.ts b/status-checks/check.ts index 9c0b442d..371c3825 100644 --- a/status-checks/check.ts +++ b/status-checks/check.ts @@ -3,7 +3,7 @@ import * as path from "path"; const forbiddenStrings: any = ["selfdestruct"]; -const getConnectorsList = async (connectorsRootsDirs: string | any[]) => { +const getConnectorsList= async (connectorsRootsDirs: string | any[]): Promise> => { try { const connectors = []; for (let index = 0; index < connectorsRootsDirs.length; index++) { diff --git a/status-checks/index.ts b/status-checks/index.ts index 984161d5..e740debf 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -35,7 +35,6 @@ async function setStatus(context, state, description) { (async () => { console.log(`Starting status checks for commit ${sha}`); - // Run in parallel await Promise.all( checks.map(async (check: { name: any; callback: any }) => { diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 52e1607c..563a3410 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,29 +1,27 @@ +import hre from "hardhat"; import { expect } from "chai"; -import "hardhat"; import { abis } from "../../../scripts/constant/abis"; import { addresses } from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; - -import ConnectV2AaveV1 from "../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"; +import { ConnectV2AaveV1, ConnectV2AaveV1__factory } from "../../../typechain"; import { parseEther } from "@ethersproject/units"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -// const { ethers } = hre; - -const ALCHEMY_ID = process.env.ALCHEMY_ID; +const { ethers } = hre; +import type { Signer, Contract } from "ethers"; describe("Aave V1", function () { const connectorName = "AAVEV1-TEST-A"; let wallet0: any, wallet1: any; let dsaWallet0: any; - let instaConnectorsV2: any; + let instaConnectorsV2: Contract; let connector: any; - let masterSigner: any; + let masterSigner: Signer; before(async () => { try { @@ -32,6 +30,7 @@ describe("Aave V1", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12796965, }, @@ -46,7 +45,7 @@ describe("Aave V1", function () { ); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: ConnectV2AaveV1, + contractArtifact: ConnectV2AaveV1__factory, signer: masterSigner, connectors: instaConnectorsV2, }); @@ -59,7 +58,7 @@ describe("Aave V1", function () { it("should have contracts deployed", async () => { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 1f0f20fa..8c885a2b 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,20 +7,18 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" - import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - -import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV2BCompound.json" +import { ConnectV2Compound__factory } from "../../../typechain"; +import type { Signer, Contract } from "ethers"; describe("B.Compound", function () { const connectorName = "B.COMPOUND-TEST-A" let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; const wallets = provider.getWallets() @@ -31,17 +29,18 @@ describe("B.Compound", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2CompoundArtifacts, + contractArtifact: ConnectV2Compound__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -51,7 +50,7 @@ describe("B.Compound", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; expect(await connector.name()).to.be.equal("B.Compound-v1.0"); }); diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index dd4e74ba..75ac42bf 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -9,13 +9,10 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - -import connectorLiquityArtifacts from ("../../artifacts/contracts/mainnet/connectors/b.protocol/liquity/main.sol/ConnectV2BLiquity.json") +import { ConnectV2BLiquity__factory } from "../../../typechain"; +import type { Signer, Contract } from "ethers"; const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool - const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" describe("B.Liquity", function () { @@ -23,8 +20,8 @@ describe("B.Liquity", function () { let dsaWallet0: any; let dsaWallet1: any - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; let manager: any; let vat: any; @@ -40,6 +37,7 @@ describe("B.Liquity", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12996875, },