From 3637268e97d69c6ef4eaa2469971944f7cdf59ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pr=C3=A9vost?= <998369+prevostc@users.noreply.github.com> Date: Mon, 27 May 2024 14:53:12 +0200 Subject: [PATCH] Fix mode --- src/lib/harvest-actions/harvest.ts | 2 +- src/lib/harvest-chain.ts | 4 +++- src/lib/rpc-client.ts | 12 ++++++++---- yarn.lock | 18 +++++++++--------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/lib/harvest-actions/harvest.ts b/src/lib/harvest-actions/harvest.ts index 295c39d..52e7be6 100644 --- a/src/lib/harvest-actions/harvest.ts +++ b/src/lib/harvest-actions/harvest.ts @@ -16,7 +16,7 @@ export type HarvestParameters = } | { strategyAddress: Hex; - transactionCostEstimationWei: null; + transactionCostEstimationWei: bigint | null; transactionGasLimit: null; }; diff --git a/src/lib/harvest-chain.ts b/src/lib/harvest-chain.ts index 21403cb..5b53a66 100644 --- a/src/lib/harvest-chain.ts +++ b/src/lib/harvest-chain.ts @@ -383,7 +383,9 @@ export async function harvestChain({ await reportOnMultipleHarvestAsyncCall(stratsToBeHarvested, 'transaction', 'sequential', async item => { let harvestParams: HarvestParameters = { strategyAddress: item.vault.strategyAddress, - transactionCostEstimationWei: null, + // mode fails to estimate gas because their eth_estimateGas method doesn't accept fee params + // and removing those in view is near impossible + transactionCostEstimationWei: chain === 'mode' ? item.simulation.gas.transactionCostEstimationWei : null, transactionGasLimit: null, }; diff --git a/src/lib/rpc-client.ts b/src/lib/rpc-client.ts index bc67dd3..0ba5170 100644 --- a/src/lib/rpc-client.ts +++ b/src/lib/rpc-client.ts @@ -2,7 +2,7 @@ import { createPublicClient, createWalletClient } from 'viem'; import { type Chain } from './chain'; import { privateKeyToAccount } from 'viem/accounts'; import { RPC_CONFIG } from './config'; -import { gnosis, linea, mantle, mode, type Chain as ViemChain } from 'viem/chains'; +import { type Chain as ViemChain } from 'viem/chains'; import { arbitrum, aurora, @@ -15,14 +15,18 @@ import { fantom, fraxtal, fuse, + gnosis, + harmonyOne, kava, + linea, mainnet, - harmonyOne, - polygon, + mantle, + metis, + mode, moonbeam, moonriver, - metis, optimism, + polygon, polygonZkEvm, scroll, zkSync, diff --git a/yarn.lock b/yarn.lock index fba8329..8614ff9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2407,10 +2407,10 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -isows@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" - integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== +isows@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" + integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" @@ -4752,10 +4752,10 @@ validate-npm-package-name@^5.0.0: dependencies: builtins "^5.0.0" -viem@^2.10.1: - version "2.10.1" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.10.1.tgz#0dffc8e4c7a03dd06de098931b3666b68a040964" - integrity sha512-sfbcFdzlMHSZI+4RpqidxOqPu6xwWtmqDBWSVml2XV+n21dgQFmVRN0nHhZoyMDSo4mTSKtWwW9sHHu9vUF2mw== +viem@^2.12.5: + version "2.12.5" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.12.5.tgz#b30888367c193ca3ab1bc2864a9723ac3f10ba87" + integrity sha512-OHS+356v/ykkQMWEhefDRa5aC3iM3wEzdBlPoAhkCilsXRTAyy0YofYZ9hZG8SyM+0Ltl01j5EyJHqo0o62Czg== dependencies: "@adraffy/ens-normalize" "1.10.0" "@noble/curves" "1.2.0" @@ -4763,7 +4763,7 @@ viem@^2.10.1: "@scure/bip32" "1.3.2" "@scure/bip39" "1.2.1" abitype "1.0.0" - isows "1.0.3" + isows "1.0.4" ws "8.13.0" walker@^1.0.8: