Skip to content

Commit

Permalink
Multiply orders by token price to get DAI value (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophialittlejohn authored May 30, 2023
1 parent f04978f commit 7b3a614
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions centrifuge-app/src/components/LiquidityEpochSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Pool } from '@centrifuge/centrifuge-js'
import { formatBalance, useCentrifuge, useCentrifugeTransaction, useEvmProvider } from '@centrifuge/centrifuge-react'
import { Button, IconInfo, Shelf, Stack, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { Dec } from '../utils/Decimal'
import { useTinlakeBalances } from '../utils/tinlake/useTinlakeBalances'
import { useTinlakeInvestments } from '../utils/tinlake/useTinlakeInvestments'
import { TinlakePool, useTinlakePools } from '../utils/tinlake/useTinlakePools'
Expand Down Expand Up @@ -295,10 +296,12 @@ function TinlakeEpochStatus({ pool }: { pool: TinlakePool }) {
}
)

const juniorInvest = pool.tranches[0].pendingInvestments.toDecimal()
const seniorInvest = pool.tranches[1].pendingInvestments.toDecimal()
const juniorRedeem = pool.tranches[0].pendingRedemptions.toDecimal()
const seniorRedeem = pool.tranches[1].pendingRedemptions.toDecimal()
const juniorTokenPrice = pool.tranches[0].tokenPrice?.toDecimal() || Dec(1)
const seniorTokenPrice = pool.tranches[1].tokenPrice?.toDecimal() || Dec(1)
const juniorInvest = pool.tranches[0].pendingInvestments.toDecimal().mul(juniorTokenPrice)
const seniorInvest = pool.tranches[1].pendingInvestments.toDecimal().mul(seniorTokenPrice)
const juniorRedeem = pool.tranches[0].pendingRedemptions.toDecimal().mul(juniorTokenPrice)
const seniorRedeem = pool.tranches[1].pendingRedemptions.toDecimal().mul(seniorTokenPrice)
const sumOfLockedInvestments = juniorInvest.add(seniorInvest)
const sumOfLockedRedemptions = juniorRedeem.add(seniorRedeem)
const investments: LiquidityTableRow[] = [
Expand Down

0 comments on commit 7b3a614

Please sign in to comment.