camlCase announces the launch of Dexter, our decentralized exchange for Tezos.
on September 30, 2020
The world of DeFi has come a long way since we first announced "DEXter" to the world in July 2019. With countless hours of smart contract development, iteration and testing behind us, we are excited to announce the launch of Dexter today, September 30, 2020. For those who have been anxiously awaiting Dexter's launch since our initial announcement, thank you for your patience!
Check out Dexter now at dexter.exchange
As of launch, tzBTC and USDtz are the two FA1.2 tokens available to trade on Dexter. The smart contracts have been deployed here for tzBTC and here for USDtz. More are on the way. Staker DAO’s BLND token is expected to be available on Tezos in a few months, and we have heard of other projects working to bring more assets to Tezos in the near future.
What is Dexter?
Dexter is a non-custodial decentralized exchange. Specifically, it is a constant product automated market maker, similar to Uniswap. If you want to read up on how it works, check out our documentation, which we will continue to improve.
Here’s a quick summary, from a user’s perspective:
You can use Dexter in two ways: as a trader, and as a liquidity provider. A trader can use Dexter to exchange between XTZ and FA1.2 tokens. Users pay a fee of 0.3% of the trade. This fee is used to incentivize liquidity providers.
Anyone can become a liquidity provider by providing an equal value of XTZ and an FA1.2 token to a liquidity pool. In return you will receive liquidity pool tokens, which track your proportional share of the pool’s earned fees. At any time, a liquidity provider can redeem their pool tokens for the XTZ and FA1.2 tokens they originally provided.
Web — Thanos and Beacon
If accessing Dexter from a desktop web browser, we suggest you connect via the Thanos web wallet. Soon you will also be able to connect with your Ledger Nano via Beacon (which can also can also be used as a web wallet), but there are still a few issues to be resolved before we make it available as an option. Although Thanos is a very user-friendly wallet, we have created some tutorials to help get you started using it with Dexter.
Magma Wallet Integration
Dexter will be natively integrated into our mobile wallet, Magma. The work on this mobile feature is mostly complete, and we will roll it out in a few weeks. At first, only trading will be available, but soon we will allow users to provide liquidity from within the app as well. This will be the first step in making Magma a DeFi-first mobile wallet for Tezos.
To ensure that liquidity providers receive staking rewards in addition to trading fees, exchange contracts are delegated to reliable bakers. To start, the tzBTC and USDtz pools will be delegated to Happy Tezos. They will provide their usual service, and pay out directly to the accounts providing liquidity, instead of the pool itself.
In the future we may partner with other baking services, or provide a service ourselves. The ultimate goal is to come up with a decentralized method for selecting bakers, and we are working on a few ideas for Dexter v2. You can find more info here.
While Dexter’s backend is decentralized naturally because of the architectural benefits of smart contracts, the Dexter web UI does not inherently share the same benefits. To solve this, camlCase has distributed Dexter’s UI across an IPFS cluster which is a decentralized file sharing network that anyone can participate in. This makes it difficult for any entity to censor the Dexter UI.
Development in Morley/Lorentz
Dexter was written in Lorentz, a Haskell eDSL for Michelson smart contracts from the Morley library. You can see the code here. Using the Morley library and Lorentz language, we were able to write gas-efficient smart contracts. We actually reduced gas costs by 35% over our initial LIGO implementation. Furthermore, Morley allowed us to use Haskell’s Quickcheck library to run property tests on the smart contract. You can see the property tests here.
Audit and Formal Verification
We are pleased to report that the Dexter team has successfully completed a 3rd-party security audit for the Dexter smart contract, and for the Dexter front end v0.8.2. The audit was performed for camlCase by Trail of Bits.
Additionally, the smart contract was formally verified for correctness to its formal specification by Nomadic Labs. These and other security-related documents can be found in the Security section of our docs. We would like to thank both teams for helping us work through issues and giving us the confidence to launch. Although we have put a great deal of effort into Dexter’s security, there will always be inherent risks when using smart contracts.
The Future of Dexter and DeFi on Tezos
Today we launched version one of Dexter. But the innovation in this space is rapid and unyielding. We already have ideas for future versions of Dexter, and our work is just beginning.
A decentralized exchange is one of the foundational protocols necessary for a DeFi ecosystem to emerge on a blockchain, and now Tezos has such an exchange. Uniswap has shown that this model of DEX has enormous potential, but Dexter can only grow as part of an ecosystem. More assets and protocols are needed, and we want to help others build. In future blog posts we will share the knowledge we have gained while developing Dexter.
We would also love to connect with anyone working on DeFi projects for Tezos. Please reach out to us on Twitter @camlCaseTech or through our site. The experimentation on Ethereum is fascinating, but we believe that Tezos is the long-term home for an open and decentralized financial system. Let's make it happen.