-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: threshold and state simplification (#475)
* feat: threshold and state simplification * refactor: polish * fix: pr comments * fix: test functions
- Loading branch information
Showing
4 changed files
with
50 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { Percent } from '@uniswap/sdk-core' | ||
import { InterfaceTrade } from 'state/routing/types' | ||
|
||
/** | ||
* Returns true if the trade requires a confirmation of details before we can submit it | ||
* @param args either a pair of V2 trades or a pair of V3 trades | ||
*/ | ||
export function tradeMeaningfullyDiffers(...args: [InterfaceTrade, InterfaceTrade]): boolean { | ||
const [tradeA, tradeB] = args | ||
export function tradeMeaningfullyDiffers(tradeA: InterfaceTrade, tradeB: InterfaceTrade, slippage: Percent): boolean { | ||
return ( | ||
tradeA.tradeType !== tradeB.tradeType || | ||
!tradeA.inputAmount.currency.equals(tradeB.inputAmount.currency) || | ||
!tradeA.inputAmount.equalTo(tradeB.inputAmount) || | ||
!tradeA.outputAmount.currency.equals(tradeB.outputAmount.currency) || | ||
!tradeA.outputAmount.equalTo(tradeB.outputAmount) | ||
tradeB.executionPrice.lessThan(tradeA.worstExecutionPrice(slippage)) | ||
) | ||
} |
7282d39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
widgets – ./
widgets-git-main-uniswap.vercel.app
widgets-uniswap.vercel.app
widgets-seven-tau.vercel.app