Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Invalid

Inadequate Management of Token Decimals in Fee Calculation

Summary

The getFee function in the LLMOracleManager contract lacks appropriate handling of token decimals during fee calculations. This oversight can lead to significantly underestimated fees, impacting the overall economics of the system.

Vulnerability Details

in the getFee function, the calculation of fees does not account for the standard 18 decimal places typically used by ERC20 tokens, which can cause discrepancies between expected and actual fees.

The fees (generatorFee, validatorFee, and totalFee) are calculated as raw integers without factoring in the necessary decimal adjustment. This omission means that fees could be substantially lower than intended.

For example, if the intended fee is 1.0 (which represents 1 token with 18 decimals), it would be represented as 1 * 10^18. Without proper decimal handling, the fees may be calculated as 1 instead of 1 * 10^18, leading to a significant loss of revenue.

Impact

Underestimating fees can threaten the sustainability of contracts, which can affect both developer earnings and user expenses.

Tools Used

Manual Review

Recommendations

consider the decimals

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.