Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
feat: multiply evm tx gas (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeychr authored Oct 20, 2023
1 parent 16efcf7 commit 1356fd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@debridge-finance/dln-taker",
"version": "2.15.6",
"version": "2.15.7",
"description": "DLN executor is the rule-based daemon service developed to automatically execute orders placed on the deSwap Liquidity Network (DLN) across supported blockchains",
"license": "GPL-3.0-only",
"author": "deBridge",
Expand Down
11 changes: 7 additions & 4 deletions src/processors/universal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import { assert } from '../errors';

// reasonable multiplier for gas price to define max gas price we are willing to
// bump until. Must cover up to 12.5% block base fee increase
const EVM_FULFILL_GAS_PRICE_MULTIPLIER = 1.125;
const EVM_FULFILL_GAS_PRICE_MULTIPLIER = 1.075;
const EVM_FULFILL_GAS_LIMIT_MULTIPLIER = 1.05;

// defines max batch_unlock size
const BATCH_UNLOCK_MAX_SIZE = 10;
Expand Down Expand Up @@ -699,6 +700,7 @@ class UniversalProcessor extends BaseOrderProcessor {
data: preliminaryEvmFulfillTx.data,
value: preliminaryEvmFulfillTx.value.toString(),
});
evmFulfillGasLimit *= EVM_FULFILL_GAS_LIMIT_MULTIPLIER;
logger.debug(
`estimated gas needed for the fulfill tx with roughly estimated reserve amount: ${evmFulfillGasLimit} gas units`,
);
Expand Down Expand Up @@ -840,9 +842,10 @@ class UniversalProcessor extends BaseOrderProcessor {
};

try {
txToSend.gasLimit = await (
this.takeChain.fulfillProvider as EvmProviderAdapter
).estimateGas(txToSend);
const gas = await (this.takeChain.fulfillProvider as EvmProviderAdapter).estimateGas(
txToSend,
);
txToSend.gasLimit = gas * EVM_FULFILL_GAS_LIMIT_MULTIPLIER;
logger.debug(`final fulfill tx gas estimation: ${txToSend.gasLimit}`);
} catch (e) {
const message = `unable to estimate fullfil tx: ${e}`;
Expand Down

0 comments on commit 1356fd1

Please sign in to comment.