Within stabilityPool.deposit it attempts to mint RAAC rewards to the contract following users deposit but does so incorrectly
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/StabilityPool/StabilityPool.sol#L181
function deposit(uint256 amount) external nonReentrant whenNotPaused validAmount(amount) {
@> _update();
rToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 deCRVUSDAmount = calculateDeCRVUSDAmount(amount);
deToken.mint(msg.sender, deCRVUSDAmount);
userDeposits[msg.sender] += amount;
@> _mintRAACRewards();
emit Deposit(msg.sender, amount, deCRVUSDAmount);
}
The issue is that on the second call to _mintRAACRewards the function does not mint the reward to the contract but rather it does the same as _update() which serves as a notifier.
Impact
RAAACRewards would not be minted at deposit leading to erroneous state.
Recommendation
Consider the following changes
function deposit(uint256 amount) external nonReentrant whenNotPaused validAmount(amount) {
_update();
rToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 deCRVUSDAmount = calculateDeCRVUSDAmount(amount);
deToken.mint(msg.sender, deCRVUSDAmount);
userDeposits[msg.sender] += amount;
- _mintRAACRewards();
+ raacMinter.mintRewards(address(this), amount);//@audit-info ensure the minted amount is accurate
emit Deposit(msg.sender, amount, deCRVUSDAmount);
}