Skip to content

Commit

Permalink
fix: getMultipleFillIdx
Browse files Browse the repository at this point in the history
  • Loading branch information
krboktv committed Sep 13, 2024
1 parent 377cca5 commit 65c6b4e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cross-chain-order/cross-chain-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,15 @@ export class CrossChainOrder {
)
const partsCount = this.escrowExtension.hashLockInfo.getPartsCount()

const calculatedIndex =
((this.makingAmount - remainingAmount + this.makingAmount - 1n) *
partsCount) /
this.makingAmount

if (remainingAmount === fillAmount) {
return Number(partsCount)
return Number(calculatedIndex + 2n)
}

return Number((partsCount * (fillAmount - 1n)) / this.makingAmount)
return Number(calculatedIndex + 1n)
}
}

0 comments on commit 65c6b4e

Please sign in to comment.