Skip to content

Commit

Permalink
fix: keep position which still have reward
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Aug 15, 2023
1 parent 814c39e commit 1c61980
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/state/farms/elasticv2/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ export const useElasticFarmsV2 = () => {

export const useUserFarmV2Info = (farmAddress: string, fId: number): UserFarmV2Info[] => {
const { userInfo } = useElasticFarmsV2()
console.log(userInfo)
return useMemo(
() =>
userInfo?.filter(
item => item.fId === fId && item.farmAddress === farmAddress && item.liquidity.toString() !== '0',
item =>
item.fId === fId &&
item.farmAddress === farmAddress &&
(item.liquidity.toString() !== '0' ? true : item.unclaimedRewards.some(item => item.greaterThan('0'))),
) || [],
[fId, userInfo, farmAddress],
)
Expand Down

0 comments on commit 1c61980

Please sign in to comment.