11import { Repeat , UserFocus } from '@phosphor-icons/react' ;
22import clsx from 'clsx' ;
33import { BigNumber } from 'ethers' ;
4- import moveDecimal from 'move-decimal-point' ;
54import React , { type FC } from 'react' ;
65import { type FieldValues } from 'react-hook-form' ;
76
@@ -20,7 +19,6 @@ import {
2019} from '~types/graphql.ts' ;
2120import { getRecipientsNumber , getTokensNumber } from '~utils/expenditures.ts' ;
2221import { formatText } from '~utils/intl.ts' ;
23- import { getTokenDecimalsWithFallback } from '~utils/tokens.ts' ;
2422import MeatBallMenu from '~v5/shared/MeatBallMenu/MeatBallMenu.tsx' ;
2523import { type MeatBallMenuItem } from '~v5/shared/MeatBallMenu/types.ts' ;
2624import UserInfoPopover from '~v5/shared/UserInfoPopover/UserInfoPopover.tsx' ;
@@ -74,32 +72,18 @@ const CompletedExpenditureContent: FC<CompletedExpenditureContentProps> = ({
7472
7573 const stages = ( metadata ?. stages || [ ] ) . map ( ( stage ) => {
7674 const currentSlot = slots . find ( ( slot ) => slot . id === stage . slotId ) ;
77- const token = allTokens . find (
78- ( { token : currentToken } ) =>
79- currentToken . tokenAddress === currentSlot ?. payouts ?. [ 0 ] . tokenAddress ,
80- ) ;
8175
8276 return {
8377 milestone : stage . name ,
84- amount : moveDecimal (
85- currentSlot ?. payouts ?. [ 0 ] . amount ,
86- - getTokenDecimalsWithFallback ( token ?. token . decimals ) ,
87- ) ,
78+ amount : currentSlot ?. payouts ?. [ 0 ] . amount ,
8879 tokenAddress : currentSlot ?. payouts ?. [ 0 ] . tokenAddress ,
8980 } ;
9081 } ) ;
9182
92- const summedAmount = stages . reduce ( ( acc , { amount, tokenAddress } ) => {
93- const token = allTokens . find (
94- ( { token : currentToken } ) => currentToken . tokenAddress === tokenAddress ,
95- ) ;
96- const formattedAmount = moveDecimal (
97- amount || '0' ,
98- getTokenDecimalsWithFallback ( token ?. token . decimals ) ,
99- ) ;
100-
101- return BigNumber . from ( acc ) . add ( BigNumber . from ( formattedAmount ) ) ;
102- } , BigNumber . from ( '0' ) ) ;
83+ const summedAmount = stages . reduce (
84+ ( acc , { amount } ) => BigNumber . from ( acc ) . add ( BigNumber . from ( amount ) ) ,
85+ BigNumber . from ( '0' ) ,
86+ ) ;
10387
10488 const tokensCount = getTokensNumber ( expenditure ) ;
10589 const stagedPaymentTokenSymbol =
0 commit comments