Particle LAMM Dev Handbook
  • Introduction
  • Logic
    • Overview
    • Open Long
    • Close Long
    • Open Short
    • Close Short
  • Developer
    • Liquidity Provision
    • Open Position
    • Close Position
    • Liquidate Position
    • Long/Short Symmetry
    • Trading Fees
    • Premium Accounting
    • Reclaim Liquidity
Powered by GitBook
On this page
  1. Developer

Close Position

  • Function: closePosition

  • The actual position closing steps are in _closePosition, which implements: swap back the needed amount to repay LP (Base.swap), repay LP (increaseLiquidity), send gains to trader (refundWithCheck), pays for fees (addTokensOwed).

  • Note: caller is authorized by checking the liens[msg.sender, lienId] belonging to the caller is non empty.

PreviousOpen PositionNextLiquidate Position

Last updated 1 year ago