From 6ae89fae9cbba9394074eda21a216c8abc6842df Mon Sep 17 00:00:00 2001 From: Zikriya Date: Mon, 30 Oct 2023 13:25:34 +0500 Subject: [PATCH 1/2] gas values with out gasLimit is sending from swap and withdraw --- scripts/fiberEngine.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/fiberEngine.ts b/scripts/fiberEngine.ts index 9a4dc37..9dbac09 100644 --- a/scripts/fiberEngine.ts +++ b/scripts/fiberEngine.ts @@ -529,7 +529,8 @@ module.exports = { data.maxPriorityFeePerGas = Web3.utils.toHex( Web3.utils.toWei(maxPriorityFeePerGas, "gwei") ); - data.gasLimit = gasLimit; + + // data.gasLimit = gasLimit; } else { data.gasPrice = 15000000000; } @@ -562,11 +563,10 @@ module.exports = { data.maxPriorityFeePerGas = Web3.utils.toHex( Web3.utils.toWei(maxPriorityFeePerGas, "gwei") ); - data.gas = { gasLimit: gasLimit }; + // data.gas = { gasLimit: gasLimit }; } else { data.gas = {}; } - console.log("data", data); return data; }, }; From 7358a046ec660dd8356cdec88e9fe9c4b91cc7bd Mon Sep 17 00:00:00 2001 From: Zikriya Date: Mon, 30 Oct 2023 13:34:41 +0500 Subject: [PATCH 2/2] fetching gas estimation values for bsc from api.owlracle.info --- app/lib/crons/getGasEstimationJob.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/app/lib/crons/getGasEstimationJob.ts b/app/lib/crons/getGasEstimationJob.ts index 1761449..3fe0766 100644 --- a/app/lib/crons/getGasEstimationJob.ts +++ b/app/lib/crons/getGasEstimationJob.ts @@ -54,15 +54,26 @@ async function getGasEstimation(network: any) { async function updateGas(network: any, gasEstimation: any) { let speed = getSpeed(gasEstimation); + let body: any = {}; if (network && speed) { - let body = { - dynamicValues: { - maxFeePerGas: speed?.maxFeePerGas ? speed?.maxFeePerGas : null, - maxPriorityFeePerGas: speed?.maxPriorityFeePerGas - ? speed?.maxPriorityFeePerGas - : null, - }, - }; + if (network.chainId == 56) { + body = { + dynamicValues: { + maxFeePerGas: speed?.gasPrice ? speed?.gasPrice : null, + maxPriorityFeePerGas: speed?.gasPrice ? speed?.gasPrice : null, + }, + }; + } else { + body = { + dynamicValues: { + maxFeePerGas: speed?.maxFeePerGas ? speed?.maxFeePerGas : null, + maxPriorityFeePerGas: speed?.maxPriorityFeePerGas + ? speed?.maxPriorityFeePerGas + : null, + }, + }; + } + await db.GasFees.findOneAndUpdate({ chainId: network.chainId }, body, { new: true, });