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, }); 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; }, };