Protocol assumes that the price of usdToken is equal to 1, Making users suffer huge losses when usdToken depeg.
In function _fillOrder()
, globalConfiguration.usdToken
is used as settlement token:
When users have an unsettled PnL > 0, The contract will mint a quantity = unsettled PnL in usd value
of usdToken directly to their margin account; but when users has an unsettled PnL < 0, the contract will deduct the corresponding usd of collateral from their margin account based on chainlink feed.
In the event of usdToken depeg, the entire protocol will be in a death spiral - Once a user incurs a loss, the loss will be calculated in dollar value. But if the user generates a gain, then the gain will be calculated in discounted usdToken. This will eventually lead to a massive wave of liquidations and protocol at risk of insolvency.
Likelihood: low - stablecoin depeg is rare.
+
Impact: Critical - May lead to a massive wave of liquidations and protocol at risk of insolvency.
=
Severity: medium
Manual review
if trader's old position had positive pnl, protocol should mint tokens of corresponding value to the user.
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.