Skip to content

Commit

Permalink
bug fix on account page (Uniswap#327)
Browse files Browse the repository at this point in the history
* bug fix on account page

* Fix code style issues with ESLint

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
  • Loading branch information
ianlapham and lint-action committed Dec 20, 2020
1 parent 11309c0 commit 932efce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/MiningPositionList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ function MiningPositionList({ miningPositions }) {

.sort((p0, p1) => {
if (sortedColumn === SORT_FIELD.VALUE) {
const bal0 = (p0.balance / p0.pairData.totalSupply) * p0.pairData.reserveUSD
const bal1 = (p0.balance / p0.pairData.totalSupply) * p1.pairData.reserveUSD
const bal0 = (p0.balance / p0.pairData?.totalSupply) * p0.pairData?.reserveUSD
const bal1 = (p0.balance / p0.pairData?.totalSupply) * p1.pairData?.reserveUSD
return bal0 > bal1 ? (sortDirection ? -1 : 1) : sortDirection ? 1 : -1
}
return 1
Expand Down
16 changes: 10 additions & 6 deletions src/contexts/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,16 @@ export function useUserLiquidityChart(account) {

// now cycle through pair day datas, for each one find usd value = ownership[address] * reserveUSD
const dailyUSD = relavantDayDatas.reduce((totalUSD, dayData) => {
return (totalUSD =
totalUSD +
(ownershipPerPair[dayData.pairAddress]
? (parseFloat(ownershipPerPair[dayData.pairAddress].lpTokenBalance) / parseFloat(dayData.totalSupply)) *
parseFloat(dayData.reserveUSD)
: 0))
if (dayData) {
return (totalUSD =
totalUSD +
(ownershipPerPair[dayData.pairAddress]
? (parseFloat(ownershipPerPair[dayData.pairAddress].lpTokenBalance) / parseFloat(dayData.totalSupply)) *
parseFloat(dayData.reserveUSD)
: 0))
} else {
return totalUSD
}
}, 0)

formattedHistory.push({
Expand Down

0 comments on commit 932efce

Please sign in to comment.