-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7da13e
commit d0e5c8b
Showing
5 changed files
with
300 additions
and
320 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use client' | ||
|
||
// Hooks to be used on debug pages or for general debugging | ||
|
||
import { permit2Abi } from '@balancer/sdk' | ||
import { getNetworkConfig, getGqlChain } from '@repo/lib/config/app.config' | ||
import { Address } from 'viem' | ||
import { useReadContract } from 'wagmi' | ||
|
||
type Params = { | ||
chainId: number | ||
tokenAddress: Address | ||
owner: Address | ||
} | ||
|
||
export function useDebugPermit2Allowance({ chainId, tokenAddress, owner }: Params) { | ||
const permit2Address = '0x000000000022D473030F116dDEE9F6B43aC78BA3' | ||
const balancerRouter = getNetworkConfig(getGqlChain(chainId)).contracts.balancer.router! | ||
const spender = balancerRouter | ||
|
||
return useReadContract({ | ||
chainId, | ||
address: permit2Address, | ||
abi: permit2Abi, | ||
functionName: 'allowance', | ||
args: [owner, tokenAddress, spender], | ||
query: { | ||
enabled: !!tokenAddress && !!owner, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.