In Curves.getFees(), the current methodology calculates each fee component (protocolFee, subjectFee, referralFee, holdersFee) separately from the transaction price, leading to potential rounding errors due to Soliditys integer arithmetic. An alternative approach, where the totalFee is calculated first as a cumulative percentage of the price, and then protocolFee is derived by subtracting other fees from totalFee, could reduce these rounding discrepancies. The key is to align the method with the contracts fee structure while ensuring precision, especially important in financial transactions where even minimal rounding errors can accumulate significantly over time.
https://github.com/code-423n4/2024-01-curves/blob/main/contracts/Curves.sol#L173-L177
