mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
removed errors
This commit is contained in:
parent
65f3d3f9ac
commit
6f14a93e8a
|
@ -1,4 +1,4 @@
|
||||||
export const addresses = {
|
export const addresses: Record<string, any> = {
|
||||||
connectors: {
|
connectors: {
|
||||||
basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
|
basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
|
||||||
auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",
|
auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { deployConnector } from "./deployConnector";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const accounts = await ethers.getSigners();
|
const accounts = await ethers.getSigners();
|
||||||
const wallet = accounts[0];
|
|
||||||
|
|
||||||
const connectMapping: Record<string, string> = {
|
const connectMapping: Record<string, string> = {
|
||||||
"1INCH-A": "ConnectV2OneInch",
|
"1INCH-A": "ConnectV2OneInch",
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import * as fs from "fs";
|
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;
|
let args = process.argv;
|
||||||
args = args.splice(2, args.length);
|
args = args.splice(2, args.length);
|
||||||
let params = {};
|
let params: Record<string, string> = {};
|
||||||
|
|
||||||
for (let i = 0; i < args.length; i += 2) {
|
for (let i = 0; i < args.length; i += 2) {
|
||||||
if (args[i][0] !== "-" || args[i][1] !== "-") {
|
if (args[i][0] !== "-" || args[i][1] !== "-") {
|
||||||
|
@ -38,17 +39,16 @@ let wallet = new ethers.Wallet(privateKey, provider);
|
||||||
network.name = params["networkName"];
|
network.name = params["networkName"];
|
||||||
network.config = config.networks[params["networkName"]];
|
network.config = config.networks[params["networkName"]];
|
||||||
network.provider = provider;
|
network.provider = provider;
|
||||||
let contracts = [];
|
let contracts: (string | string[])[] = [];
|
||||||
|
|
||||||
const parseFile = async (filePath: fs.PathOrFileDescriptor) => {
|
const parseFile = async (filePath: fs.PathOrFileDescriptor) => {
|
||||||
const data = fs.readFileSync(filePath, "utf-8");
|
const data = fs.readFileSync(filePath, "utf-8");
|
||||||
let parsedData = data.split("contract ");
|
let parsedData = data.split("contract ");
|
||||||
parsedData = parsedData[parsedData.length - 1].split(" ");
|
parsedData = parsedData[parsedData.length - 1].split(" ");
|
||||||
parsedData = parsedData[0];
|
return parsedData[0];
|
||||||
return parsedData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const parseDir = async (root, basePath, addPath) => {
|
const parseDir = async (root: string | any[], basePath: string, addPath: string) => {
|
||||||
for (let i = 0; i < root.length; i++) {
|
for (let i = 0; i < root.length; i++) {
|
||||||
addPath = "/" + root[i];
|
addPath = "/" + root[i];
|
||||||
const dir = fs.readdirSync(basePath + addPath);
|
const dir = fs.readdirSync(basePath + addPath);
|
||||||
|
|
|
@ -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);
|
|
||||||
});
|
|
|
@ -7,7 +7,7 @@ const mineTx = async (tx: any) => {
|
||||||
await (await tx).wait();
|
await (await tx).wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
const tokenMapping = {
|
const tokenMapping: Record<string, any> = {
|
||||||
usdc: {
|
usdc: {
|
||||||
impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a",
|
impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a",
|
||||||
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { ethers } from "hardhat";
|
import { ethers } from "hardhat";
|
||||||
|
|
||||||
const network = String(process.env.networkType);
|
|
||||||
|
|
||||||
import { addresses as addressesPolygon } from "./polygon/addresses";
|
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";
|
||||||
|
|
|
@ -6,12 +6,9 @@ import hre from "hardhat";
|
||||||
import type { Signer, Contract } from "ethers";
|
import type { Signer, Contract } from "ethers";
|
||||||
import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON";
|
import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON";
|
||||||
|
|
||||||
|
|
||||||
const { ethers, waffle } = hre;
|
const { ethers, waffle } = hre;
|
||||||
const { deployContract } = waffle;
|
const { deployContract } = waffle;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface DeployInterface {
|
interface DeployInterface {
|
||||||
connectorName: string;
|
connectorName: string;
|
||||||
contractArtifact: ContractJSON;
|
contractArtifact: ContractJSON;
|
||||||
|
@ -19,7 +16,6 @@ interface DeployInterface {
|
||||||
connectors: Contract;
|
connectors: Contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getAddress(network: string | undefined) {
|
function getAddress(network: string | undefined) {
|
||||||
if (network === "polygon") return addressesPolygon;
|
if (network === "polygon") return addressesPolygon;
|
||||||
// else if (network === "arbitrum") return addressesPolygon;
|
// else if (network === "arbitrum") return addressesPolygon;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as hre from "hardhat";
|
import hre from "hardhat";
|
||||||
const { web3 } = hre;
|
const { web3 } = hre;
|
||||||
|
|
||||||
import { encodeSpells } from "./encodeSpells.js";
|
import { encodeSpells } from "./encodeSpells.js";
|
||||||
|
|
|
@ -38,7 +38,7 @@ async function setStatus(context, state, description) {
|
||||||
|
|
||||||
// Run in parallel
|
// Run in parallel
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
checks.map(async (check) => {
|
checks.map(async (check: { name: any; callback: any }) => {
|
||||||
const { name, callback } = check;
|
const { name, callback } = check;
|
||||||
|
|
||||||
await setStatus(name, "pending", "Running check..");
|
await setStatus(name, "pending", "Running check..");
|
||||||
|
|
|
@ -12,27 +12,29 @@ import { tokens } from "../../../scripts/constant/tokens";
|
||||||
import { constants } from "../../../scripts/constant/constant";
|
import { constants } from "../../../scripts/constant/constant";
|
||||||
import { addLiquidity } from "../../../scripts/tests/addLiquidity";
|
import { addLiquidity } from "../../../scripts/tests/addLiquidity";
|
||||||
const { ethers } = hre;
|
const { ethers } = hre;
|
||||||
|
import type { Signer, Contract } from "ethers";
|
||||||
|
|
||||||
describe("Aave V2", function () {
|
describe("Aave V2", function () {
|
||||||
const connectorName = "AAVEV2-TEST-A";
|
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 dsaWallet0: any;
|
||||||
let instaConnectorsV2: { address: any; };
|
let instaConnectorsV2: Contract;
|
||||||
let masterSigner: { address: any; };
|
let masterSigner: Signer;
|
||||||
before(async () => {
|
before(async () => {
|
||||||
// await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
// method: "hardhat_reset",
|
method: "hardhat_reset",
|
||||||
// params: [
|
params: [
|
||||||
// {
|
{
|
||||||
// forking: {
|
forking: {
|
||||||
// jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
// @ts-ignore
|
||||||
// blockNumber: 12796965,
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
// },
|
blockNumber: 12796965,
|
||||||
// },
|
},
|
||||||
// ],
|
},
|
||||||
// });
|
],
|
||||||
|
});
|
||||||
[wallet0, wallet1] = await ethers.getSigners();
|
[wallet0, wallet1] = await ethers.getSigners();
|
||||||
masterSigner = await getMasterSigner();
|
masterSigner = await getMasterSigner();
|
||||||
instaConnectorsV2 = await ethers.getContractAt(
|
instaConnectorsV2 = await ethers.getContractAt(
|
||||||
|
@ -51,7 +53,7 @@ describe("Aave V2", function () {
|
||||||
it("should have contracts deployed", async () => {
|
it("should have contracts deployed", async () => {
|
||||||
expect(!!instaConnectorsV2.address).to.be.true;
|
expect(!!instaConnectorsV2.address).to.be.true;
|
||||||
expect(!!connector.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 () {
|
describe("DSA wallet setup", function () {
|
||||||
|
|
|
@ -1,27 +1,23 @@
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import hre from "hardhat";
|
import hre from "hardhat";
|
||||||
const { web3, deployments, waffle, ethers } = hre;
|
const { waffle, ethers } = hre;
|
||||||
const { provider, deployContract} = waffle
|
const { provider, deployContract} = waffle
|
||||||
|
|
||||||
import type { Signer, Contract } from "ethers";
|
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 { 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 { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
|
||||||
|
|
||||||
import { addresses } from "../../../scripts/constant/addresses";
|
import { addresses } from "../../../scripts/constant/addresses";
|
||||||
import { abis } from "../../../scripts/constant/abis";
|
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 { ConnectV2Compound__factory } from "../../../typechain";
|
||||||
|
|
||||||
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: Signer;
|
let dsaWallet0: any;
|
||||||
let masterSigner: Signer;
|
let masterSigner: Signer;
|
||||||
let instaConnectorsV2: Contract;
|
let instaConnectorsV2: Contract;
|
||||||
let connector: any;
|
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);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
connectorName,
|
connectorName,
|
||||||
contractArtifact: connectV2CompoundArtifacts,
|
contractArtifact: ConnectV2Compound__factory,
|
||||||
signer: masterSigner,
|
signer: masterSigner,
|
||||||
connectors: instaConnectorsV2
|
connectors: instaConnectorsV2
|
||||||
})
|
})
|
||||||
|
@ -55,7 +51,7 @@ describe("Compound", function () {
|
||||||
it("Should have contracts deployed.", async function () {
|
it("Should have contracts deployed.", async function () {
|
||||||
expect(!!instaConnectorsV2.address).to.be.true;
|
expect(!!instaConnectorsV2.address).to.be.true;
|
||||||
expect(!!connector.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 () {
|
describe("DSA wallet setup", function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user