During a margin call the yield is supposed to be distributed to the TAPP in the call to LibShortRecord::disburseCollateral
according to the natspec, but this only happens if the short has been updated within Constants.YIELD_DELAY_HOURS = 1 hour , given that the minimum liquidation period is 10 hours from the last update made by the user and there’s nothing else in the MarginCallPrimaryFacet::liquidate
function that changes the updatedAt
time, instead of distributing yield to the TAPP it gets sent to the short being liquidated.
A margin call made using MarginCallPrimaryFacet::liquidate
makes a call to the _fullorPartialLiquidation
function which calls LibShortRecord::disburseCollateral
to distribute the yield from the short position. The natspec above disburseCollateral
indicates that a user should lose their yield to the TAPP:
but because short.updatedAt
must be at least 10 for a user to call liquidate
, which is > YIELD_DELAY_HOURS
(1) and the time to allow liquidation is counted from the last update to the short this guarantees that for a liquidator to call liquidate at least 10 hours will have to have passed from the last update:
MarginCallPrimaryFacet::_canLiquidate
the isNotRecentlyModified
boolean will be true and therefore add the yield to the ethEscrowed
of the user instead of the TAPP.
Shorters always receive the yield from their position when being liquidated.
Manual Review
Add a boolean liquidating
to ensure that the yield gets sent to the TAPP during liquidations:
MarginCallPrimaryFacet::_fullorPartialLiquidation
L221, L236:
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.