Core Contracts

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

Using totalSupply to track total deposit will lead to incorrect calculation when funds are deposited directly to the vault without calling deposit function

[M-4] Using totalSupply to track total deposit will lead to incorrect calculation when funds are deposited directly to the vault without calling deposit function

Description:

The protocol uses totalSupply to track total deposit, this will result in wrong calculation of deposit when a user deposit straight in the vault without calling deposit function

Impact:
leads to wrong calculation and tracking of users total deposit

Proof of Concept:

function calculateRaacRewards(address user) public view returns (uint256) {
uint256 userDeposit = userDeposits[user];
// @audit using total supply to calculate total deposit a user // can deposit without calling the deposit function
uint256 totalDeposits = deToken.totalSupply();
uint256 totalRewards = raacToken.balanceOf(address(this));
if (totalDeposits < 1e6) return 0;
return (totalRewards * userDeposit) / totalDeposits;
}

Recommended Mitigation:
Tracking total users deposit through a mapping or storage is advisable

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!