Maladex’s Algorithmic Swap Protocol

A decentralized exchange (DEX) has great importance in the DeFi ecosystem, since it provides exchanges in the token market, providing the fluidity and liquidity necessary for the rest of the platforms. Yes, for the crypto industry, the token market is the money market.

Maladex had already submitted a proposal at FUND5, which unfortunately was not chosen. At the end of the article, I leave the link to the article that was written in AdaPulse.

Maladex offers ADA holders access to the following financial tools and services:

  • Liquidity providing (LP) and farming solution with innovative curve solutions
  • Bridges to all crypto assets, providing one place for trading assets native not only to Cardano blockchain
  • Crypto indexes
  • Crypto financial derivatives (covered options, shorts / calls, etc.)
  • Mirrored (synthetic) instruments allowing trading non-blockchain native assets (eg stocks) and providing additional ways of creating inverted instruments and financial derivatives (via collateral)
  • Develop educational materials and access to data and indicators decreasing information asymmetry and helping people make more informed investment decisions

The tokens will be distributed as follows:

Decentralized Money Market

In the development of a DEX (decentralized exchange, and without custody), is essential liquidity, where exchange of one asset for another is facilitated without affecting the price of the asset, at the current market value perceived. 

So the model is the mathematical definition of the system. The CFMM and AMM are low liquidity models. 

AMM (Automated Market Maker), allows automatic operations preserving certain properties such as route independence and negotiation, without any active interaction on the part of the manufacturer (manufacturers are the ones that provide assets to the liquidity pool). 

CFMM (constant function market maker), is an AMM model but uses a constant function; the most famous example is the Uniswap v1 / v2 model of x * y = const.

The Maker is the part that provides liquidity to the market (liquidity pool). The Taker is the part that exchanges in the market (for example, it exchanges token A for B).

In the development of the DEX, the accounting model is key. In Ethereum and many other smart contract blockchains, they employ the account model, where the global state is shared and all operations are applied sequentially. Cardano uses the eUTxO model, where all assets are stored in boxes that can be spent using a private key (for example, wallet transactions) and a script in Plutus, (the private key and the script are locked in the box). The wallet balance is the sum of all the eUTxO that the wallet can spend. Each eUTxO must be spent when used, therefore it can only be used once per block (20 seconds). 

A consequence of the application of the eUTxO model is concurrency, which places all the group’s liquidity in one eUTxO, which leads to requiring an off-chain sequencer to build transaction blocks (but at the cost of centralization) or power perform only one transaction per block.

In the exchange of money occurs arbitrage, taking advantage of the inefficiency of the market between the trading venues (exchanges). As long as there is a price difference between the exchanges, there are trades more profitable than the cost of execution, and arbitrage is possible. 

In the money market something undesirable occurs, slippage, which is the difference between the expected price of a trade and the price at which it is executed. In the AMM model, slippage occurs due to insufficient liquidity compared to the amount of assets being exchanged.

Thus, capital efficiency has many ways of being realized, when one way consumes fewer resources (energy, time, etc.) than another is more efficient.  

In the liquidity assistance operation, impermanent loss may occur, that is, the loss of capital in comparison if it had been made “HODLing”, instead of investment in the liquidity pool, due to inherent flaws in the fund formula of liquidity. The worst offenders are ironically the most popular family of constant product groups, such as v1 / v2 x * y = const from Uniswap. It occurs when a pair of assets is provided to a liquidity pool, since the relationships between “x” and “y” change in the pool and the more prices diverge, the greater the impermanent loss. 

Liquidity models, including those currently being developed in DEXes at Cardano, do not model markets well (model-related, market efficiency, and impermanent loss), leading to low capital efficiency.

Maladex Proposes a Control Algorithm 

The proposed solution is to create a Maladex Algorithmic Automated Market Making (AAMM), using both chain and external data, to provide telemetry that helps to visualize capital efficiency and the risks involved (for example, automatically alert if the pair’s reserves are negatively or weakly correlated). 

In this way, market makers will be able to make much better decisions. 

Currently, the most prevalent liquidity pool models such as the CFMM and among them x * y = const are extremely inefficient in terms of capital.

In x * y = const and other CFMMs, liquidity is provided equally throughout the liquidity space defined by all (x, y) on the supply curve. This means that there is the same amount of energy reserved for liquidity that will be provided in the least probable scenario (for example, ADA goes to 0 and USD to infinity) as in the most probable scenario (that is, the current trading price) . This is incredibly wasteful and, worse, leads to an unnatural market model.

Since space is sufficiently continuous, prices are naturally geometric in nature, that is, with sudden jumps. 

Therefore, the solution is to design quantitative models for liquidity funds.

