LONG Trading
Exact mechanics, formulas, and numerical example for leveraged LONG positions.
LONG Position LifecycleBase Mainnet · 1.0x–2.0x
Formulas (LongManager.sol)
borrowedUsdc = Math.mulDiv(marginUsdc, leverageBps - BPS, BPS)(floor)grossNotional = marginUsdc + borrowedUsdcopenFee = Math.mulDiv(grossNotional, fc.longOpenFeeBps, BPS)(floor; requiresmarginUsdc > openFee)newDebtShares = Math.mulDiv(borrowedUsdc, RAY, idx, Math.Rounding.Ceil)- Open LTV Check:
Math.mulDiv(posDebtUsdc, BPS, posValueUsdc) <= cfg.longMaxLtvBps(6000bps =60%).