Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkron committed Sep 17, 2024
1 parent 5386585 commit b509ec4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand All @@ -17,7 +17,7 @@ const prompt = (question: string): Promise<string> => new Promise(resolve => rl.
const minBalances: Record<ProxyEnum, bigint> = {
parentPoolProxy: parseEther("7"),
childPoolProxy: parseEther("1"),
infraProxy: parseEther("1"),
infraProxy: parseEther("2"),
};

async function checkChainBalance(chain: CNetwork, contractType: ProxyEnum): Promise<BalanceInfo> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit b509ec4

Please sign in to comment.