Minter 2: On-Chain Automated Market Maker with Order Book

Minter
8 min readMar 16, 2021

--

TL;DR: Minter 2 will revolutionize the DeFi protocols with its On-Chain Automated Market Maker with Order Book (AMMOB).

Traders will be able to create fixed-price orders in the AMM liquidity pools without having to give up the benefits of those pools. AMMOB will do great for exchanging stablecoins, for example, USDT for USDC. One will have an opportunity to create an order to buy $1,000,000 worth of USDT for USDC at 1% below the market and later sell it at 1% above. Compared to the traditional AMM pools, AMMOBs have better liquidity: in some areas, the price curve becomes a horizontal line.

The blockchain fees (spread among validators and delegators): $0.08 for creating an order and $0.01 for canceling it. An additional 0.2% on the volume that has been filled goes to a liquidity pool (or liquidity providers). The fees can be paid in any token issued on the network.

Minter App

Automated Market Maker: Pros and Cons

The Automated Market Maker (AMM) algorithm was first proposed by Vitalik Buterin on October 3, 2016. Today, it is used in the largest DeFi projects such as Uniswap ($5B in liquidity, $1B in daily trading volume).

BTC/USDT order “book”

AMM is unique because it doesn’t use an order book to determine the asset’s value. On traditional crypto exchanges, the price is determined by supply and demand, where the highest price is the one at which someone is willing to buy, and the lowest, to sell.

Instead, AMM uses one pool with two tokens inside. When one is swapped for the other, the token sold goes into the pool, and the token purchased, back to the user. As a result, the trader doesn’t need to have a counterparty or set the price. Since anyone can transfer a token and users don’t have to worry about matching, we easily solve the problem of initial liquidity.

The amount to be returned after exchange is derived from the automated market maker formula. The graph below illustrates how it works. In essence, the amount returned depends on the in-pool ratio between Ether and a given token. Regardless of the volume, the user’s order is guaranteed to execute because the more of the asset you add to either side of the pool, the further along the curve it takes you toward the other asset. Which means the bigger the order, the less appealing the price.

Change in the price of token A in an AMM pool depending on the quantity bought

The AMM’s big disadvantage is inability to place limit orders. It leads to the following shortcomings:

  1. Traders can’t buy or sell tokens at the pre-specified price, the only option is to swap “at the market”
  2. AMM pools aren’t suited for exchanging stablecoins, for example, USDT for USDC. The floating exchange rate means a high probability of getting an unpleasant rate in the case of large amounts
  3. Liquidity is limited at low spreads

On-Chain AMM with Order Book

Automated Market Maker with Order Book (AMMOB) is the next stage in the evolution of DeFi protocols. Apart from regular AMM pools, one can create fixed-price buy and sell orders.

AMMOB solves all mentioned problems at once:

  1. Traders can buy or sell at a fixed price without giving up the liquidity benefits of AMM pools
  2. AMMOB pools are suitable for exchanging stablecoins, for example, USDT for USDC. One will have an opportunity to create an order to buy $1,000,000 worth of USDT for USDC at 1% below the market and later sell it at 1% above
  3. An AMMOB is more liquid than a traditional AMM pool: in some areas, the price curve becomes a straight line

Example:

  • The price of BTC stands at $50,000
  • The buyer places an order to buy BTC at $49,000
  • The seller wants to sell 10 BTC
  • Some of this amount is sold using the regular AMM algorithm
  • As soon as the in-pool price coincides with the one fixed in the order, there’s a sale at the pre-set price
  • The amount that remains after the order has been filled is sold using the regular AMM algorithm once again
Change in the price observed in an AMMOB pool

The fee for exchange of any volume remains unchanged at 0.2%. Pool’s liquidity providers receive it regardless of whether the purchase is made using their funds or via limit orders. It generates extra earnings for providers and therefore makes liquidity provision itself more attractive.

AMMOB fees:

  • $0.08 for placing an order
  • $0.01 for canceling
  • $0.03 for an executed market order
  • 0.2% of the volume filled goes into the liquidity pool

