From 656e1313f02391ef39e69bdc17252948d45cba1a Mon Sep 17 00:00:00 2001 From: Ahmed Ihsan Tawfeeq Date: Wed, 23 Aug 2023 15:00:24 -0600 Subject: [PATCH] build: upgrade package version to 1.1.1 fix: bug regarding "tx.wait(1)" never resolving when Flashbots provider is used refactor: rename "helpers" to "utils" build: fix issue re building Docker image on macOS docs: update README.md --- Dockerfile | 2 +- README.md | 2 +- deployment.yaml | 2 +- package.json | 2 +- src/index.ts | 2 +- src/strategies/base.ts | 2 +- src/strategies/uniswap-v2/index.ts | 4 ++-- src/strategies/uniswap-v3/index.ts | 2 +- src/{helpers.ts => utils.ts} | 0 9 files changed, 9 insertions(+), 9 deletions(-) rename src/{helpers.ts => utils.ts} (100%) diff --git a/Dockerfile b/Dockerfile index 66b9dcb..8c7d899 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-slim AS base +FROM --platform=linux/amd64 node:16-slim AS base LABEL author="scorpion9979 " WORKDIR /liquidator diff --git a/README.md b/README.md index d34b32a..938528c 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ $ docker-compose up ### Using Kubernetes ```bash -$ kubectl create configmap hifi-liquidator-js-config-map --from-literal=network-name=homestead --from-literal=persistence=true --from-literal=selected-account=0 --from-literal=silent-mode=false --from-literal=selected-strategy=uniswap-v3 +$ kubectl create configmap hifi-liquidator-js-config-map --from-literal=network-name=homestead --from-literal=persistence-enabled=true --from-literal=selected-account=0 --from-literal=selected-strategy=uniswap-v3 $ kubectl create secret generic hifi-liquidator-js-secret --from-literal=alchemy-key="" --from-literal=infura-key="" --from-literal=wallet-seed="" $ kubectl apply -f persistentvolumeclaim.yaml $ kubectl apply -f deployment.yaml diff --git a/deployment.yaml b/deployment.yaml index 1b5f9c5..bc06f2f 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -59,7 +59,7 @@ spec: secretKeyRef: name: hifi-liquidator-js-secret key: wallet-seed - image: us-west3-docker.pkg.dev/liquidation-bots/hifi/hifi-liquidator-js:1.1.0 + image: us-west3-docker.pkg.dev/liquidation-bots/hifi/hifi-liquidator-js:1.1.1 name: hifi-liquidator-js resources: limits: diff --git a/package.json b/package.json index 8d57a58..1e9a6ba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hifi/liquidator-js", "description": "Utility for automatically liquidating underwater accounts in Hifi", - "version": "1.1.0", + "version": "1.1.1", "author": { "name": "Hifi", "email": "contact@hifi.finance", diff --git a/src/index.ts b/src/index.ts index 11e9a60..e2f77fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ -import { getFlashbotsURL, isTrueString } from "./helpers"; import * as networkConfig from "./network-config.json"; import { Strategy as UniswapV2Strategy } from "./strategies/uniswap-v2"; import { Strategy as UniswapV3Strategy } from "./strategies/uniswap-v3"; import { NetworkName, StrategyName } from "./types"; +import { getFlashbotsURL, isTrueString } from "./utils"; import { Wallet, providers, utils } from "ethers"; require("dotenv").config(); diff --git a/src/strategies/base.ts b/src/strategies/base.ts index 12174ee..b17d49e 100644 --- a/src/strategies/base.ts +++ b/src/strategies/base.ts @@ -1,6 +1,6 @@ import { DUST_EPSILON, HTOKENS, LAST_SYNCED_BLOCK, VAULTS } from "../constants"; -import { Logger, batchQueryFilter, initCache } from "../helpers"; import { StrategyArgs, Cache, Htokens, NetworkConfig, Vault, Vaults, StrategyName } from "../types"; +import { Logger, batchQueryFilter, initCache } from "../utils"; import { IBalanceSheetV2 } from "@hifi/protocol/dist/types/contracts/core/balance-sheet/IBalanceSheetV2"; import { IHToken } from "@hifi/protocol/dist/types/contracts/core/h-token/IHToken"; import { BalanceSheetV2__factory } from "@hifi/protocol/dist/types/factories/contracts/core/balance-sheet/BalanceSheetV2__factory"; diff --git a/src/strategies/uniswap-v2/index.ts b/src/strategies/uniswap-v2/index.ts index 36bc9f9..ebc883e 100644 --- a/src/strategies/uniswap-v2/index.ts +++ b/src/strategies/uniswap-v2/index.ts @@ -1,6 +1,6 @@ import { UNISWAP_V2_INIT_CODE_HASH } from "../../constants"; -import { addressesAreEqual, getUniswapV2PairInfo } from "../../helpers"; import { StrategyArgs } from "../../types"; +import { addressesAreEqual, getUniswapV2PairInfo } from "../../utils"; import { BaseStrategy } from "../base"; import { MinInt256 } from "@ethersproject/constants"; import { IUniswapV2Pair } from "@hifi/flash-swap/dist/types/contracts/uniswap-v2/IUniswapV2Pair"; @@ -58,7 +58,7 @@ export class Strategy extends BaseStrategy { const gasLimit = await contract.estimateGas.swap(...swapArgs); const gasPrice = await contract.provider.getGasPrice(); const tx = await contract.swap(...swapArgs, { gasLimit, gasPrice }); - const receipt = await tx.wait(1); + const receipt = await this.provider.waitForTransaction(tx.hash, 1, 600_000); return receipt; } } diff --git a/src/strategies/uniswap-v3/index.ts b/src/strategies/uniswap-v3/index.ts index 4e5a803..d7ca59c 100644 --- a/src/strategies/uniswap-v3/index.ts +++ b/src/strategies/uniswap-v3/index.ts @@ -49,7 +49,7 @@ export class Strategy extends BaseStrategy { const gasLimit = await this.flashUniswapV3.estimateGas.flashLiquidate(flashLiquidateArgs); const gasPrice = await this.flashUniswapV3.provider.getGasPrice(); const tx = await this.flashUniswapV3.flashLiquidate(flashLiquidateArgs, { gasLimit, gasPrice }); - const receipt = await tx.wait(1); + const receipt = await this.provider.waitForTransaction(tx.hash, 1, 600_000); return receipt; } } diff --git a/src/helpers.ts b/src/utils.ts similarity index 100% rename from src/helpers.ts rename to src/utils.ts