Message: ADLPerpPosition
This message creates an order to decrease a perpetual position via ADL mechanics, typically initiated when the off-chain executor's risk thresholds are breached and margin health must be preserved.
This message must be dispatched by a trusted executor. Note that all parameters are fully controlled, and the executor is — as always — entirely trusted and responsible for calling this function at the proper time and correctly calculating and providing parameters.
Inputs
The incoming message has the following structure:
tokenIdValidation: Must be a valid
tokenIdin the contract'stokenConfigsmap.Impact: Specifies the token for which the position is being adjusted.
accountValidation: Must have an existing position.
Impact: Specifies the account whose position is being adjusted.
isLongValidation: None.
Impact: Specifies whether the position is long or short.
marginDeltaValidation: None — inherently constrained to an unsigned int and limited by the position's margin.
Impact: The amount of margin to decrease the position by.
sizeDeltaValidation: None.
Impact: The amount of position size to decrease.
trxIdValidation: None.
Impact: Not used by the on-chain contract.
priceValidation: None.
Impact: Used to calculate the PNL to realize.
premiumRateValidation: None.
Impact: Unused by the on-chain contract.
fundingFeeGrowthValidation: None.
Impact: Used to compute the funding fees.
rolloverFeeGrowthValidation: None.
Impact: Used to compute rollover fees.
Test coverage
Intended branches
Negative behavior