Within the MarginCallPrimaryFacet#_performForcedBid()
above, in the case of m.cRatio == m.minimumCR
, false
is supposed to be stored into the m.loseCollateral
. Because in the case of m.cRatio == m.minimumCR
, the maintain CR (m.cRatio
) does not below the minimum CR (m.minimumCR
).
However, within the MarginCallPrimaryFacet#_performForcedBid()
above, even when m.cRatio == m.minimumCR
, true
would be stored into the m.loseCollateral
, meaning the Shorter loses leftover collateral despite their CR does not below the minimum CR (m.minimumCR
).
Within the MTypes library of the DataTypes contract, the MarginCallPrimary
struct would be defined. And the cRatio
and the minimumCR
and the loseCollateral
would be defined as a property of it like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/libraries/DataTypes.sol#L221
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/libraries/DataTypes.sol#L227
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/libraries/DataTypes.sol#L232
Within the MarginCallPrimaryFacet#_performForcedBid()
, the true
would be stored into the m.loseCollateral
if maintain CR (m.cRatio
) above minimum CR (m.minimumCR
), meaning a Shorter loses leftover collateral like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/MarginCallPrimaryFacet.sol#L213
Within the MarginCallPrimaryFacet#_performForcedBid()
above, in the case of m.cRatio == m.minimumCR
, false
is supposed to be stored into the m.loseCollateral
. Because in the case of m.cRatio == m.minimumCR
, the maintain CR (m.cRatio
) does not below the minimum CR (m.minimumCR
).
However, within the MarginCallPrimaryFacet#_performForcedBid()
above, even when m.cRatio == m.minimumCR
, true
would be stored into the m.loseCollateral
, meaning the Shorter loses leftover collateral despite their CR does not below the minimum CR (m.minimumCR
).
A Shorter loses leftover collateral despite their CR does not below the minimum CR (m.minimumCR
).
Foundry
Within the MarginCallPrimaryFacet#_performForcedBid()
, consider modify the condition like this:
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.