Description
The LiquidationPool::position()
function provides a snapshot of staked EUROs
and TST
along with accumulated fees and rewards. However, a flaw exists in the calculation process within this function. Specifically, at line 88, the accrued fees in EUROs
for holders based on their staked TST
are miscalculated. The issue arises from considering the entire balance of the LiquidationPoolManager
rather than deducting the LiquidationPoolManager::poolFeePercentage
and allocating it to the protocol.
The correct calculation, outlined in LiquidationPoolManager::distributeFees()
at line 35, involves deducting the LiquidationPoolManager::poolFeePercentage
from the manager's total balance before distributing fees to the holders by calling LiquidationPool::distributeFees()
and then forwaring the remaining to the protocol
The erroneous formula currently used is:
Impact
The miscalculation in displaying holder's assets can lead to an unfavorable off-chain user experience (UX).
Proof of Concept
Proof of Code written with Foundry can be found here. This test shows the difference of funds of a holder when calling LiquidationPool::position()
before and after distribution of the fees.
Recommended Mitigation
Adjust the LiquidationPool::position()
function to incorporate the LiquidationPoolManager::poolFeePercentage
variable obtained from the manager, which will forward the needed funds to the holders and the others to the protocol's multisig. Here's an edited version with the suggested changes:
Tools Used
Manual review
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.