remove price multiplication for reward estimation

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-11-16 18:36:35 +03:00
parent 2cc5695aae
commit 582b22aded
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 13 additions and 12 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.8.21",
"version": "0.8.22",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -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 }) => {
/>
<Metric
metric={formatCurrency(currentTwapPrice(10n ** BigInt(nativeMetadata.decimals)), 2)}
metric={formatCurrency(currentTwapPrice(10n ** BigInt(nativeMetadata.decimals)).mul(ftsoPrice), 2)}
label="Execution Price"
tooltip="some description to be added"
/>