From 96d7465436eecef2f8a5eebb9aefb6c77a89b92b Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Thu, 7 May 2026 21:13:43 +0300 Subject: [PATCH] no, this is final fix for the boosted apy... I belive so Signed-off-by: Uncle Fatso --- package.json | 2 +- src/hooks/staking/index.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index aba55bc..7dbe5f3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.7.42", + "version": "0.7.43", "type": "module", "scripts": { "dev": "vite", diff --git a/src/hooks/staking/index.js b/src/hooks/staking/index.js index c021bb8..c2de289 100644 --- a/src/hooks/staking/index.js +++ b/src/hooks/staking/index.js @@ -1,7 +1,13 @@ import { useReadContract } from "wagmi"; import toast from "react-hot-toast"; -import * from "../../constants/gatekeeper"; +import { + amountInHistory, + amountOutHistory, + feeIn, + feeOut, + stakeRatio +} from "../../constants/gatekeeper"; import { STAKING_ADDRESSES } from "../../constants/addresses"; import { abi as StakingAbi } from "../../abi/GhostStaking.json"; import { abi as GatekeeperAbi } from "../../abi/GhostGatekeeper.json"; @@ -39,10 +45,10 @@ export const useGatekeeperApy = (chainId) => { const feeInBig = new DecimalBigNumber((feeIn[chainId] ?? 0n), 5); const feeOutBig = new DecimalBigNumber((feeOut[chainId] ?? 0n), 5); - const stakeRatioBig = new DecimalBigNumber((stakeRatio[chainId] ?? 0n), 5); + const stakeRatioBig = new DecimalBigNumber((stakeRatio ?? 0n), 5); const numerator = amountIn.mul(feeInBig).add(amountOut.mul(feeOutBig)); - const denominator = amountIn.mul(stakeRatio).sub(amountOut.mul(stakeRatio)); + const denominator = amountIn.mul(stakeRatioBig).sub(amountOut.mul(stakeRatioBig)); let apyInner = Infinity; if ((circulatingSupply?._value ?? 0n) === 0n) {