fixed ts types

This commit is contained in:
Thrilok Kumar 2021-12-06 02:54:36 +05:30 committed by Ishan Jain
parent 4d6fc66c68
commit 65f3d3f9ac
5 changed files with 45 additions and 27 deletions

View File

@ -1,4 +1,4 @@
export const abis = {
export const abis: Record<string, any> = {
core: {
connectorsV2: require("./abi/core/connectorsV2.json"),
instaIndex: require("./abi/core/instaIndex.json"),

View File

@ -2,10 +2,23 @@ import { addresses as addressesPolygon } from "./polygon/addresses";
import { addresses } from "./mainnet/addresses";
import { abis } from "../constant/abis";
// const { deployContract } = waffle;
// import { ethers } from "hardhat";
// import { promises as fs } from "fs";
// import { deployContract } from "ethereum-waffle";
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;
signer: Signer;
connectors: Contract;
}
function getAddress(network: string | undefined) {
if (network === "polygon") return addressesPolygon;
@ -14,14 +27,15 @@ function getAddress(network: string | undefined) {
else return addresses;
}
export async function deployAndEnableConnector({
connectorName,
contractArtifact,
signer,
connectors,
}) {
const deployer = new contractArtifact(signer);
const connectorInstanace = await deployer.deploy();
export async function deployAndEnableConnector(
{
connectorName,
contractArtifact,
signer,
connectors
} : DeployInterface
) {
const connectorInstanace: Contract = await deployContract(signer, contractArtifact);
await connectors
.connect(signer)

View File

@ -1,11 +1,11 @@
export const addresses = {
connectors: {
basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",
export const addresses: Record<string, any> = {
"connectors": {
"basic": "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
"auth": "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",
"INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2",
},
core: {
connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11",
instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723",
"core": {
"connectorsV2": "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11",
"instaIndex": "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723",
},
};

View File

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

View File

@ -1,7 +1,10 @@
import { expect } from "chai";
import hre from "hardhat";
import { web3, deployments, waffle, ethers } = hre;
import { provider, deployContract } = waffle
const { web3, deployments, 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 { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
@ -13,14 +16,14 @@ 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 connectV2CompoundArtifacts from "../../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json"
describe("Compound", function () {
const connectorName = "COMPOUND-TEST-A"
let dsaWallet0: any;
let masterSigner: any;
let instaConnectorsV2: any;
let dsaWallet0: Signer;
let masterSigner: Signer;
let instaConnectorsV2: Contract;
let connector: any;
const wallets = provider.getWallets()
@ -31,6 +34,7 @@ describe("Compound", function () {
params: [
{
forking: {
//@ts-ignore
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
blockNumber: 13300000,
},