StabilityPool's deposit function fails to properly track user deposits when multiple users deposit tokens. The balance tracking mechanism doesn't correctly handle the relationship between user deposits and the total pool balance. This could lead to accounting discrepancies in the stability system.
Looking at the StabilityPool deposit implementation
The issue stems from the interaction between:
Token transfers (rToken)
DEToken minting
User deposit tracking
Reward minting
The current implementation assumes a direct 1:1 relationship between deposits and DEToken minting, but the exchange rate calculation in calculateDeCRVUSDAmount can create discrepancies.
StabilityPool contract, a core component of RAAC's real estate liquidity system, contains a significant flaw in its deposit tracking mechanism. The issue emerges at the intersection of user deposits, DEToken minting, and the protocol's reward distribution system.
Notice how the StabilityPool's deposit function attempts to maintain three critical balances:
The actual rToken balance held by the pool
User deposit accounting via userDeposits mapping
DEToken minting that represents user shares
The mistake is in the assumption that these three values will always maintain perfect synchronization. Let's look at the deposit() key interaction:
This flow involves:
StabilityPool.sol: Main deposit logic
IStabilityPool.sol: Interface defining deposit behavior
DEToken.sol/IDEToken.sol: Minting share tokens
RAACMinter.sol/IRAACMinter.sol: Reward minting through _mintRAACRewards()
The vulnerability stems from the misalignment between recorded deposits and actual DEToken minting.
This means that when a user deposits 100 rTokens, they receive DETokens based on calculateDeCRVUSDAmount(), but their userDeposits balance increases by the raw deposit amount. This can lead to a state where:
The impact is precise. Users depositing during certain pool conditions could receive more or fewer DETokens than intended, directly affecting their share of stability rewards and their voting power in the protocol's governance system.
this is the trigger
Notice how the contract maintains three distinct balances, physical rToken holdings, DEToken supply, and user deposit records. These should move in perfect harmony, like a well-orchestrated dance. However, there's a critical misstep.
Let's explore what happens when Alice deposits 100 rTokens into the pool:
The protocol now thinks Alice has deposited 100 tokens, but she only received 90 DETokens. The implications ripple through the entire system, her voting power in the dual-gauge system is misaligned, her share of stability rewards is incorrect, and the fundamental accounting that underlies RAAC's real estate liquidity mechanism is compromised.
To fix, it requires aligning deposit records with actual DEToken minting, ensuring the protocol's governance and stability mechanisms operate on accurate data. This maintains RAAC's vision of seamless real estate integration with DeFi while preserving the integrity of its economic model.
The Interaction Flow:
StabilityPool receives deposit call (IStabilityPool interface)
RAACMinter updates rewards (`IRAACMinter` interface)
DEToken mints share tokens (IDEToken interface)
StabilityPool records deposit amount
RAACMinter distributes rewards based on recorded deposits
The vulnerability creates a discrepancy between steps 3 and 4, where the recorded deposit amount doesn't match the actual DEToken shares minted.
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.