Skip to content

Commit

Permalink
fix rewards issue for arbitrum (#341)
Browse files Browse the repository at this point in the history
* fix rewards issue for arbitrum

* pretty fix

---------

Co-authored-by: Fred Snax <[email protected]>
  • Loading branch information
noisekit and fredsnax authored Jun 27, 2024
1 parent 0525f06 commit a1fbe8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
13 changes: 2 additions & 11 deletions liquidity/lib/useRewards/useRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ export function useRewards(
const { data: CoreProxy } = useCoreProxy(customNetwork);

return useQuery({
enabled: Boolean(
CoreProxy && Multicall3 && distributors && poolId && collateralAddress && accountId
),
enabled: Boolean(CoreProxy && Multicall3 && distributors && poolId && accountId),
queryKey: [
`${targetNetwork?.id}-${targetNetwork?.preset}`,
'Rewards',
Expand All @@ -79,14 +77,7 @@ export function useRewards(
{ distributors: distributors?.map(({ id }) => id).sort() },
],
queryFn: async () => {
if (
!Multicall3 ||
!CoreProxy ||
!poolId ||
!collateralAddress ||
!accountId ||
!distributors
) {
if (!Multicall3 || !CoreProxy || !poolId || !accountId || !distributors) {
throw 'useRewards is missing required data';
}

Expand Down
5 changes: 1 addition & 4 deletions liquidity/ui/src/pages/Pool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ export const Pool = () => {
.flat()
?.filter((item, pos, self) => self.findIndex((d) => d.id === item.id) === pos);

const collateralTypes = poolInfo?.map((info) => info.collateral_type);

const network = NETWORKS.find((n) => n.id === Number(networkId));

const { isLoading: isRewardsLoading, data: rewardsData } = useRewards(
registeredDistributors,
poolId,
// TODO: Update this to support other collateral types
collateralTypes?.[0]?.id,
undefined,
accountId || '69',
network
);
Expand Down

0 comments on commit a1fbe8a

Please sign in to comment.