FILE:2024-10-ramses-exchange/contracts/CL/core
/RamsesV3Pool.sol

 /// @dev sub is safe because we know balanceAfter is gt balanceBefore by at least fee
            uint256 paid0 = balance0After - balance0Before;
            uint256 paid1 = balance1After - balance1Before;

            uint8 feeProtocol = $.slot0.feeProtocol;
            if (paid0 > 0) {
                uint256 pFees0 = feeProtocol == 0 ? 0 : paid0 / feeProtocol;
                if (uint128(pFees0) > 0) $.protocolFees.token0 += uint128(pFees0);
                $.feeGrowthGlobal0X128 += FullMath.mulDiv(paid0 - pFees0, FixedPoint128.Q128, _liquidity);
            }
uint256 paid0 = balance0After - balance0Before-fee0;
uint256 paid1 = balance1After - balance1Before-fee1;
