diff --git a/modules/beethoven/balancer-sor.service.ts b/modules/beethoven/balancer-sor.service.ts index 37106b79..bc7dac26 100644 --- a/modules/beethoven/balancer-sor.service.ts +++ b/modules/beethoven/balancer-sor.service.ts @@ -148,6 +148,7 @@ export class BalancerSorService { marketSp: string; swaps: SwapV2[]; tokenAddresses: string[]; + priceImpact?: string; }): GqlSorGetSwapsResponse { const { tokenIn, @@ -164,6 +165,7 @@ export class BalancerSorService { marketSp, swaps, tokenAddresses, + priceImpact: rawPriceImpact, } = swapData; const tokenInAmountFixed = formatFixed(tokenInAmtEvm, this.getTokenDecimals(tokenIn, tokens)); @@ -214,7 +216,7 @@ export class BalancerSorService { })), effectivePrice: effectivePrice.toString(), effectivePriceReversed: effectivePriceReversed.toString(), - priceImpact: priceImpact.toString(), + priceImpact: rawPriceImpact ? rawPriceImpact : priceImpact.toString(), }; } diff --git a/modules/sor/sorV2/sorV2.service.ts b/modules/sor/sorV2/sorV2.service.ts index be99e23a..95adf199 100644 --- a/modules/sor/sorV2/sorV2.service.ts +++ b/modules/sor/sorV2/sorV2.service.ts @@ -89,6 +89,7 @@ class SwapResultV2 implements SwapResult { ): Promise { const sor = new BalancerSorService(); const tokens = await tokenService.getTokens(); + const priceImpact = swap.priceImpact.percentage.toFixed(4); let poolIds: string[]; if (swap.isBatchSwap) { const swaps = swap.swaps as BatchSwapStep[]; @@ -130,6 +131,7 @@ class SwapResultV2 implements SwapResult { marketSp: '0', // Daniel confirmed returning 0 should be fine here swaps: this.mapSwaps(swap.swaps, swap.assets), tokenAddresses: swap.assets, + priceImpact, }; return sor.formatResponse(swapData); }