Skip to content

Commit

Permalink
feat: added slippage warning for default too high (#3787)
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 authored Aug 22, 2024
1 parent 6cc55c3 commit 64a905c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/web/modals/review-order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export function ReviewOrder({
);
const { isMobile } = useWindowSize(Breakpoint.sm);

const isManualSlippageTooHigh = +manualSlippage > 1;
const isManualSlippageTooHigh =
(!!manualSlippage && parseInt(manualSlippage) > 1) ||
(!manualSlippage &&
!!slippageConfig &&
slippageConfig.slippage.toDec().gt(new Dec(0.01)));
const isManualSlippageTooLow = manualSlippage !== "" && +manualSlippage < 0.1;

//Value is memoized as it must be frozen when the component is mounted
Expand Down Expand Up @@ -464,7 +468,8 @@ export function ReviewOrder({
inputClassName={classNames(
"!bg-transparent focus:text-center text-right placeholder:text-wosmongton-300 transition-all focus-visible:outline-none",
{
"text-rust-400": isManualSlippageTooHigh,
"text-rust-400 placeholder:text-rust-400":
isManualSlippageTooHigh,
}
)}
value={manualSlippage}
Expand Down

0 comments on commit 64a905c

Please sign in to comment.