removed errors

This commit is contained in:
pradyuman-verma 2021-12-06 03:31:27 +05:30 committed by Ishan Jain
parent 65f3d3f9ac
commit 6f14a93e8a
11 changed files with 36 additions and 71 deletions

View File

@ -1,4 +1,4 @@
export const addresses = {
export const addresses: Record<string, any> = {
connectors: {
basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",

View File

@ -3,7 +3,6 @@ import { deployConnector } from "./deployConnector";
async function main() {
const accounts = await ethers.getSigners();
const wallet = accounts[0];
const connectMapping: Record<string, string> = {
"1INCH-A": "ConnectV2OneInch",

View File

@ -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<string, string> = {};
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);

View File

@ -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);
});

View File

@ -7,7 +7,7 @@ const mineTx = async (tx: any) => {
await (await tx).wait();
};
const tokenMapping = {
const tokenMapping: Record<string, any> = {
usdc: {
impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a",
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",

View File

@ -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";

View File

@ -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;

View File

@ -1,4 +1,4 @@
import * as hre from "hardhat";
import hre from "hardhat";
const { web3 } = hre;
import { encodeSpells } from "./encodeSpells.js";

View File

@ -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..");

View File

@ -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 () {

View File

@ -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 () {