-
Notifications
You must be signed in to change notification settings - Fork 316
feat: integrate uniswap v3 #3545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cd96e41
e9bf01d
7020343
4415fb7
6b11b1b
766a2b2
ae0b758
e375607
856aad8
1e12cf4
95d34d9
3d09cd8
d31f7bc
5c015e5
e307fca
c6afe07
4d3085a
0bd5694
a9f418e
1d534df
cdd711b
02b50f7
4611c85
7e036f0
1371d6e
78c40d6
5aa2a4f
9ce2572
0b08ae6
b55bb06
35c1346
02c50fe
59e4848
9836019
ad9c99d
c40074d
5a0e1df
8eaec50
c43de36
0dd0fe1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import PoolStateV3ABI from '@masknet/web3-contracts/abis/PoolStateV3.json' | ||
| import type { PoolStateV3 } from '@masknet/web3-contracts/types/PoolStateV3' | ||
| import { useContract, useContracts } from '@masknet/web3-shared' | ||
| import type { AbiItem } from 'web3-utils' | ||
|
|
||
| export function usePoolContract(address: string) { | ||
| return useContract<PoolStateV3>(address, PoolStateV3ABI as AbiItem[]) | ||
| } | ||
|
|
||
| export function usePoolContracts(listOfAddress: string[]) { | ||
| return useContracts<PoolStateV3>(listOfAddress, PoolStateV3ABI as AbiItem[]) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import QuoterABI from '@masknet/web3-contracts/abis/Quoter.json' | ||
| import type { Quoter } from '@masknet/web3-contracts/types/Quoter' | ||
| import { useContract, useTraderConstants } from '@masknet/web3-shared' | ||
| import type { AbiItem } from 'web3-utils' | ||
|
|
||
| export function useQuoterContract() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @guanbinrui suggest, abstract a contract hook factory method design a such factory method const useQuoterContract = makeContractHook<Quoter>({
abi: QuoterABI,
useAddress: () => useTraderConstants().UNISWAP_V3_QUOTER_ADDRESS,
})
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep it stupid and simple (KISS) first. 😄 |
||
| const { UNISWAP_V3_QUOTER_ADDRESS } = useTraderConstants() | ||
| return useContract<Quoter>(UNISWAP_V3_QUOTER_ADDRESS, QuoterABI as AbiItem[]) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.