In this section of the custom accounting docs, we note that the fee is to be taken in the unspecified currency, also noting that in the exact output case that should be the input token. However, in the code example, we always use the output amount to compute the fee amount:
bool outputIsToken0 = params.zeroForOne ? false : true;
int256 outputAmount = outputIsToken0 ? delta.amount0() : delta.amount1();
if (outputAmount <= 0) {
return (BaseHook.afterSwap.selector, 0);
}
uint256 feeAmount = (uint256(outputAmount) * HOOK_FEE_PERCENTAGE) / FEE_DENOMINATOR;
This means we incorrectly compute the feeAmount for exact output swaps
In this section of the custom accounting docs, we note that the fee is to be taken in the unspecified currency, also noting that in the exact output case that should be the input token. However, in the code example, we always use the output amount to compute the fee amount:
This means we incorrectly compute the
feeAmountfor exact output swaps