This repository was archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use multicall for argent wallets in swap and v3 add liquidity (#…
…1387) * use argent wallet contract in swap callback * maybe working swap callback * chore(v3): trigger a breaking release BREAKING CHANGE: trigger a major release for the uniswap interface to indicate it now supports swapping and liquidity provision against uniswap protocol v3 * fix the value * improve the error coverage * retry more frequently, couple more error nits * the is argent call was being sketchy * get it working for add liquidity * `0x0` for v2 swaps too * small nits in position page * fix import * fix compiler error
- Loading branch information
1 parent
99ad4ae
commit 562b402
Showing
10 changed files
with
217 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"components": [ | ||
{ | ||
"internalType": "address", | ||
"name": "to", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "value", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "data", | ||
"type": "bytes" | ||
} | ||
], | ||
"name": "_transactions", | ||
"type": "tuple[]" | ||
} | ||
], | ||
"name": "wc_multiCall", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes[]", | ||
"name": "", | ||
"type": "bytes[]" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes32", | ||
"name": "_msgHash", | ||
"type": "bytes32" | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "_signature", | ||
"type": "bytes" | ||
} | ||
], | ||
"name": "isValidSignature", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "", | ||
"type": "bytes4" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
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,15 @@ | ||
import { ArgentWalletContract } from '../abis/types' | ||
import { useActiveWeb3React } from './web3' | ||
import { useContract } from './useContract' | ||
import useIsArgentWallet from './useIsArgentWallet' | ||
import ArgentWalletContractABI from '../abis/argent-wallet-contract.json' | ||
|
||
export function useArgentWalletContract(): ArgentWalletContract | null { | ||
const { account } = useActiveWeb3React() | ||
const isArgentWallet = useIsArgentWallet() | ||
return useContract( | ||
isArgentWallet ? account ?? undefined : undefined, | ||
ArgentWalletContractABI, | ||
true | ||
) as ArgentWalletContract | ||
} |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { useMemo } from 'react' | ||
import { NEVER_RELOAD, useSingleCallResult } from '../state/multicall/hooks' | ||
import { useActiveWeb3React } from './web3' | ||
import { useArgentWalletDetectorContract } from './useContract' | ||
|
||
export default function useIsArgentWallet(): boolean { | ||
const { account } = useActiveWeb3React() | ||
const argentWalletDetector = useArgentWalletDetectorContract() | ||
const call = useSingleCallResult(argentWalletDetector, 'isArgentWallet', [account ?? undefined], NEVER_RELOAD) | ||
const inputs = useMemo(() => [account ?? undefined], [account]) | ||
const call = useSingleCallResult(argentWalletDetector, 'isArgentWallet', inputs, NEVER_RELOAD) | ||
return call?.result?.[0] ?? false | ||
} |
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
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
Oops, something went wrong.