Skip to content

Commit

Permalink
fix compare logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Sep 23, 2024
1 parent f74ca92 commit c63eb5d
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,18 @@ export const useConfirmNewBridgePrice = () => {
if (
validQuotes &&
hasSameSelectionsAsPreviousQuote &&
hasBridgeModuleChanged
) {
requestUserConfirmChange(previousBridgeQuote)
} else if (
validQuotes &&
hasSameSelectionsAsPreviousQuote &&
outputAmountDiffMoreThanThreshold
(outputAmountDiffMoreThanThreshold || hasBridgeModuleChanged)
) {
requestUserConfirmChange(previousBridgeQuote)
} else {
resetConfirm()
}
}, [bridgeQuote, previousBridgeQuote, hasSameSelectionsAsPreviousQuote])
}, [
bridgeQuote,
previousBridgeQuote,
hasSameSelectionsAsPreviousQuote,
isPendingConfirmChange,
])

const requestUserConfirmChange = (previousQuote: BridgeQuote) => {
if (!hasQuoteOutputChanged && !hasUserConfirmedChange) {
Expand Down Expand Up @@ -123,5 +122,5 @@ const calculateOutputRelativeDifference = (
const currentOutput = parseFloat(currentQuote.outputAmountString)
const previousOutput = parseFloat(currentQuote.outputAmountString)

return previousOutput - currentOutput / previousOutput
return (previousOutput - currentOutput) / previousOutput
}

0 comments on commit c63eb5d

Please sign in to comment.