2019-12-17 18:30 |
The concept of decentralized exchanges has been popularized recently on the market, with a number of competitors swooping in and attempting to fill out this still developing niche.
While many considered 0x to be in prime position to take this market for itself, it has become clear that said protocol somewhat stalled and let other pretenders have a try. One of those pretenders has been developed on top of the Ethereum platform and is called Uniswap.
While many considered 0x to be in prime position to take this market for itself, it has become clear that said protocol somewhat stalled and let other pretenders have a try. One of those pretenders has been developed on top of the Ethereum platform and is called Uniswap.
Uniswap OriginsThe project was created by an individual called Hayden Adams, a former mechanical engineer who lost his “real world” job in 2017. Seeing a post made by Ethereum’s Vitalik Buterin convinced him to learn about smart contract development. After he did so, Adams later on he employed his newly-acquired skills to create a decentralized exchange which he named Uniswap.
Hayden had a lot of initial obstacles to overcome, from basically having no coding experience and being forced to learn Solidity, python, and Javascript/React, to worrying if what he’d created will be stable and secure enough to work properly.
So far, the results seem encouraging, as Uniswap currently rests on the shoulders of an open source community willing to provide various inputs, analytics, integrations, arbitrage bots, write-ups, libraries, code, and even memes. Even the Ethereum Foundation recognized the project by giving them a development grant worth $100 thousand.
Uniswap FeaturesThe exchange is hosted on the Ethereum blockchain architecture in the form of two smart contracts, a “Factory” contract and “Exchange” contract. The “Factory” smart contract contains an exchange registry, and a method to deploy an “Exchange” contract for a particular ERC20 token.
Thanks to this, any valid ERC20 token can be exchanged on Uniswap via their own unique exchange contract. There is exactly one exchange contract per ERC20 token and if a token does not yet have an exchange, one can be created by anyone using the Uniswap factory contract.
Available TokensEach contract holds an ETH reserve and a reserve of the corresponding ERC20 token. Uniswap allows its users to exchange ERC20 tokens for Ethereum, Ethereum for ERC20 tokens, or ERC20 tokens for other ERC20 tokens. Exchange benchmarks have so far shown some pretty competitive gas prices for token exchanging, especially when compared to its biggest competitor and role model, Bancor.
Uniswap doesn’t have the typical order book that has bidders and sellers enter their offers and trade in a peer-2-peer manner; the exchange instead operates on the liquidity pool principle which basically takes everyone’s bids and offers and pools them together in two giant reservoirs of liquidity.
Automated Market Maker (AMM)Market making isn’t done by specifying the prices you want to sell/buy for. What happens is that Uniswap makes markets with the help of a deterministic algorithm called Automated Market Maker (AMM).
The algorithm quotes prices to end users according to a pre-defined rule set called “Constant Product Market Maker Model”. This AMM is able to always provide liquidity, no matter how large the order size nor how tiny the liquidity pool; the trick is that the price of the coin asymptotically increases as the desired quantity increases. While larger orders tend to suffer as a result, the system never has to worry about running out of liquidity.
The market making mechanism operates through the x*y=k formula. For example, let’s assume that market makers contributed 1000 ERC20 token and 1000 ETH to the pool; the goal of the exchange’s algorithm is to maintain the size of this 1 million token pool (maintain a constant k value).
A trader who buys ETH from the pool will contribute ERC20 token to it, basically increasing the amount of x and decreasing the amount of y in the pool. These don’t scale linearly, as buying 10 ETH instead of 1 ETH won’t require 10x the ERC20 token. The scaling happens asymptotically and according to the following curve of the equation x*y=k:O
As we can see from the picture, the price is directly dependent on the size of the order. Vitalik Buterin was the first one to present this idea on Ether Research in early 2018, describing how it could contribute to a decentralized exchange model. What the graph above tells us that the more of one token you want, the higher premium you must pay in the other to acquire it.
If, for example, we were to create a misbalance where we have more ETH than ERC20 token in the contract, ERC20 token will become more expensive and the dot on the curve moves to the left. If we were to create a misbalance where we have more ERC20 token than ETH, the dot falls to the right.
Not replacing traditional exchangesUniswap doesn’t want to replace traditional exchange models, as most of the DEX projects you see today say they want. Instead, Uniswap depends on said exchanges existing, as anytime a misbalance is created on the platform arbitrage traders from outside can swoop in and stabilize the price with arbitrage.
The system is envisioned to scale with size, making expensive purchases of today cheaper tomorrow when the pool becomes larger. Uniswap allows one to specify a maximum/minimum price when placing an order to prevent miners from front running and also introduces expiring orders to prevent miners from withholding signed transactions. ERC-20 to ERC-20 swaps happen through corresponding token’s ETH pools.
Liquidity providersAll of that we mentioned above happens on the trader side. Liquidity providers have an even more complicated situation at hand; you can check out the complete explanation of the process here. Cyrus Younessi, Risk Management Lead at MakerDAO, explains why a model like this one is beneficial for everyone involved:
“In a nutshell, the pooled liquidity smooths out the depth of the order book. There are no more large holes or large bid/ask spreads. This is preferable for small traders who don’t want to have to deal with limit order books (the Uniswap UX is one of the slickest we’ve seen in all of crypto). No more having to make bids or offers or doing heavy calculations. Liquidity providers can also “set it and forget it.” There’s significantly less overhead in terms of management of orders and positions. It’s an incredibly passive way to provide liquidity and earn some fees.”
The role of a liquidity provider is an important one, as the first liquidity provider to deposit ETH and an ERC20 token into a contract defines the exchange price on Uniswap. If the market concludes that his ratio was off, arbitrage traders will react and bring the prices back to their correct values.
Each time a provider gives his liquidity to a contract, Uniswap’s native liquidity tokens are minted to track the relative proportion of total reserves that each liquidity provider has contributed. These tokens are highly divisible and can be burned at any time to return a proportional share of the markets liquidity to the provider.
FeesETH to ERC20 trades – 0.3% fee paid in ETHERC20 to ETH trades – 0.3% fee paid in ERC20 tokensERC20 to ERC20 trades – 0.3% fee paid in ERC20 tokens for ERC20 to ETH swap on input exchange; 0.3% fee paid in ETH for ETH to ERC20 swap on output exchange; effectively 0.5991% fee on input ERC20There is a 0.3% fee for swapping between ETH and ERC20 tokens. This fee is added to the liquidity pool and split by liquidity providers proportional to their contribution to liquidity reserves. Since ERC20 to ERC20 trades include both an ERC20 to ETH swap and an ETH to ERC20 swap, the fee is paid both times. There are no additional platform fees.
RoadmapMr. Adams recently revealed the direction his exchange wants to evolve in:
“Short term plan of the platform is to grow the liquidity pools, improve UX, create better developer tooling/APIs/docs, and further integrate Uniswap into the #dopefi ecosystem. Medium term plan is still being fleshed out but may involve growing the liquidity pools, scaling, privacy, complex mechanisms/derivatives/financial applications built on top of Uniswap. Lots of memes, and maybe mainstream adoption. Long term plan is still global domination. And growing the liquidity pools.”
Closing WordsUniswap, while not aiming to replace traditional exchanges, brings forth a couple of additional extras that the market might be interested in. In theory, it makes market manipulation more difficult and allows for a more stable price situation overall. All of this is still new and experimental, as the exchange is still in beta and is yet to complete its documentation. If everything goes as planned, we might be getting a decentralized, whale-resistant, cheap, available-to-anyone exchange that lets you swap through the entire ERC20 catalog with almost zero friction.
ResourcesWebsiteGithubTwitterRedditSlackEmailThe post Uniswap Review 2020 – New Ethereum’s Top Decentralized Exchange appeared first on CaptainAltcoin.
Similar to Notcoin - Blum - Airdrops In 2024