Introducing ZAMM: ZeroOne Automated Market Maker

01 Exchange
4 min readJun 3, 2022

The Zero One Automated Market Maker (ZAMM) is a novel DeFi primitive that brings AMM-like passive liquidity to orderbook-based derivative markets. Built directly on top of 01 Exchange and Serum’s perpetual derivative markets, ZAMM provides deep passive liquidity to the 01 derivative orderbook according to the traditional constant product (xyk) automated market maker model. Similar to how Atrix and Raydium provides passive liquidity to Serum’s spot markets, ZAMM brings this tool to derivative markets.

Why ZAMM?

Currently, 01 Exchange relies on market makers to provide liquidity across all of its markets. While this already makes 01 one of the most liquid DEX’s, liquidity can still be vastly improved by placing passive liquidity across the books. That’s where ZAMM comes to play. ZAMM allows any user to stake their liquidity into the DEX similarly to AMMs. This allows 01 to decrease its reliance on market makers and also guarantee that there is always deep liquidity available for traders.

How doesZAMM work?

ZAMM uses liquidity deposited by stakers to place limit orders on the orderbook corresponding to the well-known x * y = k formula, and rebalances its orders every time it is hit.

Providing liquidity to the ZAMM is slightly different from typical spot AMMs. When staking, LPs deposit both base and quote tokens (for SOL-PERP, that would be SOL and USDC), but when they withdraw, they will receive a combination of SOL/USDC/SOL-PERP [see details below].This way ZAMM is able to ensure that it is properly collateralized at all times.

Here is the more detailed breakdown of what happens inside a ZAMM:

1. LP deposits base and quote into ZAMM

LP deposits funds into the ZAMM and these funds are now part of ZAMM’s margin account.

2. LP calls ZAMM’s crank and rebalances the orders

After the deposit, the LP calls the rebalance instruction. On rebalance, ZAMM cancels all of its orders and places new ones. Now that ZAMM has more funds, it can place orders with larger sizes.

3. Traders trade on the open market

When traders trade on the exchange, they now have access to both active market maker liquidity and passive ZAMM liquidity.

4. ZAMM rebalances continuously

Every time someone trades against the ZAMM, or when a new LP joins, the xy=k formula shifts. This leads to ZAMM rebalancing its existing order sizes, and levels.

5. LP withdraws

In a typical AMM, the staker would have initially deposited X amount of SOL and Y amount of USDC; after some time, he would have been able to withdraw X’ amount of SOL and Y’ amount of USDC. Because ZAMM is not trading on top of SOL-USDC orderbook, but rather on SOL-PERP orderbook, ZAMM’s SOL balance always remains the same. Consequently, there is a chance that if ZAMM lets users withdraw SOL, it will eventually run out of SOL to hand out.

To avoid such a bank run, ZAMM also passes on a position to the staker. This means that on withdrawal, users receive, Y’ amount of USDC, X amount of SOL and X’ — X amount of SOL-PERP(note that if X’-X is negative it means that user will receive a short position).

What are the risks associated toZAMM?

ZAMM is exposed to the risk of impermanent loss just like any other AMM. However, it is important to note that ZAMM can also be exposed to funding payments if funding is opposite to ZAMM’s position.

However, to offset potential losses, ZAMM quotes its orders with a spread allowing users to earn fees on every trade. Additionally, the 01 team is working on multiple updates that can reward ZAMM stakers and increase ZAMM’s profitability.

Next steps for ZAMM

The initial basic implementation of ZAMM only touches the surface of what it can accomplish. Further down the line, it can unlock new primitives, which combined with 01's orderbook, can facilitate even deeper liquidity for traders. This includes, but not limited to:

  • Leveraged LP’ing — Unlike in SPOT AMMs, ZAMM can allow users to use leverage when depositing funds to earn more fees on the protocols.
  • Market maker rebates and token emissions for ZAMM stakers — Future ZAMM iterations can include market maker rebates or token emissions to further incentivize liquidity provisioning.
  • Concentrated liquidity — Another primitive that can be explored is a concentrated liquidity AMM which could be appealing to those who do not want to run their market maker bots, but still want to have more control over their liquidity.
  • Oracle based AMMs — Future ZAMM upgrades can also include oracle based pricing. This can allow ZAMM to be more profitable and rely less on traders to arb the price.

This is only a short list of possible features which can be introduced into ZAMM, and the 01 team is excited to connect with anyone who is interested in exploring this space or building on top of it/ 01.

About 01 Exchange

01 Exchange is a fully decentralized orderbook-based derivatives exchange on Solana, supporting perpetual futures and power perpetuals. It features an on-chain limit orderbook through a deep integration with Project Serum, cross-collateralization, powerful cross-margining, and yield-earning deposits, all without sacrificing on decentralization. To learn more about 01 Exchange, visit https://01.xyz/ or https://twitter.com/01_exchange.

Website | Twitter | Discord | Medium

--

--