Skip to content

Commit

Permalink
fix: fix pricing displays (#3214)
Browse files Browse the repository at this point in the history
* fix pricing displays

* update rate logic, code clean
  • Loading branch information
ianlapham authored Feb 2, 2022
1 parent fc63707 commit 800b5e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/Swap/Summary/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface TokenValueProps {
function TokenValue({ input, usdc, change }: TokenValueProps) {
const percent = useMemo(() => {
if (change) {
const percent = (change * 100).toPrecision(3)
const percent = change.toPrecision(3)
return change > 0 ? `(+${percent}%)` : `(${percent}%)`
}
return undefined
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/Swap/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ function LoadedState({ inputAmount, outputAmount, trade }: LoadedStateProps) {

const ratio = useMemo(() => {
const [a, b] = flip ? [outputAmount, inputAmount] : [inputAmount, outputAmount]
const priceString = (!flip ? executionPrice : executionPrice?.invert())?.toSignificant(6)

const ratio = `1 ${a.currency.symbol} = ${executionPrice?.toSignificant(6)} ${b.currency.symbol}`
const ratio = `1 ${a.currency.symbol} = ${priceString}} ${b.currency.symbol}`
const usdc = !flip
? fiatValueInput
? ` ($${fiatValueInput.toSignificant(2)})`
Expand Down

0 comments on commit 800b5e0

Please sign in to comment.