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
f66f8c4d
Unverified
Commit
f66f8c4d
authored
Aug 17, 2022
by
Vignesh Mohankumar
Committed by
GitHub
Aug 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: undo polygon auto-slippage changes (#4379)
parent
1a9c3c36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
useAutoSlippageTolerance.ts
src/hooks/useAutoSlippageTolerance.ts
+3
-9
No files found.
src/hooks/useAutoSlippageTolerance.ts
View file @
f66f8c4d
...
@@ -3,7 +3,7 @@ import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
...
@@ -3,7 +3,7 @@ import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
import
{
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
Pool
}
from
'
@uniswap/v3-sdk
'
import
{
Pool
}
from
'
@uniswap/v3-sdk
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
,
SupportedChainId
}
from
'
constants/chains
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
L2_CHAIN_IDS
}
from
'
constants/chains
'
import
{
L2_CHAIN_IDS
}
from
'
constants/chains
'
import
JSBI
from
'
jsbi
'
import
JSBI
from
'
jsbi
'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
...
@@ -68,7 +68,6 @@ function guesstimateGas(trade: Trade<Currency, Currency, TradeType> | undefined)
...
@@ -68,7 +68,6 @@ function guesstimateGas(trade: Trade<Currency, Currency, TradeType> | undefined)
}
}
const
MIN_AUTO_SLIPPAGE_TOLERANCE
=
new
Percent
(
5
,
1000
)
// 0.5%
const
MIN_AUTO_SLIPPAGE_TOLERANCE
=
new
Percent
(
5
,
1000
)
// 0.5%
const
POLYGON_MIN_AUTO_SLIPPAGE_TOLERANCE
=
new
Percent
(
1
,
100
)
// 1%
const
MAX_AUTO_SLIPPAGE_TOLERANCE
=
new
Percent
(
25
,
100
)
// 25%
const
MAX_AUTO_SLIPPAGE_TOLERANCE
=
new
Percent
(
25
,
100
)
// 25%
/**
/**
...
@@ -115,13 +114,8 @@ export default function useAutoSlippageTolerance(
...
@@ -115,13 +114,8 @@ export default function useAutoSlippageTolerance(
return
MAX_AUTO_SLIPPAGE_TOLERANCE
return
MAX_AUTO_SLIPPAGE_TOLERANCE
}
}
// TODO(vm): Added because ~30% of Polygon swaps were failing due to exceeding slippage.
if
(
result
.
lessThan
(
MIN_AUTO_SLIPPAGE_TOLERANCE
))
{
// The root cause is likely elsewhere, but added for now to reduce failure rate on production.
return
MIN_AUTO_SLIPPAGE_TOLERANCE
const
isPolygon
=
chainId
&&
[
SupportedChainId
.
POLYGON
,
SupportedChainId
.
POLYGON_MUMBAI
].
includes
(
chainId
)
const
minAutoSlippageTolerance
=
isPolygon
?
POLYGON_MIN_AUTO_SLIPPAGE_TOLERANCE
:
MIN_AUTO_SLIPPAGE_TOLERANCE
if
(
result
.
lessThan
(
minAutoSlippageTolerance
))
{
return
minAutoSlippageTolerance
}
}
return
result
return
result
...
...
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