Permissionless Isolate Margin

Published in
3 min readMay 7, 2021


Margin trading is commonly offered in one of two different flavors: isolated or cross margin. Marginswap launched with a cross margin system, which means that the health of a margin trader’s portfolio is calculated jointly, such that gains in one asset can balance out potential losses in another. This approach can save users time, sometimes gas, and headache around rebalancing their portfolio.

What Isolated margin means for Marginswap

Marginswap is a decentralized exchange much like Uniswap, so we believe that users should be able to choose between a more tightly integrated system for lower-risk assets and an open playing field for trading and lending a wider variety of crypto assets for short and long trades. Users should be able to choose between saving gas on rebalancing by going cross margin vs. saving gas on every individual swap by using isolated pairs with cheaper liquidity checks and higher leverage.

Also, with isolated margin, we can open up the system to a much wider range of tokens because lenders decide to take on the risk and the reward of one specific token pair; this interestingly insulates the community as a whole from any of the risks that are associated with cross margin.

How cross margin works

  • Tokens are selected based on liquidity on Uniswap and Sushiswap
  • Lenders supply bonds denominated in any of these tokens using the bond lending page
  • Traders deposit funds in any of the supported tokens using the margin account.
  • After depositing, traders can start swapping with leverage using the swap UI (which closely resembles Uniswap), using not only the funds they deposited but additionally borrowing more of whichever token they want to go short on, up to the leverage level.
  • For a leverage level of 3 (which is the current rate we have during the beta) we ensure that when a user borrows, the ratio of the total value held in the account (borrowed and deposited), divided by the total value of the loan across all assets is larger or equal to 3/ (3–1), i.e. total_assets / total_loan > 1.5
  • Finally, technically savvy community members can stake $MFI to run liquidation bots that liquidate the funds of accounts that dip under a ratio of 1.15.

How isolated margin works

  • Lenders can choose specific tokens A and B to lend to users who want to short A relative to B.
  • Isolated pairs in Marginswap are always directed, i.e., they include the choice of one token as the short token, which users will borrow, and the other is the long token which users will buy and hold, as well as a liquidation path from the long token back to the short token which can span Uniswap and Suhiswap.
  • Users make short A / long B trades on Marginswap, depositing collateral in token A or B, either from their cross margin account or their wallet, upholding the same liquidity and leverage ratios as in cross margin except for the fact that now these ratios are computed for that one token pair only, saving on gas.
  • Finally, liquidators can service isolated pairs same as they would call liquidation on cross margin accounts.

State of isolated margin

The basic contract functionality for Marginswap permissionless isolated margin has been built and has gone through a preliminary audit. We will soon start work on a user interface for isolated margin trading, testing before an audit is contracted.

For more information on the development of Marginswap, please join one of our community channels, website, Twitter, Medium, or Telegram.