diff --git a/src/components/Vesting/RewardLockerSchedules.tsx b/src/components/Vesting/RewardLockerSchedules.tsx index 2fb6d44de9..fa65d6c21d 100644 --- a/src/components/Vesting/RewardLockerSchedules.tsx +++ b/src/components/Vesting/RewardLockerSchedules.tsx @@ -2,6 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber' import { Token } from '@kyberswap/ks-sdk-core' import { ZERO_ADDRESS } from 'constants/index' +import { EVMNetworkInfo } from 'constants/networks/type' import { NativeCurrencies } from 'constants/tokens' import { useActiveWeb3React } from 'hooks' import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel' @@ -28,7 +29,7 @@ const RewardLockerSchedules = ({ const dispatch = useAppDispatch() const currentBlockNumber = useBlockNumber() const currentTimestamp = Math.round(Date.now() / 1000) - const { account, chainId } = useActiveWeb3React() + const { account, chainId, networkInfo } = useActiveWeb3React() const { vestMultipleTokensAtIndices } = useVesting(rewardLockerAddress) const { mixpanelHandler } = useMixpanel() if (!schedules) { @@ -173,6 +174,8 @@ const RewardLockerSchedules = ({ return acc }, currentBlockNumber) + const blockDiff = (maxEndBlock || 0) - (currentBlockNumber || 0) + const endTimestampFromBlock = useTimestampFromBlock(maxEndBlock) const endTime = schedules.reduce((acc, cur) => { @@ -183,7 +186,7 @@ const RewardLockerSchedules = ({ } return acc - }, endTimestampFromBlock || 0) + }, endTimestampFromBlock || currentTimestamp + blockDiff * ((networkInfo as EVMNetworkInfo).averageBlockTimeInSeconds || 0)) return } diff --git a/src/components/Vesting/VestingCard.tsx b/src/components/Vesting/VestingCard.tsx index b51b06e990..20c677bc1d 100644 --- a/src/components/Vesting/VestingCard.tsx +++ b/src/components/Vesting/VestingCard.tsx @@ -17,7 +17,7 @@ import { formatDollarAmount } from 'utils/numbers' const formatRemainTime = (numberOfSeconds: number) => { if (numberOfSeconds < 0) return t`Full unlocked` const days = numberOfSeconds / 60 / 60 / 24 - if (days > 1) return days + ' Days left' + if (days > 1) return days.toFixed(2) + ' Days left' const hours = numberOfSeconds / 60 / 60 if (hours < 24 && hours > 1) return hours.toFixed(0) + ' Hours left' diff --git a/src/state/about/hooks.ts b/src/state/about/hooks.ts index efa3cc3a84..8fd83d3a85 100644 --- a/src/state/about/hooks.ts +++ b/src/state/about/hooks.ts @@ -53,7 +53,9 @@ export function useGlobalData() { } const getResultByChainIds = async (chainIds: readonly ChainId[]) => { // todo namgold: add aggregator API for solana - const elasticChains = chainIds.filter(isEVM).filter(id => !ELASTIC_NOT_SUPPORTED[id]) + const elasticChains = chainIds + .filter(id => isEVM(id)) + .filter(id => !ELASTIC_NOT_SUPPORTED[id] && id !== ChainId.LINEA_TESTNET) const elasticPromises = elasticChains.map(chain => allKyberswapConfig[chain].elasticClient.query({ @@ -70,12 +72,14 @@ export function useGlobalData() { return total + parseFloat(item?.data?.factories?.[0]?.totalValueLockedUSD || '0') }, 0) - const allChainPromises = chainIds.filter(isEVM).map(chain => - allKyberswapConfig[chain].classicClient.query({ - query: GLOBAL_DATA(), - fetchPolicy: 'cache-first', - }), - ) + const allChainPromises = chainIds + .filter(id => isEVM(id) && id !== ChainId.LINEA_TESTNET) + .map(chain => + allKyberswapConfig[chain].classicClient.query({ + query: GLOBAL_DATA(), + fetchPolicy: 'cache-first', + }), + ) const queryResult = (await Promise.all(allChainPromises.map(promises => promises.catch(e => e)))).filter( res => !(res instanceof Error),