In the _fillOrder function, when settling PnL, if the PnL is positive, USDz is minted and then deposited into the trading account's margin via tradingAccount.deposit. However, the code does not check whether this deposit would exceed the depositCap limit.
As shown in the code below, before executing tradingAccount.deposit(ctx.usdToken, ctx.marginToAddX18), there is no check to ensure that depositing ctx.marginToAddX18 tokens does not exceed the depositCap limit:
In _fillOrder, when PnL is positive, the margin deposited may exceed the depositCap.
manual
It is recommended to add a _requireEnoughDepositCap() check before executing tradingAccount.deposit(ctx.usdToken, ctx.marginToAddX18).
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.