Skip to content

Commit 9f82c52

Browse files
committed
fix dynamic fee rounding
1 parent e9eca2e commit 9f82c52

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

subgraphs/v3-vault/src/mappings/vault.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,14 @@ export function handleSwap(event: SwapEvent): void {
330330
let swapFeeDeltaAmount = ZERO_BD;
331331
if (hasDynamicSwapFee) {
332332
let swapFeeDelta = swapFeePercentage.minus(pool.swapFee);
333-
swapFeeBaseAmount = tokenAmountIn.times(pool.swapFee);
334-
swapFeeDeltaAmount = tokenAmountIn.times(swapFeeDelta);
333+
swapFeeBaseAmount = scaleDown(
334+
mulDownSwapFee(event.params.amountIn, pool.swapFee),
335+
tokenIn.decimals
336+
);
337+
swapFeeDeltaAmount = scaleDown(
338+
mulDownSwapFee(event.params.amountIn, swapFeeDelta),
339+
tokenIn.decimals
340+
);
335341
}
336342

337343
swap.pool = event.params.pool;

0 commit comments

Comments
 (0)