mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Merge pull request #139 from Instadapp/typescript-support
Scripts upgrades
This commit is contained in:
commit
de02783dd1
|
@ -11,7 +11,8 @@
|
||||||
"deploy": "node scripts/deployConnectorsFromCmd.js",
|
"deploy": "node scripts/deployConnectorsFromCmd.js",
|
||||||
"test:runner": "hardhat run scripts/tests/run-tests.ts",
|
"test:runner": "hardhat run scripts/tests/run-tests.ts",
|
||||||
"typechain": "hardhat typechain",
|
"typechain": "hardhat typechain",
|
||||||
"compile": "hardhat compile"
|
"compile": "hardhat compile",
|
||||||
|
"deploy:runner": "hardhat run scripts/deployment/deployConnectorsFromCmd.ts"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
0
scripts/constant/deployAddress.ts
Normal file
0
scripts/constant/deployAddress.ts
Normal file
53
scripts/deployment/connectors.ts
Normal file
53
scripts/deployment/connectors.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
export const connectMapping: Record<string, any> = {
|
||||||
|
mainnet: {
|
||||||
|
"1INCH-A": "ConnectV2OneInch",
|
||||||
|
"1INCH-B": "ConnectV2OneProto",
|
||||||
|
"AAVE-V1-A": "ConnectV2AaveV1",
|
||||||
|
"AAVE-V2-A": "ConnectV2AaveV2",
|
||||||
|
"AUTHORITY-A": "ConnectV2Auth",
|
||||||
|
"BASIC-A": "ConnectV2Basic",
|
||||||
|
"COMP-A": "ConnectV2COMP",
|
||||||
|
"COMPOUND-A": "ConnectV2Compound",
|
||||||
|
"DYDX-A": "ConnectV2Dydx",
|
||||||
|
"FEE-A": "ConnectV2Fee",
|
||||||
|
"GELATO-A": "ConnectV2Gelato",
|
||||||
|
"MAKERDAO-A": "ConnectV2Maker",
|
||||||
|
"UNISWAP-A": "ConnectV2UniswapV2",
|
||||||
|
},
|
||||||
|
polygon: {
|
||||||
|
"QUICKSWAP-A": "ConnectV2Paraswap",
|
||||||
|
"UniswapV3-v1": "ConnectV2UniswapV3Polygon",
|
||||||
|
"Uniswap-V3-Staker-v1.1": "ConnectV2UniswapV3StakerPolygon",
|
||||||
|
"Paraswap-v5": "ConnectV2ParaswapV5Polygon",
|
||||||
|
"1INCH-V4": "ConnectV2OneInchV4Polygon",
|
||||||
|
},
|
||||||
|
avalanche: {
|
||||||
|
"ZEROEX-A": "ConnectV2ZeroExAvalanche",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const connectors: Record<string, Array<string>> = {
|
||||||
|
mainnet: [
|
||||||
|
"1INCH-A",
|
||||||
|
"1INCH-B",
|
||||||
|
"AAVE-V1-A",
|
||||||
|
"AAVE-V2-A",
|
||||||
|
"AUTHORITY-A",
|
||||||
|
"BASIC-A",
|
||||||
|
"COMP-A",
|
||||||
|
"COMPOUND-A",
|
||||||
|
"DYDX-A",
|
||||||
|
"FEE-A",
|
||||||
|
"GELATO-A",
|
||||||
|
"MAKERDAO-A",
|
||||||
|
"UNISWAP-A",
|
||||||
|
],
|
||||||
|
polygon: [
|
||||||
|
"QUICKSWAP-A",
|
||||||
|
"UniswapV3-v1",
|
||||||
|
"Uniswap-V3-Staker-v1.1",
|
||||||
|
"Paraswap-v5",
|
||||||
|
"1INCH-V4",
|
||||||
|
],
|
||||||
|
avalanche: ["ZEROEX-A"],
|
||||||
|
};
|
|
@ -1,35 +1,17 @@
|
||||||
import { ethers } from "hardhat";
|
import { ethers } from "hardhat";
|
||||||
import { deployConnector } from "./deployConnector";
|
import { deployConnector } from "./deployConnector";
|
||||||
|
import { connectMapping } from "./connectors";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const accounts = await ethers.getSigners();
|
if (process.env.connectorName) {
|
||||||
|
await deployConnector();
|
||||||
|
} else {
|
||||||
|
const addressMapping: Record<string, string> = {};
|
||||||
|
|
||||||
const connectMapping: Record<string, string> = {
|
for (const key in connectMapping) {
|
||||||
"1INCH-A": "ConnectV2OneInch",
|
addressMapping[key] = await deployConnector(connectMapping[key]);
|
||||||
"1INCH-B": "ConnectV2OneProto",
|
}
|
||||||
"AAVE-V1-A": "ConnectV2AaveV1",
|
console.log(addressMapping);
|
||||||
"AAVE-V2-A": "ConnectV2AaveV2",
|
|
||||||
"AUTHORITY-A": "ConnectV2Auth",
|
|
||||||
"BASIC-A": "ConnectV2Basic",
|
|
||||||
"COMP-A": "ConnectV2COMP",
|
|
||||||
"COMPOUND-A": "ConnectV2Compound",
|
|
||||||
"DYDX-A": "ConnectV2Dydx",
|
|
||||||
"FEE-A": "ConnectV2Fee",
|
|
||||||
"GELATO-A": "ConnectV2Gelato",
|
|
||||||
"MAKERDAO-A": "ConnectV2Maker",
|
|
||||||
"UNISWAP-A": "ConnectV2UniswapV2",
|
|
||||||
"QUICKSWAP-A": "ConnectV2QuickswapPolygon",
|
|
||||||
"UniswapV3-v1" : "ConnectV2UniswapV3Polygon",
|
|
||||||
"Uniswap-V3-Staker-v1.1" : "ConnectV2UniswapV3StakerPolygon",
|
|
||||||
"Paraswap-v5" : "ConnectV2ParaswapV5Polygon",
|
|
||||||
"1INCH-V4" : "ConnectV2OneInchV4Polygon",
|
|
||||||
"ZEROEX-A": "ConnectV2ZeroExAvalanche",
|
|
||||||
};
|
|
||||||
|
|
||||||
const addressMapping: Record<string, string> = {};
|
|
||||||
|
|
||||||
for (const key in connectMapping) {
|
|
||||||
addressMapping[key] = await deployConnector(connectMapping[key]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,36 @@
|
||||||
import hre, { ethers } from "hardhat";
|
import hre, { ethers } from "hardhat";
|
||||||
|
|
||||||
export const deployConnector = async (connectorName: string) => {
|
import { execScript } from "../tests/command";
|
||||||
|
export const deployConnector = async (connectorName?: string) => {
|
||||||
|
connectorName = String(process.env.connectorName) ?? connectorName;
|
||||||
const Connector = await ethers.getContractFactory(connectorName);
|
const Connector = await ethers.getContractFactory(connectorName);
|
||||||
const connector = await Connector.deploy();
|
const connector = await Connector.deploy();
|
||||||
await connector.deployed();
|
await connector.deployed();
|
||||||
|
|
||||||
console.log(`${connectorName} Deployed: ${connector.address}`);
|
console.log(`${connectorName} Deployed: ${connector.address}`);
|
||||||
|
|
||||||
try {
|
const chain = String(hre.network.name);
|
||||||
await hre.run("verify:verify", {
|
if (chain !== "hardhat") {
|
||||||
address: connector.address,
|
try {
|
||||||
constructorArguments: [],
|
await execScript({
|
||||||
});
|
cmd: "npx",
|
||||||
} catch (error) {
|
args: [
|
||||||
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
"hardhat",
|
||||||
console.log(error);
|
"verify",
|
||||||
console.log();
|
"--network",
|
||||||
|
`${chain}`,
|
||||||
|
`${connector.address}`,
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
networkType: chain,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
||||||
|
console.log(error);
|
||||||
|
console.log();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return connector.address;
|
return connector.address;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,108 +1,95 @@
|
||||||
import fs from "fs";
|
import { execScript } from "../tests/command";
|
||||||
import hre from "hardhat"
|
import inquirer from "inquirer";
|
||||||
const { ethers, network, config } = hre;
|
import { connectors, connectMapping } from "./connectors";
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
let args = process.argv;
|
let start: number, end: number, runchain: string;
|
||||||
args = args.splice(2, args.length);
|
|
||||||
let params: Record<string, string> = {};
|
|
||||||
|
|
||||||
for (let i = 0; i < args.length; i += 2) {
|
// async function connectorSelect(chain: string) {
|
||||||
if (args[i][0] !== "-" || args[i][1] !== "-") {
|
// let { connector } = await inquirer.prompt([
|
||||||
console.log("Please add '--' for the key");
|
// {
|
||||||
process.exit(-1);
|
// name: "connector",
|
||||||
}
|
// message: "Which connector do you want to deploy?",
|
||||||
let key = args[i].slice(2, args[i].length);
|
// type: "list",
|
||||||
params[key] = args[i + 1];
|
// choices: connectors[chain],
|
||||||
}
|
// },
|
||||||
|
// ]);
|
||||||
|
|
||||||
if (!params.hasOwnProperty("connector")) {
|
// return connector;
|
||||||
console.error("Should include connector params");
|
// }
|
||||||
process.exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!params.hasOwnProperty("network")) {
|
async function deployRunner() {
|
||||||
console.error("Should include network params");
|
let { chain } = await inquirer.prompt([
|
||||||
process.exit(-1);
|
{
|
||||||
}
|
name: "chain",
|
||||||
|
message: "What chain do you want to deploy on?",
|
||||||
|
type: "list",
|
||||||
|
choices: ["mainnet", "polygon", "avalanche", "arbitrum"],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
if (!params.hasOwnProperty("gasPrice")) {
|
// let connector = await connectorSelect(chain);
|
||||||
console.error("Should include gas params");
|
|
||||||
process.exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
let privateKey = String(process.env.PRIVATE_KEY);
|
// let { choice } = await inquirer.prompt([
|
||||||
let provider = new ethers.providers.JsonRpcProvider(
|
// {
|
||||||
config.networks[params["network"]].url
|
// name: "choice",
|
||||||
);
|
// message: "Do you wanna select again?",
|
||||||
let wallet = new ethers.Wallet(privateKey, provider);
|
// type: "list",
|
||||||
|
// choices: ["yes", "no"],
|
||||||
|
// },
|
||||||
|
// ]);
|
||||||
|
|
||||||
network.name = params["networkName"];
|
// if (choice === "yes") {
|
||||||
network.config = config.networks[params["networkName"]];
|
// connector = await connectorSelect(chain);
|
||||||
network.provider = provider;
|
// }
|
||||||
let contracts: (string | string[])[] = [];
|
// connector = connectMapping[chain][connector];
|
||||||
|
|
||||||
const parseFile = async (filePath: fs.PathOrFileDescriptor) => {
|
let { connector } = await inquirer.prompt([
|
||||||
const data = fs.readFileSync(filePath, "utf-8");
|
{
|
||||||
let parsedData = data.split("contract ");
|
name: "connector",
|
||||||
parsedData = parsedData[parsedData.length - 1].split(" ");
|
message: "Enter the connector contract name? (ex: ConnectV2Paraswap)",
|
||||||
return parsedData[0];
|
type: "input",
|
||||||
};
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
const parseDir = async (root: string | any[], basePath: string, addPath: string) => {
|
let { choice } = await inquirer.prompt([
|
||||||
for (let i = 0; i < root.length; i++) {
|
{
|
||||||
addPath = "/" + root[i];
|
name: "choice",
|
||||||
const dir = fs.readdirSync(basePath + addPath);
|
message: "Do you wanna try deploy on hardhat first?",
|
||||||
if (dir.indexOf("main.sol") !== -1) {
|
type: "list",
|
||||||
const fileData = await parseFile(basePath + addPath + "/main.sol");
|
choices: ["yes", "no"],
|
||||||
contracts.push(fileData);
|
},
|
||||||
} else {
|
]);
|
||||||
await parseDir(dir, basePath + addPath, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const main = async () => {
|
runchain = choice === "yes" ? "hardhat" : chain;
|
||||||
const mainnet = fs.readdirSync("./contracts/mainnet/connectors/");
|
|
||||||
const polygon = fs.readdirSync("./contracts/polygon/connectors/");
|
|
||||||
let basePathMainnet = "./contracts/mainnet/connectors/";
|
|
||||||
let basePathPolygon = "./contracts/polygon/connectors/";
|
|
||||||
|
|
||||||
const connectorName = params["connector"];
|
console.log(
|
||||||
|
`Deploying ${connector} on ${runchain}, press (ctrl + c) to stop`
|
||||||
|
);
|
||||||
|
|
||||||
await parseDir(mainnet, basePathMainnet, "");
|
start = Date.now();
|
||||||
await parseDir(polygon, basePathPolygon, "");
|
await execScript({
|
||||||
|
cmd: "npx",
|
||||||
if (contracts.indexOf(connectorName) === -1) {
|
args: [
|
||||||
throw new Error(
|
"hardhat",
|
||||||
"can not find the connector!\n" +
|
"run",
|
||||||
"supported connector names are:\n" +
|
"scripts/deployment/deploy.ts",
|
||||||
contracts.join("\n")
|
"--network",
|
||||||
);
|
`${runchain}`,
|
||||||
}
|
],
|
||||||
|
env: {
|
||||||
const Connector = await ethers.getContractFactory(connectorName);
|
connectorName: connector,
|
||||||
const connector = await Connector.connect(wallet).deploy({
|
networkType: chain,
|
||||||
gasPrice: ethers.utils.parseUnits(params["gasPrice"], "gwei"),
|
},
|
||||||
});
|
});
|
||||||
await connector.deployed();
|
end = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`${connectorName} Deployed: ${connector.address}`);
|
deployRunner()
|
||||||
try {
|
|
||||||
await hre.run("verify:verify", {
|
|
||||||
address: connector.address,
|
|
||||||
constructorArguments: [],
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return connector.address;
|
|
||||||
};
|
|
||||||
|
|
||||||
main()
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("Done successfully");
|
console.log(
|
||||||
|
`Done successfully, total time taken: ${(end - start) / 1000} sec`
|
||||||
|
);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -1,79 +1,31 @@
|
||||||
import { Provider } from "@ethersproject/abstract-provider";
|
import { ethers } from "hardhat";
|
||||||
import { Signer } from "@ethersproject/abstract-signer";
|
|
||||||
import { ethers, network } from "hardhat";
|
|
||||||
import { impersonateAccounts } from "./impersonate";
|
import { impersonateAccounts } from "./impersonate";
|
||||||
|
import { tokenMapping as mainnetMapping } from "./mainnet/tokens";
|
||||||
|
import { tokenMapping as polygonMapping } from "./polygon/tokens";
|
||||||
|
import { tokenMapping as avalancheMapping } from "./avalanche/tokens";
|
||||||
|
|
||||||
const mineTx = async (tx: any) => {
|
const mineTx = async (tx: any) => {
|
||||||
await (await tx).wait();
|
await (await tx).wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
const tokenMapping: Record<string, any> = {
|
const tokenMapping: Record<string, Record<string, any>> = {
|
||||||
usdc: {
|
mainnet: mainnetMapping,
|
||||||
impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a",
|
polygon: polygonMapping,
|
||||||
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
avalanche: avalancheMapping,
|
||||||
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: "0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503",
|
|
||||||
abi: ["function transfer(address to, uint value)"],
|
|
||||||
address: "0x6b175474e89094c44da98b954eedeac495271d0f",
|
|
||||||
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));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
usdt: {
|
|
||||||
impersonateSigner: "0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828",
|
|
||||||
address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
||||||
abi: [
|
|
||||||
"function issue(uint amount)",
|
|
||||||
"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.issue(amt));
|
|
||||||
await mineTx(contract.transfer(address, amt));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
wbtc: {
|
|
||||||
impersonateSigner: "0xCA06411bd7a7296d7dbdd0050DFc846E95fEBEB7",
|
|
||||||
address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
|
||||||
abi: ["function mint(address _to, uint256 _amount) public returns (bool)"],
|
|
||||||
process: async function(owner: Signer | Provider, address: any, amt: any) {
|
|
||||||
const contract = new ethers.Contract(this.address, this.abi, owner);
|
|
||||||
await mineTx(contract.mint(address, 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));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function addLiquidity(tokenName: string, address: any, amt: any) {
|
export async function addLiquidity(tokenName: string, address: any, amt: any) {
|
||||||
const [signer] = await ethers.getSigners();
|
const [signer] = await ethers.getSigners();
|
||||||
tokenName = tokenName.toLowerCase();
|
tokenName = tokenName.toLowerCase();
|
||||||
if (!tokenMapping[tokenName]) {
|
const chain = String(process.env.networkType);
|
||||||
|
if (!tokenMapping[chain][tokenName]) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Add liquidity doesn't support the following token: ${tokenName}`
|
`Add liquidity doesn't support the following token: ${tokenName}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = tokenMapping[tokenName];
|
const token = tokenMapping[chain][tokenName];
|
||||||
|
|
||||||
const [impersonatedSigner] = await impersonateAccounts([
|
const [impersonatedSigner] = await impersonateAccounts([
|
||||||
token.impersonateSigner,
|
token.impersonateSigner,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
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 = {
|
export const tokens = {
|
||||||
eth: {
|
eth: {
|
||||||
type: "token",
|
type: "token",
|
||||||
|
@ -21,3 +29,59 @@ export const tokens = {
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const tokenMapping: Record<string, any> = {
|
||||||
|
usdc: {
|
||||||
|
impersonateSigner: "0xc5ed2333f8a2c351fca35e5ebadb2a82f5d254c3",
|
||||||
|
address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664",
|
||||||
|
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: "0xed2a7edd7413021d440b09d654f3b87712abab66",
|
||||||
|
address: "0xd586e7f844cea2f87f50152665bcbc2c279d8d70",
|
||||||
|
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));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
usdt: {
|
||||||
|
impersonateSigner: "0xc5ed2333f8a2c351fca35e5ebadb2a82f5d254c3",
|
||||||
|
address: "0xc7198437980c041c805a1edcba50c1ce5db95118",
|
||||||
|
abi: [
|
||||||
|
"function issue(uint amount)",
|
||||||
|
"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.issue(amt));
|
||||||
|
await mineTx(contract.transfer(address, amt));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
wbtc: {
|
||||||
|
impersonateSigner: "0x63cdb19c13497383726ad6bbf7c6b6cf725a3164",
|
||||||
|
address: "0x50b7545627a5162f82a992c33b87adc75187b218",
|
||||||
|
abi: ["function mint(address _to, uint256 _amount) public returns (bool)"],
|
||||||
|
process: async function (owner: Signer | Provider, address: any, amt: any) {
|
||||||
|
const contract = new ethers.Contract(this.address, this.abi, owner);
|
||||||
|
await mineTx(contract.mint(address, 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));
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
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 = {
|
export const tokens = {
|
||||||
eth: {
|
eth: {
|
||||||
type: "token",
|
type: "token",
|
||||||
|
@ -21,3 +29,59 @@ export const tokens = {
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const tokenMapping: Record<string, any> = {
|
||||||
|
usdc: {
|
||||||
|
impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a",
|
||||||
|
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
||||||
|
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: "0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503",
|
||||||
|
abi: ["function transfer(address to, uint value)"],
|
||||||
|
address: "0x6b175474e89094c44da98b954eedeac495271d0f",
|
||||||
|
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));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
usdt: {
|
||||||
|
impersonateSigner: "0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828",
|
||||||
|
address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
||||||
|
abi: [
|
||||||
|
"function issue(uint amount)",
|
||||||
|
"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.issue(amt));
|
||||||
|
await mineTx(contract.transfer(address, amt));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
wbtc: {
|
||||||
|
impersonateSigner: "0xCA06411bd7a7296d7dbdd0050DFc846E95fEBEB7",
|
||||||
|
address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
||||||
|
abi: ["function mint(address _to, uint256 _amount) public returns (bool)"],
|
||||||
|
process: async function (owner: Signer | Provider, address: any, amt: any) {
|
||||||
|
const contract = new ethers.Contract(this.address, this.abi, owner);
|
||||||
|
await mineTx(contract.mint(address, 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));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
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 = {
|
export const tokens = {
|
||||||
matic: {
|
matic: {
|
||||||
type: "token",
|
type: "token",
|
||||||
|
@ -10,7 +18,7 @@ export const tokens = {
|
||||||
type: "token",
|
type: "token",
|
||||||
symbol: "ETH",
|
symbol: "ETH",
|
||||||
name: "Ethereum",
|
name: "Ethereum",
|
||||||
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
|
||||||
decimals: 18,
|
decimals: 18,
|
||||||
},
|
},
|
||||||
dai: {
|
dai: {
|
||||||
|
@ -28,3 +36,59 @@ export const tokens = {
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const tokenMapping: Record<string, any> = {
|
||||||
|
usdc: {
|
||||||
|
impersonateSigner: "0x6e7a5fafcec6bb1e78bae2a1f0b612012bf14827",
|
||||||
|
address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
||||||
|
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: "0x4a35582a710e1f4b2030a3f826da20bfb6703c09",
|
||||||
|
address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
|
||||||
|
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));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
usdt: {
|
||||||
|
impersonateSigner: "0x0d0707963952f2fba59dd06f2b425ace40b492fe",
|
||||||
|
address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
||||||
|
abi: [
|
||||||
|
"function issue(uint amount)",
|
||||||
|
"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.issue(amt));
|
||||||
|
await mineTx(contract.transfer(address, amt));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
wbtc: {
|
||||||
|
impersonateSigner: "0xdc9232e2df177d7a12fdff6ecbab114e2231198d",
|
||||||
|
address: "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
|
||||||
|
abi: ["function mint(address _to, uint256 _amount) public returns (bool)"],
|
||||||
|
process: async function (owner: Signer | Provider, address: any, amt: any) {
|
||||||
|
const contract = new ethers.Contract(this.address, this.abi, owner);
|
||||||
|
await mineTx(contract.mint(address, amt));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inst: {
|
||||||
|
impersonateSigner: "0xf1f22f25f748f79263d44735198e023b72806ab1",
|
||||||
|
address: "0xf50d05a1402d0adafa880d36050736f9f6ee7dee",
|
||||||
|
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));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user