Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

Treasury.sol::deposit accounts the totalValue ignoring decimals, the variable will return a wrong value

Summary

Treasury.sol::deposit receives deposits of all types of tokens, registers the balance for a specific token, and stores the `totalValue` in the contract.

Vulnerability Details

In addition to ignoring CEI, it adds all token amounts to a unique variable without converting them to a common rate, such as the USD value, or even checking for different decimals.

For example: If the protocol has 10 ether stored in the totalValuevariable and someone deposits 1000e6, the total value stored in the contract will return 10.000_.000.000.000.000.000 + 1000.000.00._

(code)[https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/collectors/Treasury.sol#L46-L55]

Impact

The value returned from Treasury.sol::getTotalValue will not reflect the total value stored in the contract if tokens with different decimals or tokens with different representations.

Tools Used

Code Review

Recommendations

Evaluate the real need for this variable to exist. If it's really needed, consider converting to a common rate using oracles.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Treasury::deposit increments _totalValue regardless of the token, be it malicious, different decimals, FoT etc.

Support

FAQs

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

Give us feedback!