Skip to content

Commit

Permalink
Fix hardcoded token index and decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoguerios committed Nov 9, 2023
1 parent e60c881 commit 9f5605d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions balancer-js/src/modules/pricing/priceImpact.compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ describe('Price impact comparison tests', async () => {
...exitParams
);

const initialA = parseFloat(formatFixed(amountIn, 8));
const finalA = parseFloat(formatFixed(amountsOut[0], 8));
const initialA = parseFloat(formatFixed(amountIn, tokenIn.decimals));
const finalA = parseFloat(
formatFixed(amountsOut[tokenInIndex], tokenIn.decimals)
);
const priceImpactABA = (initialA - finalA) / initialA / 2;
console.log(`priceImpactABA : ${priceImpactABA}`);
});
Expand Down

0 comments on commit 9f5605d

Please sign in to comment.