Assessment reports>Tradoor>Threat Model>Message: ADLPerpPosition

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:

message ADLPerpPosition { tokenId: Int as uint16; account: Address; isLong: Bool; marginDelta: Int as coins; sizeDelta: Int as coins; trxId: Int as uint64; price: Int as uint128; premiumRate: Int as int32; fundingFeeGrowth: Int as int128; rolloverFeeGrowth: Int as int128; }
  • tokenId

    • Validation: Must be a valid tokenId in the contract's tokenConfigs map.

    • Impact: Specifies the token for which the position is being adjusted.

  • account

    • Validation: Must have an existing position.

    • Impact: Specifies the account whose position is being adjusted.

  • isLong

    • Validation: None.

    • Impact: Specifies whether the position is long or short.

  • marginDelta

    • Validation: None — inherently constrained to an unsigned int and limited by the position's margin.

    • Impact: The amount of margin to decrease the position by.

  • sizeDelta

    • Validation: None.

    • Impact: The amount of position size to decrease.

  • trxId

    • Validation: None.

    • Impact: Not used by the on-chain contract.

  • price

    • Validation: None.

    • Impact: Used to calculate the PNL to realize.

  • premiumRate

    • Validation: None.

    • Impact: Unused by the on-chain contract.

  • fundingFeeGrowth

    • Validation: None.

    • Impact: Used to compute the funding fees.

  • rolloverFeeGrowth

    • Validation: None.

    • Impact: Used to compute rollover fees.

Test coverage

Intended branches

Negative behavior

Zellic © 2025Back to top ↑