From f73536740f30a6cdc47cb2c09c3152e568c50e93 Mon Sep 17 00:00:00 2001 From: Tornado Contrib Date: Fri, 12 Apr 2024 03:56:50 +0000 Subject: [PATCH] Fixed inRange logic --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 56bab4d..e3de1de 100644 --- a/src/index.ts +++ b/src/index.ts @@ -96,8 +96,8 @@ async function updateOracle() { const currentMaxFee = parseInt(`${gasData.maxFee}`); const currentPriorityFee = parseInt(`${gasData.maxPriorityFee}`); - const isInRange = currentPriorityFee * Number(derivationThresold) / 100 <= Number(pastGasPrice) - && currentPriorityFee * (100 + Number(derivationThresold)) / 100 >= Number(pastGasPrice); + const isInRange = Number(pastGasPrice) * (100 - Number(derivationThresold)) / 100 <= currentPriorityFee + && Number(pastGasPrice) * (100 + Number(derivationThresold)) / 100 >= currentPriorityFee; const isOutdated = Number(timestamp) <= (Date.now() / 1000) - Number(heartbeat) + (UPDATE_INTERVAL * 2);