generated from scaffold-eth/scaffold-eth
-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hide button if consolidator inactive. show button for users to migrat…
…e v1/v2 positions)
- Loading branch information
1 parent
18a7af3
commit dbea4e9
Showing
3 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/views/Lending/Cooler/hooks/useCheckConsolidatorActive.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { COOLER_CONSOLIDATION_ADDRESSES } from "src/constants/addresses"; | ||
import { useTestableNetworks } from "src/hooks/useTestableNetworks"; | ||
import { CoolerConsolidation__factory } from "src/typechain"; | ||
import { useProvider } from "wagmi"; | ||
|
||
export const useCheckConsolidatorActive = () => { | ||
const networks = useTestableNetworks(); | ||
const provider = useProvider(); | ||
|
||
return useQuery({ | ||
queryKey: ["consolidatorActive"], | ||
queryFn: async () => { | ||
const contract = CoolerConsolidation__factory.connect(COOLER_CONSOLIDATION_ADDRESSES[networks.MAINNET], provider); | ||
const isActive = await contract.isActive(); | ||
return isActive; | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters