updated scripts

This commit is contained in:
pradyuman-verma 2021-12-11 01:14:04 +05:30 committed by Ishan Jain
parent ec124db7a1
commit 6e7381056f
25 changed files with 83 additions and 78 deletions

View File

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

View File

@ -1,4 +1,4 @@
export default {
export const addresses: Record<string, any> = {
connectors: {
// basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7",
// auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D",

View File

@ -1,4 +1,4 @@
export default {
export const addresses: Record<string, any> = {
connectors: {
// basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7",
// auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D",

View File

@ -1,14 +1,16 @@
import { ethers } from "hardhat";
import { addresses as addressesPolygon } from "./polygon/addresses";
import { addresses as addressesArbitrum } from "./arbitrum/addresses";
import { addresses as addressesAvalanche } from "./avalanche/addresses";
import { addresses } from "./mainnet/addresses";
import abis from "../constant/abis";
import { abis } from "../constant/abis";
import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json";
function getAddress(network: string | undefined) {
if (network === "polygon") return addressesPolygon.core.instaIndex;
else if (network === "arbitrum") return addressesPolygon.core.instaIndex;
else if (network === "avalanche") return addressesPolygon.core.instaIndex;
else if (network === "arbitrum") return addressesArbitrum.core.instaIndex;
else if (network === "avalanche") return addressesAvalanche.core.instaIndex;
else return addresses.core.instaIndex;
}

View File

@ -1,6 +1,6 @@
import { addresses as addressesPolygon } from "./polygon/addresses";
import { addresses } from "./mainnet/addresses";
import abis from "../constant/abis";
import { abis } from "../constant/abis";
import hre from "hardhat";
import type { Signer, Contract } from "ethers";

View File

@ -1,5 +1,5 @@
import { web3 } from "hardhat";
import abis from "../constant/abis";
import { abis } from "../constant/abis";
export function encodeSpells(spells: any[]) {
const targets = spells.map((a) => a.connector);

View File

@ -1,12 +1,14 @@
import { ethers, network } from "hardhat";
import { addresses } from "./mainnet/addresses";
import { addresses as addressesPolygon } from "./polygon/addresses";
import abis from "../constant/abis";
import { addresses as addressesArbitrum } from "./arbitrum/addresses";
import { addresses as addressesAvalanche } from "./avalanche/addresses";
import { abis } from "../constant/abis";
function getAddress(network: string | undefined) {
if (network === "polygon") return addressesPolygon.core.instaIndex;
// else if (network === "arbitrum") return addressesPolygon.core.instaIndex;
// else if (network === "avalanche") return addressesPolygon.core.instaIndex;
else if (network === "arbitrum") return addressesArbitrum.core.instaIndex;
else if (network === "avalanche") return addressesAvalanche.core.instaIndex;
else return addresses.core.instaIndex;
}
@ -18,15 +20,16 @@ export async function getMasterSigner() {
wallet3
);
const masterAddress = await instaIndex.master(); // TODO: make it constant?
const masterAddress = await instaIndex.master();
await network.provider.request({
method: "hardhat_impersonateAccount",
params: [masterAddress],
});
await wallet3.sendTransaction({
to: masterAddress,
value: ethers.utils.parseEther("10"),
});
await network.provider.send("hardhat_setBalance", [
masterAddress,
"0x8ac7230489e80000", // 1e19 wei
]);
return await ethers.getSigner(masterAddress);
}

View File

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

View File

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

View File

@ -10,7 +10,7 @@ const WETH_ADDR = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
describe("Uniswap-sell-beta", function () {
let UniswapSellBeta, uniswapSellBeta: Contract;
async function setBalance(address: any) {
async function setBalance(address: string) {
await hre.network.provider.send("hardhat_setBalance", [
address,
ethers.utils.parseEther("10.0").toHexString(),

View File

@ -1,7 +1,7 @@
import hre from "hardhat";
import { expect } from "chai";
import abis from "../../../scripts/constant/abis";
import addresses from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
@ -17,8 +17,8 @@ import type { Signer, Contract } from "ethers";
describe("Aave V1", function () {
const connectorName = "AAVEV1-TEST-A";
let wallet0: any, wallet1: any;
let dsaWallet0: any;
let wallet0: Signer, wallet1: Signer;
let dsaWallet0: Contract;
let instaConnectorsV2: Contract;
let connector: any;
let masterSigner: Signer;
@ -63,7 +63,7 @@ describe("Aave V1", function () {
describe("DSA wallet setup", function () {
it("Should build DSA v2", async function () {
dsaWallet0 = await buildDSAv2(wallet0.address);
dsaWallet0 = await buildDSAv2(wallet0.getAddress());
expect(!!dsaWallet0.address).to.be.true;
});
@ -91,7 +91,7 @@ describe("Aave V1", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
@ -122,7 +122,7 @@ describe("Aave V1", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("9")
@ -140,7 +140,7 @@ describe("Aave V1", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("0")
@ -158,7 +158,7 @@ describe("Aave V1", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
ethers.utils.parseEther("10")

View File

@ -1,7 +1,7 @@
import { expect } from "chai";
import hre from "hardhat";
import abis from "../../../scripts/constant/abis";
import addresses from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
@ -18,7 +18,7 @@ describe("Aave V2", function () {
const connectorName = "AAVEV2-TEST-A";
let connector: any;
let wallet0: any, wallet1:any;
let wallet0: Signer, wallet1:Signer;
let dsaWallet0: any;
let instaConnectorsV2: Contract;
let masterSigner: Signer;
@ -58,7 +58,7 @@ describe("Aave V2", function () {
describe("DSA wallet setup", function () {
it("Should build DSA v2", async function () {
dsaWallet0 = await buildDSAv2(wallet0.address);
dsaWallet0 = await buildDSAv2(wallet0.getAddress());
expect(!!dsaWallet0.address).to.be.true;
});
@ -86,7 +86,7 @@ describe("Aave V2", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
@ -113,7 +113,7 @@ describe("Aave V2", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("9")
@ -139,7 +139,7 @@ describe("Aave V2", function () {
let tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("9")
@ -155,7 +155,7 @@ describe("Aave V2", function () {
tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("9")
@ -173,7 +173,7 @@ describe("Aave V2", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
ethers.utils.parseEther("0")
@ -191,7 +191,7 @@ describe("Aave V2", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
ethers.utils.parseEther("10")
@ -216,7 +216,7 @@ describe("Aave V2", function () {
const tx = await dsaWallet0
.connect(wallet0)
.cast(...encodeSpells(spells), wallet1.address);
.cast(...encodeSpells(spells), wallet1.getAddress());
await tx.wait();
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
ethers.utils.parseEther("10")

View File

@ -7,8 +7,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { constants } from "../../../scripts/constant/constant";
import { ConnectV2BCompound__factory } from "../../../typechain";
import type { Signer, Contract } from "ethers";

View File

@ -7,10 +7,10 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import abis from "../../../scripts/constant/abis";
import { abis } from "../../../scripts/constant/abis";
import { ConnectV2BLiquity__factory } from "../../../typechain";
import type { Signer, Contract } from "ethers";
import addresses from "../../../scripts/tests/mainnet/addresses";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool
const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598"
@ -19,15 +19,15 @@ describe("B.Liquity", function () {
const connectorName = "B.LIQUITY-TEST-A"
let dsaWallet0: any;
let dsaWallet1: any
let dsaWallet1: any;
let masterSigner: Signer;
let instaConnectorsV2: Contract;
let connector: any;
let manager: any;
let vat: any;
let lusd: any;
let bammToken: any;
let stabilityPool: any;
let connector: Contract;
let manager: Contract;
let vat: Contract;
let lusd: Contract;
let bammToken: Contract;
let stabilityPool: Contract;
const wallets = provider.getWallets()
const [wallet0, wallet1, wallet2, wallet3] = wallets

View File

@ -7,8 +7,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { tokens } from "../../../scripts/tests/mainnet/tokens";
import { ConnectV2BMakerDAO__factory } from "../../../typechain";
import type { Signer, Contract } from "ethers";

View File

@ -8,8 +8,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses"
import abis from "../../../scripts/constant/abis"
import { addresses } from "../../../scripts/tests/mainnet/addresses"
import { abis } from "../../../scripts/constant/abis"
import type { Signer, Contract } from "ethers";
import { ConnectV2BasicERC1155__factory, IERC1155__factory } from "../../../typechain";
@ -26,8 +26,8 @@ describe("BASIC-ERC1155", function () {
let dsaWallet0: any;
let masterSigner: Signer;
let instaConnectorsV2: Contract;
let connector: any;
let nftContract: any;
let connector: Contract;
let nftContract: Contract;
let tokenOwner: any;
let instaImplementationsMapping: any;
let InstaAccountV2DefaultImpl: any;

View File

@ -8,8 +8,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses"
import abis from "../../../scripts/constant/abis"
import { addresses } from "../../../scripts/tests/mainnet/addresses"
import { abis } from "../../../scripts/constant/abis"
import type { Signer, Contract } from "ethers";
import { ConnectV2BasicERC721__factory, IERC721__factory } from "../../../typechain";

View File

@ -9,8 +9,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { constants } from "../../../scripts/constant/constant";
import { ConnectV2Compound__factory } from "../../../typechain";

View File

@ -9,8 +9,8 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import type { Signer, Contract } from "ethers";
import { ConnectV2Compound__factory } from "../../../typechain";

View File

@ -8,9 +8,9 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"
import { encodeSpells } from "../../../scripts/tests/encodeSpells"
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"
// Instadapp instadappAddresses/ABIs
import instadappAddresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
// Instadapp addresses/ABIs
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
// Instadapp Liquity Connector artifacts
import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain";
@ -138,7 +138,7 @@ const deployAndConnect = async (contracts: any, isDebug = false) => {
const masterSigner = await getMasterSigner();
const instaConnectorsV2 = await ethers.getContractAt(
abis.core.connectorsV2,
instadappAddresses.core.connectorsV2
addresses.core.connectorsV2
);
const connector = await deployAndEnableConnector({
connectorName: LIQUITY_CONNECTOR,

View File

@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { constants } from "../../../scripts/constant/constant";
import { tokens } from "../../../scripts/tests/mainnet/tokens";
import type { Signer, Contract } from "ethers";

View File

@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import { addLiquidity } from "../../../scripts/tests/addLiquidity";
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import type { Signer, Contract } from "ethers";
import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json";

View File

@ -9,8 +9,8 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import { addLiquidity } from "../../../scripts/tests/addLiquidity";
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"
import type { Signer, Contract } from "ethers";

View File

@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import addresses from "../../../scripts/tests/mainnet/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/mainnet/addresses";
import { abis } from "../../../scripts/constant/abis";
import { tokens } from "../../../scripts/tests/mainnet/tokens";
import { Signer, Contract, BigNumber } from "ethers";

View File

@ -10,8 +10,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
import addresses from "../../../scripts/tests/polygon/addresses";
import abis from "../../../scripts/constant/abis";
import { addresses } from "../../../scripts/tests/polygon/addresses";
import { abis } from "../../../scripts/constant/abis";
import { tokens } from "../../../scripts/tests/polygon/tokens";
import type { Signer, Contract } from "ethers";