Seventh milestone — AMM

Published in
5 min readNov 6, 2021


Greetings Lumenswap community!

AMM is finally here —

After months of waiting, Lumenswap’s AMM has been released. And now it’s time to chant liquidity, liquidity, liquidity.


Before 2019 and the DeFi boom, blockchain advocates touted the upcoming revolution, but DEXs and networks didn’t have enough liquidity. That lack of liquidity slowed down progress and delayed the emergence of fair decentralized financial platforms.

Users aren’t likely to use a network without sufficient liquidity but to attract liquidity, that network needs to have many users. A classic Catch 22!

On top of that, CEXs offer high speeds and low fees. So, if DEXs want to compete, they need a way to break that vicious loop. The rules of the game changed when UniSwap’s founder Hayden Adams came up with a brilliant solution using one of blockchain’s core features: participation.

Hayden built an automatic market maker protocol using constant functions and an elegantly simple formula: x*y=z.

The protocol allows people to lock their assets into a liquidity pool in exchange for a piece of the trading fees on the DEX. This simple mechanism incentivizes people to contribute liquidity to pools instead of simply holding their assets in a wallet. As the pools grow, the AMM can offer better rates thereby attracting more traders.

However, there’s one major problem: as adoption grows, transaction fees become prohibitively expensive because Ethereum and other blockchains aren’t built to handle a large number of transactions per second, i.e., they’re not scalable. And that’s where Stellar comes in: a purpose-built blockchain for financial operations that is both decentralized and secure.

The AMM in Stellar is built into its core, unlike some smart contract-based networks where the functionality is added by third parties. This structure ensures security and neutralizes many smart contract-related attacks.

Protocol 18 allows all users to enjoy the benefits of AMM.

For these reasons, we decided to build our AMM client on Stellar. We’ll talk about the client’s features in the rest of the article.

Lumenswap AMM sections


You can swap your assets on this screen. Of course, not all swap requests will be performed via AMM because OBM may have better rates for certain swaps. Therefore, Horizon will decide on the best rate for the swap.

Nonetheless, we believe that, over time, AMM will grow in popularity and attract liquidity to overtake OBM.

My Pool

This screen lets you see a list of the pools you’ve created.

To create a new pool, click on the corresponding button and select your asset pair on the modal that pops up. Once you input how much of one asset you want to add to the pool, the client automatically calculates the required amount of the second asset based on the pair price.

To deposit liquidity to a pool, you can click on Deposit button and enter your desired amount on the modal that pops up. Once you’ve submitted your transaction, you need to wait until the network confirms it.

If you wish to withdraw your assets, click on the Withdraw button. Note that you can’t make partial withdrawals. If you submit the transaction, all of your liquidity will be withdrawn from the pool.

Note: The relative value of two assets is never constant. In fact, the value can change in the few seconds it takes from the time you submit your request until it’s confirmed on the network. Therefore, when depositing and withdrawing liquidity, you need to express your maximum acceptable variability (called slippage) to account for the quick changes in price. If the actual price at the time of confirming the transaction falls within your range, the transaction will go through. Otherwise, nothing will happen. For example, suppose you want to withdraw 2 USDC and 10 LSP from a pool, and you set your slippage to 1 percent. In that case, you may receive 9.9 USDC and 2.1 LSP in your wallet.


This screen gives you an overview of your assets in various pools on Lumenswap. You’ll also see the Total Value Locked (TVL) and the number of accounts for each pool.

Pool details

Here, you’ll see pool details including operations and your own share of the pool.


This section is also available for OBM and lets you view your account assets.

Finally, we’d like to emphasize that this is version 1 of our AMM client, we aim to constantly improve the user experience, as well as adding valuable new features in the future




A swap interface for the stellar network.