Skip to content

Commit

Permalink
fix: update our checks for stack remaining funds
Browse files Browse the repository at this point in the history
  • Loading branch information
ElRodrigote committed Aug 8, 2024
1 parent f0118ad commit b626d18
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/app/models/stack-order/stack-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ export const totalStacked = (order: StackOrder) =>
}, 0) ?? 0;

export const stackHasRemainingFunds = (stackOrder: StackOrder) =>
totalFundsUsed(stackOrder) > stacklyFee(stackOrder) &&
totalFundsUsed(stackOrder) >= stacklyFee(stackOrder) &&
stackRemainingFunds(stackOrder) > stacklyFee(stackOrder);

export const stackRemainingFunds = (stackOrder: StackOrder) => {
if (totalFundsUsed(stackOrder) === 0 && totalStackOrdersDone(stackOrder) > 0)
if (
stackOrder.cowOrders.length &&
totalFundsUsed(stackOrder) === 0 &&
totalStackOrdersDone(stackOrder) > 0
)
return 0;

return (
convertedAmount(stackOrder.amount, stackOrder.sellToken.decimals) -
totalFundsUsed(stackOrder)
Expand Down

0 comments on commit b626d18

Please sign in to comment.