From b509ec4d2906591c78b36fc7c56b15a425ace2ee Mon Sep 17 00:00:00 2001 From: Oleg Kirillovich Date: Tue, 17 Sep 2024 21:38:22 +0300 Subject: [PATCH] refactoring --- .../tasks/concero/ensureBalances/ensureErc20Balances.ts | 4 ++-- .../tasks/concero/ensureBalances/viewTokenBalances.ts | 4 +--- .../tasks/concero/ensureBalances/withdrawTokens.ts | 8 +++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/hardhat/tasks/concero/ensureBalances/ensureErc20Balances.ts b/packages/hardhat/tasks/concero/ensureBalances/ensureErc20Balances.ts index 515f2c1f6..11a34206f 100644 --- a/packages/hardhat/tasks/concero/ensureBalances/ensureErc20Balances.ts +++ b/packages/hardhat/tasks/concero/ensureBalances/ensureErc20Balances.ts @@ -7,7 +7,7 @@ import { type CNetwork } from "../../../types/CNetwork"; import log, { err } from "../../../utils/log"; import readline from "readline"; import checkERC20Balance from "./checkERC20Balance"; -import { BalanceInfo } from "./types"; +import { type BalanceInfo } from "./types"; const donorAccount = privateKeyToAccount(`0x${process.env.DEPLOYER_PRIVATE_KEY}`); @@ -17,7 +17,7 @@ const prompt = (question: string): Promise => new Promise(resolve => rl. const minBalances: Record = { parentPoolProxy: parseEther("7"), childPoolProxy: parseEther("1"), - infraProxy: parseEther("1"), + infraProxy: parseEther("2"), }; async function checkChainBalance(chain: CNetwork, contractType: ProxyEnum): Promise { diff --git a/packages/hardhat/tasks/concero/ensureBalances/viewTokenBalances.ts b/packages/hardhat/tasks/concero/ensureBalances/viewTokenBalances.ts index 69ae27c94..f17212e52 100644 --- a/packages/hardhat/tasks/concero/ensureBalances/viewTokenBalances.ts +++ b/packages/hardhat/tasks/concero/ensureBalances/viewTokenBalances.ts @@ -1,10 +1,8 @@ -import { mainnetChains, testnetChains } from "../../../constants/liveChains"; +import { mainnetChains, networkEnvKeys, ProxyEnum, testnetChains } from "../../../constants"; import { err, getEnvAddress, getEnvVar, getFallbackClients } from "../../../utils"; import { task } from "hardhat/config"; import { erc20Abi, formatUnits } from "viem"; import { type CNetwork } from "../../../types/CNetwork"; -import { ProxyEnum } from "../../../constants/deploymentVariables"; -import { networkEnvKeys } from "../../../constants"; import { BalanceInfo } from "./types"; const tokensToMonitor = [ diff --git a/packages/hardhat/tasks/concero/ensureBalances/withdrawTokens.ts b/packages/hardhat/tasks/concero/ensureBalances/withdrawTokens.ts index 129cd65fe..3a5c41707 100644 --- a/packages/hardhat/tasks/concero/ensureBalances/withdrawTokens.ts +++ b/packages/hardhat/tasks/concero/ensureBalances/withdrawTokens.ts @@ -1,12 +1,14 @@ import { task } from "hardhat/config"; -import monitorTokenBalances, { BalanceInfo } from "./viewTokenBalances"; +import monitorTokenBalances from "./viewTokenBalances"; import { getEnvVar, getFallbackClients } from "../../../utils"; import cNetworks, { networkEnvKeys } from "../../../constants/cNetworks"; import { viemReceiptConfig } from "../../../constants"; import log from "../../../utils/log"; +import { formatUnits } from "viem"; +import { type BalanceInfo } from "./types"; async function withdrawTokens(isTestnet: boolean) { - const { abi } = await import("../artifacts/contracts/Orchestrator.sol/Orchestrator.json"); + const { abi } = await import("../../../artifacts/contracts/Orchestrator.sol/Orchestrator.json"); // Step 1: Get balances const balances: BalanceInfo[] = await monitorTokenBalances(isTestnet); @@ -63,7 +65,7 @@ async function withdrawTokens(isTestnet: boolean) { hash, }); - log(`Withdrawn ${balance} ${symbol}(Gas Used: ${cumulativeGasUsed})`, "withdrawToken", chain.name); + log(`Withdrawn ${formatUnits(balance, 6)} ${symbol}(Gas Used: ${cumulativeGasUsed})`, "withdrawToken", chain.name); } }