Skip to content

Commit

Permalink
adds enabled to morpho rate hook (#1546)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackburrus authored Oct 8, 2024
1 parent f83a584 commit fbae40f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/hyperdrive-trading/src/ui/rewards/useMorphoRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ const marketPoolIds: Record<Address, string> = {
export function useMorphoRate({
chainId,
hyperdriveAddress,
enabled = true,
}: {
chainId: number;
hyperdriveAddress: Address;
enabled?: boolean;
}): {
morphoRate: FixedPoint | undefined;
} {
Expand All @@ -29,6 +31,7 @@ export function useMorphoRate({
Error
>({
queryKey: ["morphoRate", chainId, hyperdriveAddress],
enabled,
staleTime: Infinity,
retry: 3,
queryFn: async () => {
Expand Down
4 changes: 4 additions & 0 deletions apps/hyperdrive-trading/src/ui/rewards/useRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export function useRewards(hyperdrive: HyperdriveConfig): Reward[] | undefined {
const { morphoRate } = useMorphoRate({
chainId: hyperdrive.chainId,
hyperdriveAddress: hyperdrive.address,
enabled:
eligibleMarketsForMorphoRewards[hyperdrive.chainId]?.includes(
hyperdrive.address,
) ?? false,
});

const rewards = [];
Expand Down

0 comments on commit fbae40f

Please sign in to comment.