fantom test support

This commit is contained in:
Richa-iitr 2022-06-15 20:56:46 +05:30
parent 3cc14fadce
commit e8ee380321
7 changed files with 85 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { tokenMapping as polygonMapping } from "./polygon/tokens";
import { tokenMapping as avalancheMapping } from "./avalanche/tokens";
import { tokenMapping as optimismMapping } from "./optimism/tokens";
import { tokenMapping as arbitrumMapping } from "./arbitrum/tokens";
import { tokenMapping as fantomMapping } from "./fantom/tokens";
const mineTx = async (tx: any) => {
await (await tx).wait();
@ -16,7 +17,8 @@ const tokenMapping: Record<string, Record<string, any>> = {
polygon: polygonMapping,
avalanche: avalancheMapping,
optimism: optimismMapping,
arbitrum: arbitrumMapping
arbitrum: arbitrumMapping,
fantom: fantomMapping
};
export async function addLiquidity(tokenName: string, address: any, amt: any) {

View File

@ -4,6 +4,7 @@ import { addresses as addressesPolygon } from "./polygon/addresses";
import { addresses as addressesArbitrum } from "./arbitrum/addresses";
import { addresses as addressesAvalanche } from "./avalanche/addresses";
import { addresses as addressesOptimism } from "./optimism/addresses";
import { addresses as addressesFantom } from "./fantom/addresses";
import { addresses } from "./mainnet/addresses";
import { abis } from "../constant/abis";
import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json";
@ -13,6 +14,7 @@ function getAddress(network: string | undefined) {
else if (network === "arbitrum") return addressesArbitrum.core.instaIndex;
else if (network === "avalanche") return addressesAvalanche.core.instaIndex;
else if (network === "optimism") return addressesOptimism.core.instaIndex;
else if (network === "fantom") return addressesFantom.core.instaIndex;
else return addresses.core.instaIndex;
}

View File

@ -4,6 +4,7 @@ import { abis } from "../constant/abis";
import { addresses as addressesArbitrum } from "./arbitrum/addresses";
import { addresses as addressesAvalanche } from "./avalanche/addresses";
import { addresses as addressesOptimism } from "./optimism/addresses";
import { addresses as addressesFantom } from "./fantom/addresses";
import hre from "hardhat";
import type { Signer, Contract } from "ethers";
@ -24,6 +25,7 @@ function getAddress(network: string | undefined) {
else if (network === "arbitrum") return addressesArbitrum;
else if (network === "avalanche") return addressesAvalanche;
else if (network === "optimism") return addressesOptimism;
else if (network === "fantom") return addressesFantom;
else return addresses;
}

View File

@ -0,0 +1,11 @@
export const addresses: Record<string, any> = {
connectors: {
// basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7",
// auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D",
// "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b",
},
core: {
connectorsV2: "0x819910794a030403F69247E1e5C0bBfF1593B968",
instaIndex: "0x2fa042BEEB7A40A7078EaA5aC755e3842248292b",
},
};

View File

@ -0,0 +1,64 @@
import { Provider } from "@ethersproject/abstract-provider";
import { Signer } from "@ethersproject/abstract-signer";
import { ethers } from "hardhat";
const mineTx = async (tx: any) => {
await (await tx).wait();
};
export const tokens = {
ftm: {
type: "token",
symbol: "FTM",
name: "Fantom",
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
decimals: 18,
},
dai: {
type: "token",
symbol: "DAI",
name: "DAI Stable",
address: "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E",
decimals: 18,
},
usdc: {
type: "token",
symbol: "USDC",
name: "USD Coin",
address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",
decimals: 6,
},
};
export const tokenMapping: Record<string, any> = {
usdc: {
impersonateSigner: "0x4188663a85C92EEa35b5AD3AA5cA7CeB237C6fe9",
address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",
abi: [
"function mint(address _to, uint256 _amount) external returns (bool);",
],
process: async function (owner: Signer | Provider, to: any, amt: any) {
const contract = new ethers.Contract(this.address, this.abi, owner);
await mineTx(contract.mint(to, amt));
},
},
dai: {
impersonateSigner: "0x9bdB521a97E95177BF252C253E256A60C3e14447",
address: "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E",
abi: ["function transfer(address to, uint value)"],
process: async function (owner: Signer | Provider, to: any, amt: any) {
const contract = new ethers.Contract(this.address, this.abi, owner);
await mineTx(contract.transfer(to, amt));
},
},
// inst: {
// impersonateSigner: "0x75e89d5979E4f6Fba9F97c104c2F0AFB3F1dcB88",
// address: "0x6f40d4a6237c257fff2db00fa0510deeecd303eb",
// abi: ["function transfer(address to, uint value)"],
// process: async function (owner: Signer | Provider, address: any, amt: any) {
// const contract = new ethers.Contract(this.address, this.abi, owner);
// await mineTx(contract.transfer(address, amt));
// },
// },
};

View File

@ -4,6 +4,7 @@ import { addresses as addressesPolygon } from "./polygon/addresses";
import { addresses as addressesArbitrum } from "./arbitrum/addresses";
import { addresses as addressesAvalanche } from "./avalanche/addresses";
import { addresses as addressesOptimism } from "./optimism/addresses";
import { addresses as addressesFantom } from "./fantom/addresses";
import { abis } from "../constant/abis";
function getAddress(network: string | undefined) {
@ -11,6 +12,7 @@ function getAddress(network: string | undefined) {
else if (network === "arbitrum") return addressesArbitrum.core.instaIndex;
else if (network === "avalanche") return addressesAvalanche.core.instaIndex;
else if (network === "optimism") return addressesOptimism.core.instaIndex;
else if (network === "fantom") return addressesFantom.core.instaIndex;
else return addresses.core.instaIndex;
}

View File

@ -12,7 +12,7 @@ async function testRunner() {
name: "chain",
message: "What chain do you want to run tests on?",
type: "list",
choices: ["mainnet", "polygon", "avalanche", "arbitrum", "optimism"],
choices: ["mainnet", "polygon", "avalanche", "arbitrum", "optimism", "fantom"],
},
]);
const testsPath = join(__dirname, "../../test", chain);