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
82896703
Unverified
Commit
82896703
authored
Feb 09, 2022
by
Zach Pomerantz
Committed by
GitHub
Feb 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: use greaterThan (#3269)
parent
440ac0cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
MaxSlippageSelect.tsx
src/lib/components/Swap/Settings/MaxSlippageSelect.tsx
+2
-2
Details.tsx
src/lib/components/Swap/Summary/Details.tsx
+3
-3
index.tsx
src/lib/components/Swap/Summary/index.tsx
+3
-3
No files found.
src/lib/components/Swap/Settings/MaxSlippageSelect.tsx
View file @
82896703
...
...
@@ -112,10 +112,10 @@ export default function MaxSlippageSelect() {
const
numerator
=
Math
.
floor
(
+
custom
*
100
)
if
(
numerator
)
{
const
percent
=
new
Percent
(
numerator
,
10
_000
)
if
(
!
percent
.
less
Than
(
MAX_VALID_SLIPPAGE
))
{
if
(
percent
.
greater
Than
(
MAX_VALID_SLIPPAGE
))
{
setWarning
(
WarningState
.
INVALID_SLIPPAGE
)
setMaxSlippage
(
'
auto
'
)
}
else
if
(
!
percent
.
less
Than
(
MIN_HIGH_SLIPPAGE
))
{
}
else
if
(
percent
.
greater
Than
(
MIN_HIGH_SLIPPAGE
))
{
setWarning
(
WarningState
.
HIGH_SLIPPAGE
)
setMaxSlippage
(
percent
)
}
else
{
...
...
src/lib/components/Swap/Summary/Details.tsx
View file @
82896703
...
...
@@ -66,9 +66,9 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
}
const
priceImpactRow
=
[
t
`Price impact`
,
`
${
priceImpact
.
toFixed
(
2
)}
%`
]
if
(
!
priceImpact
.
less
Than
(
ALLOWED_PRICE_IMPACT_HIGH
))
{
if
(
priceImpact
.
greater
Than
(
ALLOWED_PRICE_IMPACT_HIGH
))
{
priceImpactRow
.
push
(
'
error
'
)
}
else
if
(
!
priceImpact
.
less
Than
(
ALLOWED_PRICE_IMPACT_MEDIUM
))
{
}
else
if
(
priceImpact
.
greater
Than
(
ALLOWED_PRICE_IMPACT_MEDIUM
))
{
priceImpactRow
.
push
(
'
warning
'
)
}
rows
.
push
(
priceImpactRow
)
...
...
@@ -92,7 +92,7 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
}
const
slippageToleranceRow
=
[
t
`Slippage tolerance`
,
`
${
allowedSlippage
.
toFixed
(
2
)}
%`
]
if
(
!
allowedSlippage
.
less
Than
(
MIN_HIGH_SLIPPAGE
))
{
if
(
allowedSlippage
.
greater
Than
(
MIN_HIGH_SLIPPAGE
))
{
slippageToleranceRow
.
push
(
'
warning
'
)
}
rows
.
push
(
slippageToleranceRow
)
...
...
src/lib/components/Swap/Summary/index.tsx
View file @
82896703
...
...
@@ -96,9 +96,9 @@ export function SummaryDialog({ trade, allowedSlippage, onConfirm }: SummaryDial
const
independentField
=
useAtomValue
(
independentFieldAtom
)
const
warning
=
useMemo
(()
=>
{
if
(
!
priceImpact
.
less
Than
(
ALLOWED_PRICE_IMPACT_HIGH
))
return
'
error
'
if
(
!
priceImpact
.
less
Than
(
ALLOWED_PRICE_IMPACT_MEDIUM
))
return
'
warning
'
if
(
!
allowedSlippage
.
less
Than
(
MIN_HIGH_SLIPPAGE
))
return
'
warning
'
if
(
priceImpact
.
greater
Than
(
ALLOWED_PRICE_IMPACT_HIGH
))
return
'
error
'
if
(
priceImpact
.
greater
Than
(
ALLOWED_PRICE_IMPACT_MEDIUM
))
return
'
warning
'
if
(
allowedSlippage
.
greater
Than
(
MIN_HIGH_SLIPPAGE
))
return
'
warning
'
return
},
[
allowedSlippage
,
priceImpact
])
...
...
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