From 5b5fc8df3593b95313236108e78a6f104a10e2bb Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Sun, 17 Nov 2024 01:04:21 +0000 Subject: [PATCH] fix --- README.md | 4 ++++ example.env | 3 +++ src/index.ts | 1 + src/processOrders.ts | 3 ++- test/cli.test.js | 6 ++++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f7e163e..246416e9 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ Other optional arguments are: - `-t` or `--topup-amount`, The initial topup amount of excess wallets, requirs `--mnemonic`. Will override the 'TOPUP_AMOUNT' in env variables - `--gas-price-multiplier`, Option to multiply the gas price fetched from the rpc as percentage, default is 107, ie +7%. Will override the 'GAS_PRICE_MULTIPLIER' in env variables - `--gas-limit-multiplier`, Option to multiply the gas limit estimation from the rpc as percentage, default is 105, ie +5%. Will override the 'GAS_LIMIT_MULTIPLIER' in env variables +- `--tx-gas`, Option to set a static gas limit for all submitting txs. Will override the 'TX_GAS' in env variables - `-V` or `--version`, output the version number - `-h` or `--help`, output usage information @@ -260,6 +261,9 @@ GAS_PRICE_MULTIPLIER= # Option to multiply the gas limit estimation from the rpc as percentage, default is 105, ie +5% GAS_LIMIT_MULTIPLIER= + +# Option to set a static gas limit for all submitting txs +TX_GAS= ``` If both env variables and CLI argument are set, the CLI arguments will be prioritized and override the env variables. diff --git a/example.env b/example.env index 94fc0c01..2ff656b5 100644 --- a/example.env +++ b/example.env @@ -88,6 +88,9 @@ GAS_PRICE_MULTIPLIER= # Option to multiply the gas limit estimation from the rpc as percentage, default is 105, ie +5% GAS_LIMIT_MULTIPLIER= +# Option to set a static gas limit for all submitting txs +TX_GAS= + # test rpcs vars TEST_POLYGON_RPC= diff --git a/src/index.ts b/src/index.ts index 2e08ca27..fdccbe3c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -212,6 +212,7 @@ export async function getConfig( config.rpcRecords = rpcRecords; config.gasPriceMultiplier = options.gasPriceMultiplier; config.gasLimitMultiplier = options.gasLimitMultiplier; + config.txGas = options.txGas; // init accounts const { mainAccount, accounts } = await initAccounts(walletKey, config, options, tracer, ctx); diff --git a/src/processOrders.ts b/src/processOrders.ts index 439a3537..45c1e7c6 100644 --- a/src/processOrders.ts +++ b/src/processOrders.ts @@ -324,8 +324,9 @@ export const processOrders = async ( span.setAttribute("unsuccessfulClear", true); span.setAttribute("txSendFailed", true); } else if (e.reason === ProcessPairHaltReason.TxReverted) { - // set the severity to LOW, this can happen for example + // Tx reverted onchain, this can happen for example // because of mev front running or false positive opportunities, etc + // set the severity to LOW span.setAttribute("severity", ErrorSeverity.LOW); span.setStatus({ code: SpanStatusCode.ERROR, diff --git a/test/cli.test.js b/test/cli.test.js index 23a927fe..4e3c6293 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -187,6 +187,8 @@ describe("Test cli", async function () { "120", "--gas-limit-multiplier", "110", + "--tx-gas", + "123456789", ]); const expected = { roundGap: 10000, @@ -207,11 +209,13 @@ describe("Test cli", async function () { }, gasPriceMultiplier: 120, gasLimitMultiplier: 110, + txGas: 123456789n, }, options: { botMinBalance: "0.123", gasPriceMultiplier: 120, gasLimitMultiplier: 110, + txGas: 123456789n, }, }; await sleep(1000); @@ -227,5 +231,7 @@ describe("Test cli", async function () { assert.equal(result.config.gasPriceMultiplier, expected.config.gasPriceMultiplier); assert.equal(result.options.gasLimitMultiplier, expected.options.gasLimitMultiplier); assert.equal(result.config.gasLimitMultiplier, expected.config.gasLimitMultiplier); + assert.equal(result.options.txGas, expected.options.txGas); + assert.equal(result.config.txGas, expected.config.txGas); }); });