Skip to content

Commit

Permalink
Fix/rounding bug limo sdk (#207)
Browse files Browse the repository at this point in the history
* fix rounding bug

* unbump package version
  • Loading branch information
anihamde authored Nov 1, 2024
1 parent 9c605f5 commit 8fb79d5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sdk/js/src/examples/simpleSearcherLimo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,18 @@ class SimpleSearcherLimo {
const inputAmountDecimals = new Decimal(
order.state.initialInputAmount.toNumber()
)
.div(new Decimal(10).pow(inputMintDecimals))
.mul(effectiveFillRate)
.div(100);
.div(100)
.floor()
.div(new Decimal(10).pow(inputMintDecimals));

const outputAmountDecimals = new Decimal(
order.state.expectedOutputAmount.toNumber()
)
.div(new Decimal(10).pow(outputMintDecimals))
.mul(effectiveFillRate)
.div(100);
.div(100)
.ceil()
.div(new Decimal(10).pow(outputMintDecimals));

console.log("Order address", order.address.toBase58());
console.log("Fill rate", effectiveFillRate);
Expand Down

0 comments on commit 8fb79d5

Please sign in to comment.