Deposits will exceed the intended cap.
The error is in the handling of the deposit cap:
The depositMargin function checks if the new deposit plus the already deposited amount is less than or equal to the deposit cap. However, it doesn't update the totalDeposited
value after a successful deposit.
This means that subsequent deposits will be checked against an outdated totalDeposited
value, potentially allowing deposits to exceed the intended cap.
Deposits will exceed the intended cap.
Manual Review
`// Perform the check before the deposit
_requireEnoughDepositCap(collateralType, amountX18, depositCapX18, totalCollateralDepositedX18);
// Get the tokens
IERC20(collateralType).safeTransferFrom(msg.sender, address(this), amount);
// Perform the deposit
tradingAccount.deposit(collateralType, amountX18);
// Update the total deposited amount
marginCollateralConfiguration.totalDeposited = marginCollateralConfiguration.totalDeposited.add(amount);
emit LogDepositMargin(msg.sender, tradingAccountId, collateralType, amount);`
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.