Limitations:

  • The minimum order size is $10

Minter Hub

Minter Hub is a decentralized bridge interconnecting Minter, Ethereum, and Binance Smart Chain. In Minter 2, you’ll be able to store, transfer, and exchange most of the major digital assets (e.g., BTC, ETH, BNB, USDC) with its help.

More on Minter Hub: https://daniillashin.medium.com/minter-hub-bridge-to-ethereum-binance-smart-chain-dd78cde2ad51.

Opportunities Opened up by Minter 2 + Minter Hub

How do automated market makers, such as Uniswap or Pancake, that facilitate the exchange of tokens on blockchains differ from the one Minter 2 has built in? Ours wins in terms of speed (blocks are final in five seconds), transaction fees ($0.03 per trade), and throughput (hundreds of swaps per second). That is just a few features that have been implemented already, while Minter 2’s AMM can be integrated into vital processes using even more efficient methods. For instance, fees can be expressed in U.S. dollars for simplicity but paid in any token of your choice.

The system will get even cooler once you can insert order books at its core level, meaning the ability to set specific prices and volumes that you want to buy or sell. If other blockchains require separate smart contracts or Layer 2 solutions for such purposes — leading to slower confirmation times and higher transaction costs — then in Minter 2, it’s not only prepared and being tested already but can also be improved significantly. Faster blocks, lower fees, new exchange formulas, you name it.

The new economics is centered around the idea that BIP holders (stakers) will profit from the trades. It means that all returns from trading will be shared among the community. What’s more, every coin and token will be converted into BIP when paying the fees for any operation, implying an increasing demand for BIP.

Minter 2 is connecting to the leading blockchains in the DeFi sector — Ethereum and Binance Smart Chain — to take the top cryptocurrencies, tokens, and digital assets away from there by offering not just best but unique trading terms. Today, trading comprises 90% of the DeFi market, and in this area, we’ll be a go-to pick for both traders and BIP holders. It’s highly likely that no one will ever come up with an offering nearly as good as ours. We’re the only ones who’ve been focused on the free exchangeability (liquidity) of tokens since 2017, from the very beginning. While everyone else was inventing ‘Swiss Army knives’ doing nothing extraordinary (often bad and expensive), we were improving our ‘Kalashnikov’ with just one goal in mind: making thousands of trades every second without a single failure.

Minter App

In its operation, Minter App will be using three blockchains simultaneously — Minter 2, Ethereum, and Binance Smart Chain — selecting the best options, including prices, in each of them. For example, if for a large-volume exchange, it’ll be reasonable to turn to the BSC’s Pancake pools, that’s where a decentralized transaction will take place.

This will all become possible thanks to Minter Hub, which interconnects the three networks. The fee for moving coins cross-chain is 1%, and it can go down if you own the HUB token on one of your addresses. Earlier, 50,000 HUB has been distributed among Minter community members for their achievements so that they could get the best terms in all Minter services. The expected number of tokens necessary to participate is 1–256 HUBs.

At the time of writing, HUB is traded in a Uniswap pool and DeFi bot at +$30.

Math of Deals

To calculate the number of tokens that will trigger the execution of a limit order, let’s first define these:

There’s a BIP/USDT pool with a liquidity of 440 and 110 tokens, respectively. 1 BIP = 0.25 USDT. According to a limit order, BIP should be sold for the price of 0.5 USDT (at this point, we don’t take volumes into account). We need to calculate how many BIPs need to be bought in order for the price to reach 0.5. Let’s find T_0.

To begin with, let’s find the number of USDTs we’ll need to spend by putting them into the pool:

Hence, the number of USDT tokens in the pool will now be:

Knowing the constant (Q_0 * Q_1), we can calculate how many BIPs will stay in the pool:

Hence, the number of BIPs we need to take out from the pool is:

Checking the price:

The full formula that determines what number of BIP tokens is needed to reach a given price:

Verifying:

--

--

Minter

Supporting development and adoption of Minter, a digital assets marketplace powered by a fast blockchain. Other social media: minter.org/#follow