Fixed inRange logic

This commit is contained in:
Tornado Contrib 2024-04-12 03:56:50 +00:00
parent 98b709bd75
commit f73536740f
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1

@ -96,8 +96,8 @@ async function updateOracle() {
const currentMaxFee = parseInt(`${gasData.maxFee}`); const currentMaxFee = parseInt(`${gasData.maxFee}`);
const currentPriorityFee = parseInt(`${gasData.maxPriorityFee}`); const currentPriorityFee = parseInt(`${gasData.maxPriorityFee}`);
const isInRange = currentPriorityFee * Number(derivationThresold) / 100 <= Number(pastGasPrice) const isInRange = Number(pastGasPrice) * (100 - Number(derivationThresold)) / 100 <= currentPriorityFee
&& currentPriorityFee * (100 + Number(derivationThresold)) / 100 >= Number(pastGasPrice); && Number(pastGasPrice) * (100 + Number(derivationThresold)) / 100 >= currentPriorityFee;
const isOutdated = Number(timestamp) <= (Date.now() / 1000) - Number(heartbeat) + (UPDATE_INTERVAL * 2); const isOutdated = Number(timestamp) <= (Date.now() / 1000) - Number(heartbeat) + (UPDATE_INTERVAL * 2);