diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index 28b6afec..d8d6a83b 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -1,4 +1,4 @@ -export const addresses = { +export const addresses: Record = { connectors: { basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", diff --git a/scripts/deployment/deploy.ts b/scripts/deployment/deploy.ts index 3c772bee..381fe091 100644 --- a/scripts/deployment/deploy.ts +++ b/scripts/deployment/deploy.ts @@ -3,7 +3,6 @@ import { deployConnector } from "./deployConnector"; async function main() { const accounts = await ethers.getSigners(); - const wallet = accounts[0]; const connectMapping: Record = { "1INCH-A": "ConnectV2OneInch", diff --git a/scripts/deployment/deployConnectorsFromCmd.ts b/scripts/deployment/deployConnectorsFromCmd.ts index 3fa462e6..39c55bdc 100644 --- a/scripts/deployment/deployConnectorsFromCmd.ts +++ b/scripts/deployment/deployConnectorsFromCmd.ts @@ -1,9 +1,10 @@ import * as fs from "fs"; -import { ethers, network, config } from "hardhat"; +import * as hre from "hardhat" +const { ethers, network, config } = hre; let args = process.argv; args = args.splice(2, args.length); -let params = {}; +let params: Record = {}; for (let i = 0; i < args.length; i += 2) { if (args[i][0] !== "-" || args[i][1] !== "-") { @@ -38,17 +39,16 @@ let wallet = new ethers.Wallet(privateKey, provider); network.name = params["networkName"]; network.config = config.networks[params["networkName"]]; network.provider = provider; -let contracts = []; +let contracts: (string | string[])[] = []; const parseFile = async (filePath: fs.PathOrFileDescriptor) => { const data = fs.readFileSync(filePath, "utf-8"); let parsedData = data.split("contract "); parsedData = parsedData[parsedData.length - 1].split(" "); - parsedData = parsedData[0]; - return parsedData; + return parsedData[0]; }; -const parseDir = async (root, basePath, addPath) => { +const parseDir = async (root: string | any[], basePath: string, addPath: string) => { for (let i = 0; i < root.length; i++) { addPath = "/" + root[i]; const dir = fs.readdirSync(basePath + addPath); diff --git a/scripts/deployment/deploySingle.ts b/scripts/deployment/deploySingle.ts deleted file mode 100644 index 51a0eb47..00000000 --- a/scripts/deployment/deploySingle.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as hre from "hardhat"; -const { ethers } = hre; -import { deployConnector } from "./deployConnector"; - -async function main() { - const address = await deployConnector("ConnectOne"); // Example - - const connectorsAbi = [ - "function addConnectors(string[] _connectorNames, address[] _connectors)", - ]; - - const connectorsContract = new ethers.Contract( - "0x84b457c6D31025d56449D5A01F0c34bF78636f67", - connectorsAbi, - ethers.provider - ); - - await connectorsContract.addConnectors(["1inch"], [address]); -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); diff --git a/scripts/tests/addLiquidity.ts b/scripts/tests/addLiquidity.ts index a2290a65..f29d6374 100644 --- a/scripts/tests/addLiquidity.ts +++ b/scripts/tests/addLiquidity.ts @@ -7,7 +7,7 @@ const mineTx = async (tx: any) => { await (await tx).wait(); }; -const tokenMapping = { +const tokenMapping: Record = { usdc: { impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a", address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index 79c74ebb..383d9ef1 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -1,7 +1,5 @@ import { ethers } from "hardhat"; -const network = String(process.env.networkType); - import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index f41ae881..8e1f5d4b 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -6,12 +6,9 @@ import hre from "hardhat"; import type { Signer, Contract } from "ethers"; import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; - const { ethers, waffle } = hre; const { deployContract } = waffle; - - interface DeployInterface { connectorName: string; contractArtifact: ContractJSON; @@ -19,7 +16,6 @@ interface DeployInterface { connectors: Contract; } - function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon; // else if (network === "arbitrum") return addressesPolygon; diff --git a/scripts/tests/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts index d7051737..f9a88803 100644 --- a/scripts/tests/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { web3 } = hre; import { encodeSpells } from "./encodeSpells.js"; diff --git a/status-checks/index.ts b/status-checks/index.ts index 738beed3..984161d5 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -38,7 +38,7 @@ async function setStatus(context, state, description) { // Run in parallel await Promise.all( - checks.map(async (check) => { + checks.map(async (check: { name: any; callback: any }) => { const { name, callback } = check; await setStatus(name, "pending", "Running check.."); diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index f8b28ad2..1ac4b662 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -12,27 +12,29 @@ import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; const { ethers } = hre; +import type { Signer, Contract } from "ethers"; describe("Aave V2", function () { const connectorName = "AAVEV2-TEST-A"; - let connector: ConnectV2AaveV2; + let connector: any; - let wallet0: any, wallet1: { address: any; }; + let wallet0: any, wallet1:any; let dsaWallet0: any; - let instaConnectorsV2: { address: any; }; - let masterSigner: { address: any; }; + let instaConnectorsV2: Contract; + let masterSigner: Signer; before(async () => { - // await hre.network.provider.request({ - // method: "hardhat_reset", - // params: [ - // { - // forking: { - // jsonRpcUrl: hre.config.networks.hardhat.forking.url, - // blockNumber: 12796965, - // }, - // }, - // ], - // }); + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 12796965, + }, + }, + ], + }); [wallet0, wallet1] = await ethers.getSigners(); masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( @@ -51,7 +53,7 @@ describe("Aave V2", 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/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index bb7d13d5..042e3e93 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -1,27 +1,23 @@ import { expect } from "chai"; import hre from "hardhat"; -const { web3, deployments, waffle, ethers } = hre; +const { waffle, ethers } = hre; const { provider, deployContract} = waffle import type { Signer, Contract } from "ethers"; -import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; 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/compound/main.sol/ConnectV2Compound.json" +import { ConnectV2Compound__factory } from "../../../typechain"; describe("Compound", function () { const connectorName = "COMPOUND-TEST-A" - let dsaWallet0: Signer; + let dsaWallet0: any; let masterSigner: Signer; let instaConnectorsV2: Contract; let connector: any; @@ -41,11 +37,11 @@ describe("Compound", function () { }, ], }); - 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 }) @@ -55,7 +51,7 @@ describe("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; }); describe("DSA wallet setup", function () {