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

View File

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

View File

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

View File

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