Assessment reports>Orderly Network>Threat Model>maintenanceMargin

Function: maintenanceMargin(AccountTypes.PerpPosition position, int128 markPrice, int128 baseMaintenanceMargin)

This is a function that calculates the maintenance margin for a position.

Inputs

  • position

    • Control: Fully controlled by the calling function.

    • Constraints: Assumed to exist.

    • Impact: The position to calculate the maintenance margin for.

  • markPrice

    • Control: Fully controlled by the calling function.

    • Constraints: None.

    • Impact: The mark price to use in the calculation.

  • baseMaintenanceMargin

    • Control: Fully controlled by the calling function.

    • Constraints: None.

    • Impact: The base maintenance margin to use in the calculation.

Branches and code coverage

Intended branches

  • Assumed it is called somewhere. This is not the case, as no "health" checks are performed on either the account or the position.

Negative behavior

  • Should not have precision issues due to casting/rounding. This is not particularly tested.

Zellic © 2024Back to top ↑