Skip to content

Commit 2279e37

Browse files
feat(cc): dont exit deals when finishing CC (#1112)
remove code that exists deals before CC end
1 parent 6ff601f commit 2279e37

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

packages/cli/package/src/lib/chain/commitment.ts

-51
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,6 @@ export async function collateralWithdraw(
540540
[FINISH_COMMITMENT_FLAG_NAME]?: boolean;
541541
},
542542
) {
543-
const { ZeroAddress } = await import("ethers");
544-
545543
const [invalidCommitments, commitments] = splitErrorsAndResults(
546544
await getCommitmentsGroupedByStatus(flags),
547545
(c) => {
@@ -618,55 +616,6 @@ export async function collateralWithdraw(
618616
};
619617
});
620618

621-
const unitsWithDeals = units.filter((unit) => {
622-
return unit.unitInfo.deal !== ZeroAddress;
623-
});
624-
625-
const onChainWorkerIds = new Set<string>();
626-
627-
for (const { unitInfo } of unitsWithDeals) {
628-
onChainWorkerIds.add(unitInfo.onchainWorkerId);
629-
}
630-
631-
const moveResourcesFromDealTxs = Array.from(onChainWorkerIds).map(
632-
(onchainWorkerId) => {
633-
return populateTx(
634-
contracts.diamond.moveResourcesFromDealV2,
635-
onchainWorkerId,
636-
);
637-
},
638-
);
639-
640-
const [firstMoveResourcesFromDealTx, ...restMoveResourcesFromDealTxs] =
641-
moveResourcesFromDealTxs;
642-
643-
const dealsString = Array.from(
644-
new Set(
645-
unitsWithDeals.map(({ unitInfo }) => {
646-
return unitInfo.deal;
647-
}),
648-
),
649-
).join("\n");
650-
651-
if (firstMoveResourcesFromDealTx !== undefined) {
652-
try {
653-
await signBatch({
654-
title: `Moving resources from the following deals:\n${dealsString}`,
655-
populatedTxs: [
656-
firstMoveResourcesFromDealTx,
657-
...restMoveResourcesFromDealTxs,
658-
],
659-
});
660-
} catch (e) {
661-
commandObj.warn(
662-
`Wasn't able to move resources from deals for ${stringifyBasicCommitmentInfo(commitment)}. Most likely the reason is you must wait until the provider exits from all the following deals:\n${dealsString}`,
663-
);
664-
665-
dbg(stringifyUnknown(e));
666-
continue;
667-
}
668-
}
669-
670619
await sign({
671620
title: `withdraw collateral from: ${ccId}`,
672621
method: contracts.diamond.withdrawCollateral,

0 commit comments

Comments
 (0)