mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
minor script fixes
This commit is contained in:
parent
270a3f79b9
commit
74b0eccec0
|
@ -24,8 +24,8 @@ async function deployRunner() {
|
|||
name: "chain",
|
||||
message: "What chain do you want to deploy on?",
|
||||
type: "list",
|
||||
choices: ["mainnet", "polygon", "avalanche", "arbitrum"],
|
||||
},
|
||||
choices: ["mainnet", "polygon", "avalanche", "arbitrum", "optimism"]
|
||||
}
|
||||
]);
|
||||
|
||||
// let connector = await connectorSelect(chain);
|
||||
|
@ -48,8 +48,8 @@ async function deployRunner() {
|
|||
{
|
||||
name: "connector",
|
||||
message: "Enter the connector contract name? (ex: ConnectV2Paraswap)",
|
||||
type: "input",
|
||||
},
|
||||
type: "input"
|
||||
}
|
||||
]);
|
||||
|
||||
let { choice } = await inquirer.prompt([
|
||||
|
@ -57,39 +57,29 @@ async function deployRunner() {
|
|||
name: "choice",
|
||||
message: "Do you wanna try deploy on hardhat first?",
|
||||
type: "list",
|
||||
choices: ["yes", "no"],
|
||||
},
|
||||
choices: ["yes", "no"]
|
||||
}
|
||||
]);
|
||||
|
||||
runchain = choice === "yes" ? "hardhat" : chain;
|
||||
|
||||
console.log(
|
||||
`Deploying ${connector} on ${runchain}, press (ctrl + c) to stop`
|
||||
);
|
||||
console.log(`Deploying ${connector} on ${runchain}, press (ctrl + c) to stop`);
|
||||
|
||||
start = Date.now();
|
||||
await execScript({
|
||||
cmd: "npx",
|
||||
args: [
|
||||
"hardhat",
|
||||
"run",
|
||||
"scripts/deployment/deploy.ts",
|
||||
"--network",
|
||||
`${runchain}`,
|
||||
],
|
||||
args: ["hardhat", "run", "scripts/deployment/deploy.ts", "--network", `${runchain}`],
|
||||
env: {
|
||||
connectorName: connector,
|
||||
networkType: chain,
|
||||
},
|
||||
networkType: chain
|
||||
}
|
||||
});
|
||||
end = Date.now();
|
||||
}
|
||||
|
||||
deployRunner()
|
||||
.then(() => {
|
||||
console.log(
|
||||
`Done successfully, total time taken: ${(end - start) / 1000} sec`
|
||||
);
|
||||
console.log(`Done successfully, total time taken: ${(end - start) / 1000} sec`);
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ethers } from "hardhat";
|
||||
import { ethers, network } from "hardhat";
|
||||
|
||||
import { impersonateAccounts } from "./impersonate";
|
||||
import { tokenMapping as mainnetMapping } from "./mainnet/tokens";
|
||||
|
@ -12,7 +12,7 @@ const mineTx = async (tx: any) => {
|
|||
const tokenMapping: Record<string, Record<string, any>> = {
|
||||
mainnet: mainnetMapping,
|
||||
polygon: polygonMapping,
|
||||
avalanche: avalancheMapping,
|
||||
avalanche: avalancheMapping
|
||||
};
|
||||
|
||||
export async function addLiquidity(tokenName: string, address: any, amt: any) {
|
||||
|
@ -20,20 +20,16 @@ export async function addLiquidity(tokenName: string, address: any, amt: any) {
|
|||
tokenName = tokenName.toLowerCase();
|
||||
const chain = String(process.env.networkType);
|
||||
if (!tokenMapping[chain][tokenName]) {
|
||||
throw new Error(
|
||||
`Add liquidity doesn't support the following token: ${tokenName}`
|
||||
);
|
||||
throw new Error(`Add liquidity doesn't support the following token: ${tokenName}`);
|
||||
}
|
||||
|
||||
const token = tokenMapping[chain][tokenName];
|
||||
const [impersonatedSigner] = await impersonateAccounts([
|
||||
token.impersonateSigner,
|
||||
]);
|
||||
const [impersonatedSigner] = await impersonateAccounts([token.impersonateSigner]);
|
||||
|
||||
// send 2 eth to cover any tx costs.
|
||||
await network.provider.send("hardhat_setBalance", [
|
||||
impersonatedSigner.address,
|
||||
ethers.utils.parseEther("2").toHexString(),
|
||||
ethers.utils.parseEther("2").toHexString()
|
||||
]);
|
||||
|
||||
await token.process(impersonatedSigner, address, amt);
|
||||
|
|
Loading…
Reference in New Issue
Block a user