Two functions in the StabilityPool contract are affected by the tax mechanism implemented in the RAACToken. In the depositRAACFromPool function, the contract expects the received amount to exactly match the transferred amount; however, since the RAACToken charges taxes on transfers, the actual post-transfer balance is lower than expected, leading to a revert and causing a potential denial-of-service (DoS). Similarly, the withdraw function calculates and emits RAAC reward amounts without accounting for the tax deduction, resulting in inaccurate reward reporting. Although these issues do not directly lead to fund loss, they can disrupt normal operations and user experience, and thus are classified as medium severity.
depositRAACFromPoolFunction Code:
Problem:
The function enforces an equality check on the expected balance increase (preBalance + amount). Since the RAACToken charges taxes on transfers (as shown in its _update function), the actual received amount will be less than amount. This strict equality leads to a revert, effectively blocking deposits and causing a DoS condition.
withdrawFunction Code:
Problem:
The withdraw function calculates and emits the RAAC rewards without adjusting for the tax deducted during the transfer. Consequently, the actual amount received by the user is lower than the emitted raacRewards, which can mislead users and third-party monitoring systems regarding the accurate reward distribution.
The RAACToken’s _update function applies taxes on transfers:
Because taxes are deducted (i.e., amount - totalTax is transferred), the expected balances in StabilityPool functions become inconsistent with the actual values.
Denial of Service (DoS):
The strict balance check in depositRAACFromPool may cause deposits to revert if taxes are applied, effectively preventing the liquidity pool from depositing RAAC tokens.
Inaccurate Reward Reporting:
In the withdraw function, the RAAC rewards emitted do not reflect the net amount received by users, leading to potential confusion and misreporting.
Systemic Disruption:
Over time, these issues can degrade user experience, hinder liquidity operations, and lead to discrepancies in financial reporting within the protocol.
Foundry
Manual Review
depositRAACFromPoolCurrent Code:
Recommended Change:
Instead of requiring an exact match, account for the tax deduction. One approach is to allow a tolerance, for example, ensuring that the postBalance is at least equal to preBalance + (amount - expectedTax) if the expected tax can be estimated, or simply check for a minimum increase:
Alternatively, you could integrate tax logic to compute the expected net amount.
withdrawCurrent Behavior:
The withdraw function transfers RAAC rewards and emits the nominal reward amount without accounting for taxes.
Recommended Change:
Compute the actual net amount received by checking the contract's RAAC token balance before and after the transfer, then emit that actual value:
This ensures the event reflects the actual rewards received by the user.
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.