Skip to content

Commit

Permalink
Merge pull request #194 from HaloDAO/features/hdev-549-fix-baseAPR-in…
Browse files Browse the repository at this point in the history
…-other-chain

Fix white screenn error for not supported network for base apr
  • Loading branch information
tracyarciaga authored Apr 18, 2022
2 parents f2de500 + 479f4f5 commit 24a0cf5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/halo-hooks/useRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,18 @@ export const useRewarderUSDPrice = (rewarderAddress: string | undefined) => {
export const useGetBaseApr = (poolAddress: string, tokenPair: string): number => {
const { account, library, chainId } = useActiveWeb3React()
const [baseAPR, setBaseApr] = useState(0)
const poolsWithBaseAPR = Object.keys(DEPOSIT_TXHASH[chainId as ChainId] as Record<string, string>)

const fetchBaseUsdHlpPrice = useCallback(async () => {
consoleLog(`${tokenPair} fetchBaseUsdHlpPrice`)
// check if the network has deposit tx in DEPOSIT_TXHASH
let poolsWithBaseAPR = []
try {
poolsWithBaseAPR = Object.keys(DEPOSIT_TXHASH[chainId as ChainId] as Record<string, string>)
} catch (e) {
console.log('Network is not supported for baseAPR')
return
}

if (!library || !poolsWithBaseAPR.includes(poolAddress) || poolAddress === ethers.constants.AddressZero) return

try {
Expand Down

0 comments on commit 24a0cf5

Please sign in to comment.