remove price multiplication for reward estimation
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
2cc5695aae
commit
582b22aded
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.8.21",
|
||||
"version": "0.8.22",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -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"
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user