Skip to content

Commit

Permalink
SOV-1811: Fix XUSD and DOC regression (#2526)
Browse files Browse the repository at this point in the history
* Fix DOC prices

* Small refactoring + rUSDT fix
  • Loading branch information
tiltom authored May 4, 2023
1 parent 5e9e6cd commit 6859879
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/components/PairNavbarInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const parsePairData = (
let highPrice = 0;
let lowPrice = 0;

/** Special case for RBTC/XUSD pair - underlying AMM pool is XUSD/RBTC but we need to display the reverse */
if (
pairData[0].trading_pairs === pairData[1].trading_pairs &&
pairData[1].base_symbol === Asset.XUSD
) {
const isRbtcPair = pairData[0].trading_pairs === pairData[1].trading_pairs;

const stablecoinsToInvert = [Asset.XUSD, Asset.DOC, 'rUSDT'];

/** Special case for RBTC/[XUSD, DOC, rUSDT] pairs - underlying AMM pool is [token]/RBTC but we need to display the reverse */
if (isRbtcPair && stablecoinsToInvert.includes(pairData[1].base_symbol)) {
lastPrice = pairData[0].last_price;
percentageChange = -pairData[0].price_change_percent_24h;
lowPrice = Number(bignumber(1).div(pairData[0].high_price_24h).toFixed(18));
Expand All @@ -40,7 +41,7 @@ const parsePairData = (
}

/** BTC is quote symbol */
if (pairData[0].trading_pairs === pairData[1].trading_pairs) {
if (isRbtcPair) {
lastPrice = pairData[0].last_price;
percentageChange = pairData[0].price_change_percent_24h;
highPrice = pairData[0].high_price_24h;
Expand Down

0 comments on commit 6859879

Please sign in to comment.