Published in


Permissionless Isolate Margin

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.




Marginswap is a decentralized trading protocol that natively supports overcollateralized loans, spot and leverage trading of tokens on AMMs like Uniswap and SushiSwap.

Recommended from Medium

Introducing Keplerswap Liquidity Pool

A fan of money heist already?

DeFi Daily News,December 15th, 2020

Ukraine Will Regulate Crypto But Not Everyone Is Happy. For A Reason.

Labor Day Week And What It Holds For Bitcoin

Welcome to Arts & Crypto!

The Rise of the Inevitable Creator Economy

Blockchain Tote Bag Subpoena

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Building the last margin trading protocol for AMMs. Follow us at

More from Medium

CS371p Spring 2022: Winnie Chang

Inspector Inchworm

Inspector Inchworm

If the P is low, reject the Ho- How data can be manipulated to “prove” almost anything:

How to Know When Your (SaaS) Company is Broken

Agile and Devops vs Getting Stuff Done