DeFi Plaza — A low cost DEX for Ethereum

Since the meteoric rise of DeFi last year we have many options to exchange tokens using several decentralised exchanges built straight onto the block chain. They work great and have been a massive boon to the fledgling DeFi industry. UniSwap could even be called the spider in the DeFi web. All is not well however, and the issue I wish to address here is that DeFi is basically becoming too expensive to use for the general public. The native Ethereum token ETH has risen tremendously in price and on top of that the gas price on the network has risen due to congestion. Moreover, the fees that most DEXs charge is in the order of 0.3% of the trade value which is just quite expensive. These high trading costs have become such a problem it’s starting to damage the growth of the DeFi ecosystem. Thus, I believe there is space in the market for an Ethereum based exchange that competes on cost. That is to say, an exchange which allows users to swap tokens at lower gas fees and lower exchange fees. To put it simply: I believe the DeFi community wants and deserves a lean, mean swapping machine.

The value proposition of a low cost exchange

So why don’t we just build a DEX that has low fees? Sure, the customers who do swaps and the arbitrageurs would welcome such an exchange, but how can we convince the liquidity providers (LPs) to commit their capital to provide liquidity if the fees (which provide their revenue) are drastically reduced? There is only one answer that makes sense: by having the exchange turn over significantly higher volume per unit of liquidity. This is the objective of DeFi Plaza; To provide an exchange which offers such favourable conditions to its user base that it will generate more than enough volume to compensate the LPs for the lower level of fees.

A note on capital efficiency

So how could we get away with charging so much lower fees than the competition? The answer is by drastically increasing the efficiency of the deployed capital. To understand how this works, consider the history of UniSwap. In UniSwap v1, the capital would be allocated in pairs with ETH. In other words each token would be tradable against ETH. If we want to go from LINK to say DAI, internally UniSwap would trade your LINK with ETH and then that ETH with DAI incurring extra high gas costs and higher fees.

What about L2 solutions?

An argument is made that by moving volume to L2 implementations like Polygon, we can unload the main chain and lower transaction costs. However, L2 solutions suffer from several disadvantages that make me consider them work arounds rather than actual solutions:

  • L2 introduces new security risks. For Bitcoin and Ethereum we have ample experience with the proven PoW security mechanism. The robustness of the security protocols and features of L2s still need to be proven.
  • L2 introduces serious friction in the form of time and/or money to move assets back and forth.
  • L2 breaks auditability. Things become much harder to keep track of when it is moved between chains.
Please check back after 7 days……..

Improving gas efficiency

During periods of network congestion the gas costs are a major factor in overall DeFi transaction costs. With the DeFi Plaza implementation an effort was made to save as much gas as reasonably possible in the actual execution of individual transactions. The primary focus for these savings are the end-user facing functions for swapping, liquidity add/remove as well as (un)staking transactions. Savings were mainly achieved in the following places:

  1. ETH not WETH: Using WETH makes the code cleaner and more generic, but it comes at the expense of additional gas costs. So I chose to make some ugly code to avoid the wrapping token to save some gas.
  2. Mappings over Arrays. It may not be pretty or convenient, but if it’s gas efficient I’m still doing it.
  3. No flash loan functionality. Flash loans are great, but enabling them requires additional complexity. For DeFi Plaza v1 I’ve decided they’re not core to the mission. Future versions may see flash loans enabled.
  4. Use variable packing where possible to minimise reads and especially writes to/from the blockchain.
  5. Minimising the amount of function calls to the bare minimum. Especially external calls.

Managing a high volume, high liquidity exchange

To generate most value for all its users, the exchange should attract as much liquidity and trade volume as possible. Thus, the tokens initially listed include those projects that are likely to generate the highest DEX liquidity and trading volumes. For technical reasons the contract is hard coded to have 16 listed tokens, including ETH itself. If DeFi Plaza is successful, simply being listed here would drive up demand and trading volumes for any token similar to how S&P 500 inclusion drives demand for stocks on the NYSE.

Governance

Which gives us a nice segue into governance. Yes, DeFi Plaza will introduce a governance token called DFP (sorry Andre). This is a real product, which should be supplying real revenue. Once it has gained sufficient momentum in the marketplace it should be able to sustain itself without demand driven by a liquidity program. However, a governance token is a proven method to gather momentum, as well as helping achieve some secondary goals:

Tokenomics

The governance token is a fixed supply token which can be mined by staking the exchange index liquidity token XDP1. Over a period of one year all 100MM will be released. At launch, there will be 1MM (1%) loaded onto the exchange as bootstrapping liquidity. A further 4MM (4%) is unlocked to recover development and deployment costs. 5MM (5%) are granted as a founder reward which is locked for 1 year to incentivise continued commitment to the project. 5MM (5%) of the tokens are reserved for a community multisig wallet to be spent in whichever way the community believes furthers the interests of the project. The other 85MM (85%) of the tokens are available for the community members as liquidity rewards.

The roll-out of DeFi Plaza

DeFi Plaza is live. You can find it at https://www.DeFiPlaza.net
When you visit the website, you’ll find a different experience from most DeFi projects. No goofy food name, no shiny sparkles or hype language. Simply an exchange, ready to do business. The same lean and mean philosophy that has been applied to the smart contracts has also been applied to the website. No React or other heavy libraries. It’s pure JavaScript designed to be fast, lean and snappy even if you’re on a low bandwidth connection.

A word of caution & disclaimer

This project is an AMM experiment by a random guy from the internet. Nothing more, nothing less. Though I did my absolute best to make a secure and efficient exchange, there could be scenarios that I missed in testing. Thus, the real test of the concept is in production. The code is unaudited. It’s just me testing on my machine. And I’m not a professional coder, I’m an engineer. But I guess if you don’t constantly experience a sense of dread and impending doom while working on a project, you’re not using Solidity right.

FAQ

Who are you?
Hi, I’m Jazzer, some random guy from the internet. I’ve been active in the crypto community for quite some time, mostly as a moderator in the Radix community.

Main dev of DefiPlaza.net which is a DEX that aims to make a step change down in fees and gas cost to Ethereum swap users.