From 582b22aded02318423f19593b29b0f0d7d0fbdff Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Mon, 16 Nov 2026 18:36:35 +0300 Subject: [PATCH] remove price multiplication for reward estimation Signed-off-by: Uncle Fatso --- package.json | 2 +- src/containers/Exodus/Exodus.jsx | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 6122654..6df22ac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.8.21", + "version": "0.8.22", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Exodus/Exodus.jsx b/src/containers/Exodus/Exodus.jsx index adab1b2..c9fc06a 100644 --- a/src/containers/Exodus/Exodus.jsx +++ b/src/containers/Exodus/Exodus.jsx @@ -94,21 +94,22 @@ const Exodus = ({ chainId, address, config }) => { const currentTwapPrice = useCallback((gasUsed) => { const value = ((capturedPriceSnapshots ? capturedPriceSnapshots._value : 0n) * gasUsed) >> 112n; - return (new DecimalBigNumber(value, getTokenDecimals("FTSO"))).mul(ftsoPrice); - }, [capturedPriceSnapshots, ftsoPrice]); + return (new DecimalBigNumber(value, getTokenDecimals("FTSO"))); + }, [capturedPriceSnapshots]); const executionDiscount = useMemo(() => { const zero = new DecimalBigNumber(0n, 0); - - const twapNativeUsd = currentTwapPrice(10n ** BigInt(nativeMetadata.decimals)); - const actualGasCostPerUnit = new DecimalBigNumber(gasPrice ? gasPrice : 0n, 9); - const oneHundred = new DecimalBigNumber(100n, 0); - return currentGasPrice - .sub(actualGasCostPerUnit) + const actualGasPerUnit = new DecimalBigNumber(gasPrice ? gasPrice : 0n, 18); + + const currentGasPriceCost = currentTwapPrice(currentGasPrice._value).mul(ftsoPrice); + const actualGasPerUnitCost = actualGasPerUnit.mul(reservePrice); + + return currentGasPriceCost + .sub(actualGasPerUnitCost) .mul(oneHundred.add(zero)) - .div(currentGasPrice); - }, [currentTwapPrice, ftsoPrice, nativeMetadata, gasPrice, currentGasPrice]); + .div(currentGasPriceCost); + }, [currentTwapPrice, reservePrice, ftsoPrice, nativeMetadata, gasPrice, currentGasPrice]); const { data: activeDkgAuthorities, isLoading: activeDkgAuthoritiesLoading } = useSWR( casperApi ? ['activeDkgAuthorities', casperApi] : null, @@ -179,7 +180,7 @@ const Exodus = ({ chainId, address, config }) => { />