The Treasury contract calculates the total value of funds held by summing the raw amounts of different tokens without considering their decimal places or market values. This can lead to misleading financial reporting and an inaccurate representation of the treasury's actual value.
Raw Sum Calculation:
The total value is calculated as a simple sum of token amounts, ignoring the fact that different tokens may have different decimal places. For example, 100 DAI (with 18 decimals) and 100 USDC (with 6 decimals) would be summed without adjusting for their actual value.
Misleading Financial Reporting:
The total value metric may give a false impression of the treasury's financial health. Users may believe that the treasury has more value than it actually does, leading to poor decision-making.
Lack of Market Value Consideration:
The current implementation does not account for the market value of tokens, which can fluctuate significantly. This means that the reported total value may not reflect the true economic value of the treasury's holdings.
Initial Setup:
The treasury holds 100 DAI (18 decimals) and 100 USDC (6 decimals).
The total value is calculated as:
Total Value = 100 DAI + 100 USDC = 200 (raw sum).
Problem Arises:
The actual value of the treasury is:
100 DAI = $100 (assuming 1 DAI = $1)
100 USDC = $100 (assuming 1 USDC = $1)
The total value should be reported as $200, but the raw sum does not account for the different decimal places, leading to potential confusion.
Inaccurate Financial Reporting: Users may make decisions based on misleading information about the treasury's value.
Potential Legal Issues: If the treasury is required to report its financial status, inaccurate reporting could lead to legal ramifications.
Loss of Trust: Users may lose trust in the protocol if they discover discrepancies between reported values and actual values.
Implement Decimal Normalization:
Adjust the total value calculation to account for the decimal places of each token. This can be done by converting all token amounts to a common base (e.g., using the smallest unit of each token).
Consider Market Values:
Integrate a price oracle to provide real-time market values for each token held in the treasury. This would allow for a more accurate representation of the treasury's total value.
Clear Documentation:
Document the limitations of the total value calculation clearly in the code and user interfaces to prevent misunderstandings.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.