0.0.1 • Published 28 days ago

mynth-swaps v0.0.1

Weekly downloads
-
License
-
Repository
-
Last release
28 days ago

Mynth Swaps

Mynth Swaps is a distributed orderbook DEX that facilitates peer-to-peer (P2P) trustless swaps of tokens. Users can create composable atomic swaps while maintaining full custody and delegation control of their assets at all times.

This protocol is designed to address many of the shortcomings of previous DEX implementations by empowering users to deploy their own script addresses. Unlike common Automated Market Maker (AMM) DEXs, Mynth Swaps uses a distributed orderbook to allow for efficient off-chain processing. This design helps keep trading strategies confidential while ensuring that all swaps require zero trust.

The protocol supports two types of swaps, as well as extensions. The first type, a one-way swap, functions as a basic limit order – users can set a specific price at which they are willing to exchange one token for another.

The second type of swap is a two-way swap, which functions as a liquidity pool owned by individuals. These swaps incentivize users to contribute liquidity to the protocol to earn fees from the spread.

Although one-way swaps are straightforward, they can be extended with additional programmable capabilities, such as swap forwarding and price following. Currently, only swap forwarding is implemented.

The protocol is designed with composability and extensibility in mind, allowing for easy addition of new features and integration with other Cardano DeFi protocols.

Acknowledgements

Some of the smart contracts are based on those from fallen-icarus/cardano-swaps, with modifications that deviate from the original protocol, including:

  • Extensibility via plugins, a feature we call “power of attorney,” which allows additional features to be incorporated into the protocol without the need to redeploy or modify the core smart contracts.
  • Standardized formatting to enhance reviews, audits, and maintainability.
  • Performance improvements to the contracts, including the removal of custom debug names and debug strings.

Motivation

We evaluated Cardano’s existing DEX landscape and found it lacking in the capabilities needed to realize our vision of making Cardano an interoperability hub.

Cardano’s DeFi ecosystem suffers from isolation. Previously, many protocols did not support integration both within and outside of Cardano. For example, executing a multi-hop swap using multiple protocols simultaneously has been challenging. Moreover, swapping a Cardano token for a non-Cardano token has, until now, been impractical.

Many Cardano DEXs lock users’ assets into rigid and possibly centrally controlled scripts. When users provide liquidity, they relinquish their ownership rights, entrusting third-party scripts. This leads to large on-chain pools of isolated liquidity, which are attractive targets for exploitation.

An alternative approach utilizes the full potential of Cardano’s eUTxO architecture. Rather than pooling all tokens into single addresses, Mynth Swaps allows users to retain full control and segment liquidity across the blockchain, facilitating easy querying and executing of swaps. This secure design permits users to move liquidity freely while supporting easy modifications and upgrades.

Mynth Swaps also supports concurrency, enabling efficient swaps regardless of the number of users, without the need for centralized or permissioned batchers. This allows users to confidently execute swaps trustlessly.

With the limitations of existing protocols in mind, we sought a new solution that supports full custody and composability. Users should be able to swap any token for any other token, including across different blockchains, which is the foundation upon which this project is built.

For more insights into the philosophy behind Mynth Swaps, you can refer to the insightful fallen-icarus/cardano-swaps README. Other sources of inspiration include Axo, Genius Yield, Minswap, and SundaeSwap. The extensibility and “power of attorney” feature were notably inspired by SundaeSwap, which in turn took inspiration from Axo. We aimed to blend all these concepts to enhance Cardano’s DeFi capabilities.

License

This project is licensed under the GNU Lesser General Public License (LGPL). Modifications and substantial new contributions are covered under LGPL, which allows both modification and redistribution under the same terms as the original.

Original Aiken code components from fallen-icarus/cardano-swaps that were licensed under the Apache License, Version 2.0, remains under their original license. This does not affect the overarching project’s use and redistribution under the LGPL.

  • LGPL License: See the LICENSE file in this repository for the full text of the license.
  • Apache License: Original components retain their Apache License, Version 2.0. See the LICENSE-Apache file in this repository for the full text of the license.

By using or contributing to this project, you agree to the terms and conditions of both the LGPL for new modifications and the Apache License 2.0 for original components.

0.0.1

28 days ago