The _isFundIdle function uses an overly simplistic check that only considers raw collateral token balance against minDepositAmount. This implementation fails to account for fragmented balances and trapped funds below the minimum threshold, leading to capital inefficiency.
The current implementation of the _isFundIdle function does not take into account fragmented balances from multiple deposits, accumulated funding fees, remaining amounts from position closures, and post-liquidation balances.
The root of the problem comes from using minDepositAmount as a hard threshold to detect idle funds. This causes if balance < minDepositAmount, the funds cannot be used for new positions.
Funds trapped due to being less than minDepositAmount cannot be used for new positions.
Manual review
Implement auto-compounding for fragmented balances.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.