Commit 82896703 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: use greaterThan (#3269)

parent 440ac0cb
......@@ -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.lessThan(MAX_VALID_SLIPPAGE)) {
if (percent.greaterThan(MAX_VALID_SLIPPAGE)) {
setWarning(WarningState.INVALID_SLIPPAGE)
setMaxSlippage('auto')
} else if (!percent.lessThan(MIN_HIGH_SLIPPAGE)) {
} else if (percent.greaterThan(MIN_HIGH_SLIPPAGE)) {
setWarning(WarningState.HIGH_SLIPPAGE)
setMaxSlippage(percent)
} else {
......
......@@ -66,9 +66,9 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
}
const priceImpactRow = [t`Price impact`, `${priceImpact.toFixed(2)}%`]
if (!priceImpact.lessThan(ALLOWED_PRICE_IMPACT_HIGH)) {
if (priceImpact.greaterThan(ALLOWED_PRICE_IMPACT_HIGH)) {
priceImpactRow.push('error')
} else if (!priceImpact.lessThan(ALLOWED_PRICE_IMPACT_MEDIUM)) {
} else if (priceImpact.greaterThan(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.lessThan(MIN_HIGH_SLIPPAGE)) {
if (allowedSlippage.greaterThan(MIN_HIGH_SLIPPAGE)) {
slippageToleranceRow.push('warning')
}
rows.push(slippageToleranceRow)
......
......@@ -96,9 +96,9 @@ export function SummaryDialog({ trade, allowedSlippage, onConfirm }: SummaryDial
const independentField = useAtomValue(independentFieldAtom)
const warning = useMemo(() => {
if (!priceImpact.lessThan(ALLOWED_PRICE_IMPACT_HIGH)) return 'error'
if (!priceImpact.lessThan(ALLOWED_PRICE_IMPACT_MEDIUM)) return 'warning'
if (!allowedSlippage.lessThan(MIN_HIGH_SLIPPAGE)) return 'warning'
if (priceImpact.greaterThan(ALLOWED_PRICE_IMPACT_HIGH)) return 'error'
if (priceImpact.greaterThan(ALLOWED_PRICE_IMPACT_MEDIUM)) return 'warning'
if (allowedSlippage.greaterThan(MIN_HIGH_SLIPPAGE)) return 'warning'
return
}, [allowedSlippage, priceImpact])
......
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