Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix fix getting giv price on polygon-zkevm chain #4789

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/modals/GIVdropHarvestModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const GIVdropHarvestModal: FC<IGIVdropHarvestModal> = ({
const chainId = chain?.id;
const sdh = new SubgraphDataHelper(currentValues.data);
const givTokenDistroBalance = sdh.getGIVTokenDistroBalance();
const { data: givPrice } = useFetchGIVPrice(chainId);
const { data: givPrice } = useFetchGIVPrice();

useEffect(() => {
const bnGIVback = BigInt(givTokenDistroBalance.givback);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useGivPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useQuery } from '@tanstack/react-query';
import config from '@/configuration';
import { fetchGnosisTokenPrices } from '@/services/token';

export const useFetchGIVPrice = (chainId?: number) => {
const _chainId = chainId || config.GNOSIS_NETWORK_NUMBER;
export const useFetchGIVPrice = () => {
const _chainId = config.GNOSIS_NETWORK_NUMBER;
const tokenAddress =
config.EVM_NETWORKS_CONFIG[_chainId]?.tokenAddressOnUniswapV2;
return useQuery({
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useTokenPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useTokenPrice = (token?: ITokenPrice) => {
const { walletChainType } = useGeneralWallet();
const { chain } = useAccount();
const chainId = chain?.id;
const { data: givPrice } = useFetchGIVPrice(chainId);
const { data: givPrice } = useFetchGIVPrice();
const givTokenPrice = givPrice ? new BigNumber(givPrice).toNumber() : 0;
const isMainnet = chainId === config.MAINNET_NETWORK_NUMBER;

Expand All @@ -44,8 +44,8 @@ export const useTokenPrice = (token?: ITokenPrice) => {
stableCoins.includes(token.symbol.toUpperCase()))
) {
setTokenPrice(1);
} else if (token?.symbol === 'GIV') {
setTokenPrice(givTokenPrice || 0);
} else if (token?.symbol === 'GIV' && givTokenPrice) {
setTokenPrice(givTokenPrice);
} else if (token?.coingeckoId) {
setTokenPrice(
(await fetchPriceWithCoingeckoId(token.coingeckoId)) || 0,
Expand Down
Loading