Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
13d7d2c9
Unverified
Commit
13d7d2c9
authored
Jul 19, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(swap): double max gas for quoting a v3 swap for large trades
parent
02cf33e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
useBestV3Trade.ts
src/hooks/useBestV3Trade.ts
+4
-2
No files found.
src/hooks/useBestV3Trade.ts
View file @
13d7d2c9
...
@@ -21,6 +21,8 @@ const QUOTE_GAS_OVERRIDES: { [chainId: number]: number } = {
...
@@ -21,6 +21,8 @@ const QUOTE_GAS_OVERRIDES: { [chainId: number]: number } = {
[
SupportedChainId
.
OPTIMISTIC_KOVAN
]:
6
_000_000
,
[
SupportedChainId
.
OPTIMISTIC_KOVAN
]:
6
_000_000
,
}
}
const
DEFAULT_GAS_QUOTE
=
2
_000_000
/**
/**
* Returns the best v3 trade for a desired exact input swap
* Returns the best v3 trade for a desired exact input swap
* @param amountIn the amount to swap in
* @param amountIn the amount to swap in
...
@@ -42,7 +44,7 @@ export function useBestV3TradeExactIn(
...
@@ -42,7 +44,7 @@ export function useBestV3TradeExactIn(
},
[
amountIn
,
routes
])
},
[
amountIn
,
routes
])
const
quotesResults
=
useSingleContractMultipleData
(
quoter
,
'
quoteExactInput
'
,
quoteExactInInputs
,
{
const
quotesResults
=
useSingleContractMultipleData
(
quoter
,
'
quoteExactInput
'
,
quoteExactInInputs
,
{
gasRequired
:
chainId
?
QUOTE_GAS_OVERRIDES
[
chainId
]
??
1
_000_000
:
undefined
,
gasRequired
:
chainId
?
QUOTE_GAS_OVERRIDES
[
chainId
]
??
DEFAULT_GAS_QUOTE
:
undefined
,
})
})
return
useMemo
(()
=>
{
return
useMemo
(()
=>
{
...
@@ -126,7 +128,7 @@ export function useBestV3TradeExactOut(
...
@@ -126,7 +128,7 @@ export function useBestV3TradeExactOut(
},
[
amountOut
,
routes
])
},
[
amountOut
,
routes
])
const
quotesResults
=
useSingleContractMultipleData
(
quoter
,
'
quoteExactOutput
'
,
quoteExactOutInputs
,
{
const
quotesResults
=
useSingleContractMultipleData
(
quoter
,
'
quoteExactOutput
'
,
quoteExactOutInputs
,
{
gasRequired
:
chainId
?
QUOTE_GAS_OVERRIDES
[
chainId
]
??
1
_000_000
:
undefined
,
gasRequired
:
chainId
?
QUOTE_GAS_OVERRIDES
[
chainId
]
??
DEFAULT_GAS_QUOTE
:
undefined
,
})
})
return
useMemo
(()
=>
{
return
useMemo
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment