Assessment reports>Nibiru>Threat Models>Message: MsgRemoveMargin

Message: MsgRemoveMargin

The MsgRemoveMargin handler is responsible for removing collateral from an existing position and decreasing the margin ratio.

The parameters that are controllable by the user are

  • pair — This is the pair of the open position to remove collateral. It is checked to ensure that it is valid and that there is an open position, a market, and an AMM for it.

  • margin — This is the amount of coins to remove from the position. It is checked to ensure that the amount is positive and that the denom is the same as the specified pair.

When removing margin, any outstanding funding payment is realized and the position's LatestCumulativePremiumFraction is updated to match the market's value. The method does not check the margin ratio, which allows you to remove the majority of the collateral (see ).

Zellic © 2024Back to top ↑