Simple addition of token amounts without consideration of decimals or value could lead to inaccurate total value calculations. _totalValue
doesn't account for token values relative to each other.
There is no validation of token decimals. All tokens deposits are added to totalvalue without normalizing them to one token like USD. This is incorrect because the protocol accepts different tokens for deposits. some of these tokens have different decimals. These decimals have to be normalized before adding them to totalValue but the system doesn't do that.
Example:
Tokens have vastly different values (1 WBTC ≠ 1 USDC)
Decimals vary (USDC: 6, WETH: 18)
Some tokens are highly volatile
Some tokens may be rebasing tokens whose balance changes over time.
_totalValue now represents meaningless sum of different decimal places
Incorrect tracking of _totalValue
Foundry
Implement the correct tracking of tokens and their decimals.
struct TokenInfo {
uint256 balance;
uint8 decimals;
address priceOracle;
}
mapping(address => TokenInfo) private _tokenInfo;
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.