Skip to content

Commit

Permalink
Merge pull request #123 from zikriya/feature/fiber-engine-node-optimi…
Browse files Browse the repository at this point in the history
…zation

gas values with out gasLimit is sending from swap and withdraw
  • Loading branch information
zikriya committed Oct 30, 2023
2 parents 6af583b + 7358a04 commit 6c3cafb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
27 changes: 19 additions & 8 deletions app/lib/crons/getGasEstimationJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
6 changes: 3 additions & 3 deletions scripts/fiberEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
},
};

0 comments on commit 6c3cafb

Please sign in to comment.