Function: executeAdl(EventTypes.Adl adl, uint64 eventId)
This executes auto-deleveraging action. Can be called only by the OperatorManager contract over the eventUpload function, which is available only for Operator.
userPosition.positionQtyshould not be zero.positionQtyTransfer.absshould not be more thanuserPosition.positionQty.
Inputs
adlControl: Full control by operator.
Constraints: Only one check that abs(absolute value) of
positionQtyTransfershould not be more than abs ofuserPosition.positionQty.Impact: N/A.
eventIdControl: Full control by operator.
Constraints: There are not any checks.
Impact: The unique ID of action.
Function call analysis
userPosition.chargeFundingFee(adl.sumUnitaryFundings);External/Internal? Internal.
Argument control?
adl.sumUnitaryFundingsis controlled by caller.Impact: Charge funding fee for
userPosition.
insurancePosition.chargeFundingFee(adl.sumUnitaryFundings);External/Internal? Internal.
Argument control?
adl.sumUnitaryFundingsis controlled by caller.Impact: Charge funding fee for
insurancePosition.
userPosition.calAverageEntryPrice(adl.positionQtyTransfer, adl.adlPrice.toInt128(), -adl.costPositionTransfer)External/Internal? Internal.
Argument control?
positionQtyTransfer,adlPrice, andcostPositionTransferare controlled.Impact: Change
averageEntryPriceandopeningCost.