Skip to content

Commit

Permalink
Merge pull request #30 from rainprotocol/2023-10-10-bot-fix
Browse files Browse the repository at this point in the history
Fixed Router Mode
  • Loading branch information
Siddharth2207 authored Oct 10, 2023
2 parents 95ee8f2 + c87fe1f commit a69d58a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,18 @@ const routerClear = async(
else {
console.log(">>> Getting best route for this token pair", "\n");

let cumulativeAmountFixed = ethers.constants.Zero;
bundledOrders[i].takeOrders.forEach(v => {
cumulativeAmountFixed = cumulativeAmountFixed.add(v.quoteAmount);
});

console.log(
">>> getting market rate for " +
ethers.utils.formatUnits(cumulativeAmountFixed) +
" " +
bundledOrders[i].sellTokenSymbol
);

let cumulativeAmountFixed = ethers.constants.Zero;
bundledOrders[i].takeOrders.forEach(v => {
cumulativeAmountFixed = cumulativeAmountFixed.add(v.quoteAmount);
});
const cumulativeAmount = cumulativeAmountFixed.div(
"1" + "0".repeat(18 - bundledOrders[i].sellTokenDecimals)
);
Expand Down

0 comments on commit a69d58a

Please sign in to comment.