update swap activity feed value

This commit is contained in:
saml33 2022-12-20 21:01:49 +11:00
parent c0332aa489
commit 2c76ed268a
1 changed files with 12 additions and 12 deletions

View File

@ -128,16 +128,8 @@ const ActivityFeedTable = ({
activity_type === 'withdraw' ? usd_equivalent * -1 : usd_equivalent activity_type === 'withdraw' ? usd_equivalent * -1 : usd_equivalent
} }
if (activity_type === 'swap') { if (activity_type === 'swap') {
const { const { swap_out_amount, swap_out_price_usd } = activity.activity_details
loan_origination_fee, value = swap_out_amount * swap_out_price_usd
swap_in_amount,
swap_in_price_usd,
swap_out_amount,
swap_out_price_usd,
} = activity.activity_details
value =
(swap_in_amount + loan_origination_fee) * swap_in_price_usd -
swap_out_amount * swap_out_price_usd
} }
if (activity_type === 'perp_trade') { if (activity_type === 'perp_trade') {
const { maker_fee, price, quantity, taker_fee } = const { maker_fee, price, quantity, taker_fee } =
@ -218,10 +210,18 @@ const ActivityFeedTable = ({
</Td> </Td>
<Td <Td
className={`text-right font-mono ${ className={`text-right font-mono ${
value >= 0 ? 'text-th-up' : 'text-th-down' activityName === 'swap' || activityName === 'perp'
? 'text-th-fgd-2'
: value >= 0
? 'text-th-up'
: 'text-th-down'
}`} }`}
> >
{value > 0 ? '+' : ''} {value > 0 &&
activityName !== 'swap' &&
activityName !== 'perp'
? '+'
: ''}
{formatFixedDecimals(value, true)} {formatFixedDecimals(value, true)}
</Td> </Td>
<Td> <Td>