There is a logical error in the PerpetualVault.sol contract which causes the totalDepositAmount to be inflated and not reduced properly when positions are liquidated on GMX. When a liquidation occurs (partial or complete), the collateral balance of the position on GMX is reduced, but the contract fails to decrease its totalDepositAmount accordingly.
This mismatch creates a significant problem because the totalDepositAmount is used to determine how much can be deposited into the contract. Since liquidations reduce the actual collateral without updating the tracked amount, the contract maintains an artificially high totalDepositAmount. This effectively reduces the amount of new tokens that can be deposited into the contract, as the system believes more funds are deposited than actually exist.
Initial state:
Contract has totalDepositAmount = 90000 USDC
Maximum Deposit = 100000 USDC
Position gets liquidated on GMX:
GMX position reduced to 0
Contract's totalDepositAmount remains at 90000 USDC incorrectly meaning the maximum that can be deposited into the contract is 10000 USDC.
New deposits are limited by the incorrect totalDepositAmount
Update the totalDepositAmount when handling liquidations from GMX. This ensures the deposit limit accurately reflects the actual amount of collateral in the system after liquidations.
Likelihood: Low/Medium, when the position is fully liquidated and the vault is full. Impact: High, _transferToken never called when the withdrawn amount is 0 on a deposit. DoS the deposit when the max cap is reached.
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.