Commit 13d7d2c9 authored by Moody Salem's avatar Moody Salem

fix(swap): double max gas for quoting a v3 swap for large trades

parent 02cf33e1
...@@ -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(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment