Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 17, 2024
1 parent bddf02e commit 5b5fc8d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/processOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ describe("Test cli", async function () {
"120",
"--gas-limit-multiplier",
"110",
"--tx-gas",
"123456789",
]);
const expected = {
roundGap: 10000,
Expand All @@ -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);
Expand All @@ -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);
});
});

0 comments on commit 5b5fc8d

Please sign in to comment.