Core Contracts

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

Allocation mismatch in stabilitypool.sol

Summary

The updateAllocation and updateMarketAllocation functions in the StabilityPool contract contain a mathematical error in calculating the total allocation, which could lead to incorrect allocation tracking.

Vulnerability Details

The functions use incorrect arithmetic when updating the total allocation:
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/StabilityPool/StabilityPool.sol#L146
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/StabilityPool/StabilityPool.sol#L383

This calculation order can lead to incorrect results when reducing allocations, as it first subtracts the old allocation and then adds the new one, rather than calculating the net change.

Impact

Incorrect tracking of total allocations in the system

misalignment between individual allocations and total allocation

affect smanager/market distribution calculations

Tools Used

manual audit

Recommendations

use this instead
totalAllocation = totalAllocation + newAllocation - oldAllocation;

Updates

Lead Judging Commences

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

StabilityPool::calculateRaacRewards uses contract balance for reward calculation, incorrectly including tokens meant for manager allocation - Manager allocation not implemented

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

StabilityPool::calculateRaacRewards uses contract balance for reward calculation, incorrectly including tokens meant for manager allocation - Manager allocation not implemented

Support

FAQs

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