The depositMargin() function allow user to deposit an amount of margin collateral to their tradingAccountId. Each collateral has their own configuration such as loanToValue, priceFeed, depositCap etc. The function call checks the user deposit does not exceed the depositCap. If it does, the call reverts.
The issue here is that during the settlement of an order, the depositCap has been ignored, as can be seen in the _fillOrder() function below:
If a position has a positive PnL, the amount will be credited to the user's position through a tradingAccount.deposit() call without checking if the collateral depositCap has already been reached.
breaking the `depositCap`limit
Manual review
After the PnL deposit, add a _requireEnoughDepositCap() check to the _fillOrder()
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.