In the case of concurrency, it was shown that most blockchain developers think of liquidity pools in very simplistic terms. It is easier to design a pool with global memory, but then, in the case of the eUTxO model, it leads to 1 transaction per block (20 s), or in case the optimization has memory problems 16 KB per transaction and 65 KB per block .

Shifting from monolithic blocks of liquidity to fragmented nodes reflecting separate market-making decisions naturally leads to the emergence of geometric pricing models.

In Uniswap v3, due to the introduction of concentrated liquidity and observed indices, the same thing arises. People specify liquidity in ranges that they think are good market-making ranges, and provide liquidity only within this range. As a result, a geometric pricing model emerges from all the concentrated liquidity.

Therefore, by fragmenting liquidity into separate nodes, all kinds of geometric distributions emerge naturally, giving very efficient and market-reflective pricing and liquidity models.

When combined with the Maladex liquidity scripting language, it allows the expression of all kinds of market sentiments and thus the emergence of a true market distribution. Manufacturers’ orders in the liquidity pool express their belief in the market, and given a large enough sample, it naturally begins to reflect all of the true belief in the market.

So not only is there no concurrency problem, if we deal with this extremely complex array of chart routing and ordering, it leads to some very desirable properties.

Concurrency has yet to be built into the system, but this is a routing algorithm for eUTxO block charts.

In the eUTxO and script validation mechanism model, arbitrage can be incorporated into a liquidity protocol. It will put market makers in the role of conducting additional transactions (and earning additional fees). For buyers, it will provide an efficient market price on Maladex that reflects the actual market price at any given time. For the other applications, it will provide invaluable value in the chain. 

All exchanges, even the most sophisticated centralized ones, offer a very limited number of order types, leading to a lot of manual work and monitoring of market conditions, and the inability to express dynamic conditions such as when the price starts to rise. quickly, buy back, when the price starts to drop, sell quickly, creating a limit order. 

The proposal is to design a Maladex own order scripting language, which allows expressing complex market sentiments and allowing the drafting of contracts. This is similar to the idea described by Simon Peyton Jones at:

With this scripting language, you define the most commonly used order types (market, limit, liquidity pool, etc.) and allow access to the scripting language.

Definition of Success

1 month: collect chain telemetry, categorize financial assets, apply stochastic modeling, design fragmented liquidity model, draft white paper

3 months: publish AAMM research paper, implement protocol in Plutus and Haskell, testnet evaluation, stress and performance tests

6 months: launch of the AAMM exchange protocol.

12 Months: establish a new market-making industry standard that demonstrates the superiority of the eUTxO model and, with protocol design, takes the DeFi ecosystem to the next level.


This project started in April 2021. The developer tells us that he has made personal contributions amounting to almost USD 25,000, to hire a graphic designer, who created a large amount of custom art, also developers through Upwork, a certain amount of money for the infrastructure that hosts Cardano’s private testnet, the current website and the MAL stakeholder group, and other marketing expenses.

The developer had offers from venture capitalists that it has not taken so far, as one of the goals of the project is economic decentralization (fair and wide distribution of tokens in the community).

This project should receive significantly more funding due to its complexity and all that its delivery implies, but due to the experience gained in FUND5, knowing the popularity of other projects in the same category, dcSpark, Minswap and Indigo, they have decided to reduce the amount of financing, to be eligible, since qualifying in fourth place will become creditors of the funds.

The allocation of funds is detailed as follows:

  • 320 hours of research and quantitative modeling of the AAMM protocol, writing of the publication
  • 320 hours of implementation and engineering test
  • 80 hours of front design engineering

Average price per hour USD 70 incl. VAT and taxes.

Funds Requested USD 50,000

The Team

Mallabs a group of Haskell native, quantitative financial researchers, developers with years of experience building advanced and scalable business systems at leading financial institutions.

Jarek, is the founder and lead developer of Maladex. 

He has a Master’s in Computer Science from the University of Edinburgh (where Phil Wadler and Aggelos Kiayias research and teach) with a specialization in concurrent and distributed systems, functional programming, and formal methods. Head of Platforms in an international bank leading 3 teams, designing and building complex financial systems. He worked at Citadel Securities in the design and construction of a novel approach to market making. At Microsoft Research, he was involved in the design and implementation of highly scalable (clustering) machine learning algorithms used in Microsoft Office and Windows analytics (exabyte data processing). He is a seasoned Haskell developer, used Haskell multiple times in personal and commercial applications, active conference participant, and Haskell hackathons. He completed the first cohort of the Plutus Pioneer program and got NFT to prove it.

Jarek is SPO of the stake pool [MAL].


You can see the original proposal for this FUND6 on Catalyst.

Another proposal for this FUND6: Maladex: Cardano Index Funds
The first proposal in Catalyst FUND5, in this AdaPulse article: The Maladex (formerly known as the Daemon Exchange)

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts