When a deposit is cancelled using cancelFlow()
, the function fails to update totalShares
, leading to inflated share value and incorrect shares calculations for subsequent deposits.
When users deposit into the vault when no position is open (positionIsClosed == true
), the following sequence occurs:
User deposits tokens via deposit()
The deposit immediately calls _mint()
which:
Calculates and assigns shares to the depositor
Updates totalShares
If the deposit needs to be cancelled via cancelFlow()
:
The deposited tokens are refunded
depositInfo
is cleared
However, totalShares
is not decremented
This creates a discrepancy where the totalShares
remains inflated even though the corresponding deposit was cancelled and refunded.
The inflated totalShares
affects the share calculation formula used in _mint()
:
Because totalShares
remains artificially high after cancelled deposits, subsequent depositors will receive fewer shares than they should for their deposited amount. This creates an unfair distribution of shares and incorrect representation of users' ownership in the vault.
Manual Review
Update _cancelFlow()
to properly decrement totalShares
when cancelling a deposit:
Likelihood: None/Very Low, when the keeper call cancelFlow after an order execution Impact: High, Inflation/deflation of total shares, and too many fees refunded.
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.