Redepositing of profits when updating market positions, leads to usd Token deposits increasing infinitely, bypassing the deposit cap.
Existing trading accounts can deposit collateral through the TradingAccountBranch.depositMargin()
function, which enforces a total cap that restricts the maximum global amount that can be deposited in the protocol for each collateral type (including the USDz
token):
Reference to code: link
After the cap is reached, deposits revert - this way the protocol control it’s exposure to particular assets.
However when an existing market position gets updated with a new market order through the SettlementBranch._fillOrder()
function, any accrued Profit in the USDz
token before the update is automatically re-deposited without considering any deposit cap limitations:
Reference to code: link
This basically means that as long as there are profits, the deposits will keep on increasing constantly, rendering the deposit cap inefficient.
In case there are a lot of USDz
positions and a lot of them make profits, the total deposits can go way above the expected cap by the protocol and significantly hinder it’s mechanism of regulating and balancing the markets
USDz
deposits will go above the expected maximum cap
Manual Review
Since _fillOrder
is a function that should not revert due to max limits being reached it is understandable that the max cap is not checked here.
A possible approach would be to send the funds to the account owner instead of re-depositing them. This will prevent distortion of the maximum caps and required collateral exposures by the protocol.
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.