Fix fee calculation in bet panel tooltip
This commit is contained in:
parent
dd6f5e5ef4
commit
9b252b93ab
|
@ -1,6 +1,6 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { partition, sumBy } from 'lodash'
|
import { partition, sum, sumBy } from 'lodash'
|
||||||
import { SwitchHorizontalIcon } from '@heroicons/react/solid'
|
import { SwitchHorizontalIcon } from '@heroicons/react/solid'
|
||||||
|
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
|
@ -26,11 +26,7 @@ import { BinaryOutcomeLabel } from './outcome-label'
|
||||||
import { getProbability } from 'common/calculate'
|
import { getProbability } from 'common/calculate'
|
||||||
import { useFocus } from 'web/hooks/use-focus'
|
import { useFocus } from 'web/hooks/use-focus'
|
||||||
import { useUserContractBets } from 'web/hooks/use-user-bets'
|
import { useUserContractBets } from 'web/hooks/use-user-bets'
|
||||||
import {
|
import { calculateCpmmSale, getCpmmProbability } from 'common/calculate-cpmm'
|
||||||
calculateCpmmSale,
|
|
||||||
getCpmmProbability,
|
|
||||||
getCpmmFees,
|
|
||||||
} from 'common/calculate-cpmm'
|
|
||||||
import {
|
import {
|
||||||
getFormattedMappedValue,
|
getFormattedMappedValue,
|
||||||
getPseudoProbability,
|
getPseudoProbability,
|
||||||
|
@ -271,11 +267,7 @@ function BuyPanel(props: {
|
||||||
const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0
|
const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0
|
||||||
const currentReturnPercent = formatPercent(currentReturn)
|
const currentReturnPercent = formatPercent(currentReturn)
|
||||||
|
|
||||||
const cpmmFees = getCpmmFees(
|
const totalFees = sum(Object.values(newBet.fees))
|
||||||
contract,
|
|
||||||
betAmount ?? 0,
|
|
||||||
betChoice ?? 'YES'
|
|
||||||
).totalFees
|
|
||||||
|
|
||||||
const format = getFormattedMappedValue(contract)
|
const format = getFormattedMappedValue(contract)
|
||||||
|
|
||||||
|
@ -362,7 +354,7 @@ function BuyPanel(props: {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<InfoTooltip
|
<InfoTooltip
|
||||||
text={`Includes ${formatMoneyWithDecimals(cpmmFees)} in fees`}
|
text={`Includes ${formatMoneyWithDecimals(totalFees)} in fees`}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user