Inaccurate _totalValue
tracking in Treasury.sol
due to neglecting token value differences.
The _totalValue
state variable in Treasury.sol
is updated by simply adding or subtracting token amounts during deposits and withdrawals. This approach fails to account for the varying values of different tokens held in the treasury. Consequently, _totalValue
becomes an inaccurate representation of the actual treasury value.
Code Snippet:
_totalValue
is updated with raw token amounts, disregarding the potentially different and fluctuating values of each token.
Misleading getTotalValue()
: The function returns an inaccurate total value of treasury assets.
Lack of Real Value Metric: _totalValue
becomes a meaningless metric for assessing the treasury's financial status.
Manual code review.
Implement a value-aware _totalValue
update mechanism. Consider:
Value Tracking per Token: Maintain a mapping of token to value and update _totalValue
based on these tracked values during deposits and withdrawals.
Remove _totalValue
: If accurate total value tracking is not critical, consider removing _totalValue
to avoid providing a misleading metric.
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.