By Jason Ridgway-Taylor

In this post we will introduce Batcher; how it works and why it is different from other DEXs. We refer to Batcher as a batch clearing DEX. This is due to its behaviour of collecting all orders for potential swaps into a batch to be executed at a point after the batch is closed (i.e. no more swap orders can be placed)

- The aim of the batch clearing dex is to enable users to deposit tokens with the intent of being swapped at a fair price with bounded slippage and almost no impermanent loss.
- In comparison to standard AMM type DEXs, Batcher does not have a liquidity pool behind it; it is more akin to an order book DEX rather than an AMM.

Users can deposit tokens during a deposit window; all deposits during this window will form the 'batch'. Once the deposit window is over the 'batch' is 'closed'.  The batch remains closed until Batcher receives an oracle price for the given pair. Receipt of the oracle price triggers the clearing of the orders and the results of swaps are stored in holdings and can be redeemed back to the user's wallet.

In contrast to other DEXs a swap order is not assured to be filled; the result of a deposit for a swap in Batcher could be one of the following:
- Filled - Full amount of the order is swapped for the requested token. Batcher was able to find an order or multiple orders on the opposing side to completely swap the token amount.
- Partially Filled - Only part of the amount of the order is swapped for the requested token with the remaining left in the original token. Batcher found one or more orders on the opposing side but they were not enough to completely fill the requested amount of token.
- Not Filled - None of the amount of the order is swapped. Batcher could not find matching orders to swap the tokens.

Another difference to other DEXs is that users do not define a literal price on a swap order but an offset to the oracle price.

Offset Price Chance of order being filled
Oracle Price - 10 basis Points Worse Better
Oracle Price Flat Flat
Oracle Price + 10 basis points Better Worse

Basis Point - One basis point (bp or bip) is equivalent to 0.01% (1/100th of a percent) or 0.0001 in decimal form. For example, 10 basis points is equivalent to 0.1% or 0.001 in decimal form.

When the batch is closed and the oracle price is received, Batcher will try to find which of the three levels will clear the most orders; this is deemed the clearing price. This level is then used to match orders on a pro-rata basis. The level chosen by a user will depend on their own context and intent behind the swap.  If, as a user,  I want a better chance of a large trade being filled and I am willing to except a lower price I can choose 'Worse Price /Better Fill'; meaning than more counterparties on other side of the trade will likely be interested in the swap and that will maximise the chances of the swap being completely filled. If, however, I am not in a hurry to make the trade and want to hold out for a slightly better price then I can choose 'Better Price /Worse Fill'; meaning that I will maximise the chances of swapping at a slightly better price than the oracle price but there is more chance that my order won't be filled in this batch. If I am agnostic to a worse or better price then I can choose the oracle price.  

How to?

The Batcher UI is deployed to both Ghostnet and Kathmandunet. In order to use the Batcher UI, you will need the testnet representations of the tokens in the pool; these are available via the Marigold faucet.

- STATUS: The status of any current batch that is open to deposits. If no batch is open, then the first deposit will open a new batch.
- BALANCE: The wallet balance of the token being swapped.
- ORACLE PRICE: The last oracle price received by Batcher.
- AMOUNT: The amount of token that should be attempted to be swapped.
- SWAP PRICE: The price offset that is required.
- SWITCH: Switch the side of the swap to the other token in the pair.
- TARGET: The token on the other side of the swap.


In order to deposit tokens you will need to connect a wallet.  Once done, the 'Try to Swap' button will appear, enabling you to choose your parameters and deposit tokens for a swap.

Order Book

If a batch is open you can inspect the contents of the current batch's order book in the 'Order Book' tab.

- AGGREGATE ORDER: This section will display the total aggregate amount (regardless of price level chosen) of each token that is attempting to be swapped in the current batch.
- INDIVIDUAL ORDERS: This section displays the individual orders in the current batch including the price level chosen, type and value.


Once the batch has been cleared, the results will be shown in the Holdings tab.

- HOLDINGS: Any holdings from any previous batches that have not already been redeemed will be shown in the holdings section.
- REDEEM: Holdings can be redeemed back to wallet at any time after the batch has closed and cleared.


Batcher is an experimental DEX targeted at providing deep liquidity via an order matching mechanism. Any and all feedback is welcomed as we look to move toward mainnet.


Marigold Faucet
Marigold Projects
Marigold Learn

*Disclaimer:* All investing comes with risk and DeFi is no exception. The following content contains no financial advice.Please do your own thorough research and note that all users funds are traded at their own risk (No reimbursement will be made and Marigold will not assume responsibility for any losses).

If you want to know more about Marigold, please follow us on social media (Twitter, Reddit, Linkedin)!

Scroll to top