mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
fixed deployConnectorFromCmd script
This commit is contained in:
parent
7f9853bb42
commit
4138b37c58
0
scripts/constant/deployAddress.ts
Normal file
0
scripts/constant/deployAddress.ts
Normal file
|
@ -1,31 +1,53 @@
|
|||
export const connectMapping: Record<string, any> = {
|
||||
"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",
|
||||
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 = [
|
||||
"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",
|
||||
];
|
||||
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,4 +1,5 @@
|
|||
import hre, { ethers } from "hardhat";
|
||||
import { execScript } from "../tests/command";
|
||||
|
||||
export const deployConnector = async (connectorName?: string) => {
|
||||
connectorName = String(process.env.connectorName) ?? connectorName;
|
||||
|
@ -8,15 +9,28 @@ export const deployConnector = async (connectorName?: string) => {
|
|||
|
||||
console.log(`${connectorName} Deployed: ${connector.address}`);
|
||||
|
||||
try {
|
||||
await hre.run("verify:verify", {
|
||||
address: connector.address,
|
||||
constructorArguments: [],
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
||||
console.log(error);
|
||||
console.log();
|
||||
const chain = String(hre.network.name);
|
||||
if (chain !== "hardhat") {
|
||||
try {
|
||||
await execScript({
|
||||
cmd: "npx",
|
||||
args: [
|
||||
"hardhat",
|
||||
"verify",
|
||||
"--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;
|
||||
};
|
||||
|
|
|
@ -5,8 +5,21 @@ import { join } from "path";
|
|||
|
||||
let start: number, end: number;
|
||||
|
||||
async function connectorSelect(chain: string) {
|
||||
let { connector } = await inquirer.prompt([
|
||||
{
|
||||
name: "connector",
|
||||
message: "Which connector do you want to deploy?",
|
||||
type: "list",
|
||||
choices: connectors[chain],
|
||||
},
|
||||
]);
|
||||
|
||||
return connector;
|
||||
}
|
||||
|
||||
async function deployRunner() {
|
||||
const { chain } = await inquirer.prompt([
|
||||
let { chain } = await inquirer.prompt([
|
||||
{
|
||||
name: "chain",
|
||||
message: "What chain do you want to deploy on?",
|
||||
|
@ -15,20 +28,47 @@ async function deployRunner() {
|
|||
},
|
||||
]);
|
||||
|
||||
let { connector } = await inquirer.prompt([
|
||||
let connector = await connectorSelect(chain);
|
||||
|
||||
let { choice } = await inquirer.prompt([
|
||||
{
|
||||
name: "connector",
|
||||
message: "Which connector do you want to deploy?",
|
||||
name: "choice",
|
||||
message: "Do you wanna select again?",
|
||||
type: "list",
|
||||
choices: connectors,
|
||||
choices: ["yes", "no"],
|
||||
},
|
||||
]);
|
||||
|
||||
connector = connectMapping[connector];
|
||||
if (choice === "yes") {
|
||||
connector = await connectorSelect(chain);
|
||||
}
|
||||
connector = connectMapping[chain][connector];
|
||||
|
||||
let { choice1 } = await inquirer.prompt([
|
||||
{
|
||||
name: "choice",
|
||||
message: "Do you wanna try deploy on hardhat first?",
|
||||
type: "list",
|
||||
choices: ["yes", "no"],
|
||||
},
|
||||
]);
|
||||
|
||||
if (choice1 === "yes") {
|
||||
chain = "hardhat";
|
||||
}
|
||||
|
||||
console.log(`Deploying ${connector} on ${chain}, press (ctrl + c) to stop`);
|
||||
|
||||
start = Date.now();
|
||||
await execScript({
|
||||
cmd: "npx",
|
||||
args: ["hardhat", "run", "scripts/deployment/deploy.ts"],
|
||||
args: [
|
||||
"hardhat",
|
||||
"run",
|
||||
"scripts/deployment/deploy.ts",
|
||||
"--network",
|
||||
`${chain}`,
|
||||
],
|
||||
env: {
|
||||
connectorName: connector,
|
||||
networkType: chain,
|
||||
|
|
Loading…
Reference in New Issue
Block a user