Skip to content

Commit de567bf

Browse files
committed
Update refund amount calculation to use token decimals from TOKEN_ADDRESSES
1 parent ff83f40 commit de567bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { ethers, Wallet, ZeroAddress } from 'ethers';
1717
import { createSignerMock } from '../../../test/fixtures/web3';
1818
import { ServerConfigService } from '../../common/config/server-config.service';
1919
import { ErrorEscrow, ErrorJob } from '../../common/constants/errors';
20+
import { TOKEN_ADDRESSES } from '../../common/constants/tokens';
2021
import {
2122
AudinoJobType,
2223
CvatJobType,
@@ -1748,7 +1749,12 @@ describe('JobService', () => {
17481749

17491750
mockPaymentService.getJobPayments.mockResolvedValueOnce([]);
17501751
mockedEscrowUtils.getCancellationRefund.mockResolvedValueOnce({
1751-
amount: ethers.parseUnits(refundAmount.toString(), 18),
1752+
amount: ethers.parseUnits(
1753+
refundAmount.toString(),
1754+
(TOKEN_ADDRESSES[jobEntity.chainId as ChainId] ?? {})[
1755+
jobEntity.token as EscrowFundToken
1756+
]?.decimals,
1757+
),
17521758
escrowAddress: jobEntity.escrowAddress!,
17531759
} as any);
17541760
mockPaymentService.createRefundPayment.mockResolvedValueOnce(undefined);

0 commit comments

Comments
 (0)