Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
add userAddress to quoteParamChanged check (#2605)
Browse files Browse the repository at this point in the history
  • Loading branch information
W3stside committed Mar 29, 2022
1 parent e4b9b32 commit 108c6ea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/custom/state/price/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ function quoteUsingSameParameters(currentParams: FeeQuoteParams, quoteInfo: Quot
sellToken: currentSellToken,
buyToken: currentBuyToken,
kind: currentKind,
userAddress: currentUserAddress,
} = currentParams
const { amount, buyToken, sellToken, kind } = quoteInfo

return (
const { amount, buyToken, sellToken, kind, userAddress } = quoteInfo
// cache the base quote params without quoteInfo user address to check
const paramsWithoutAddress =
sellToken === currentSellToken && buyToken === currentBuyToken && amount === currentAmount && kind === currentKind
)
// 2 checks: if there's a quoteInfo user address (meaning quote was already calculated once) and one without
// in case user is not connected
return userAddress ? currentUserAddress === userAddress && paramsWithoutAddress : paramsWithoutAddress
}

/**
Expand Down

0 comments on commit 108c6ea

Please sign in to comment.