Uniswap: 2 month review

in powerhousecreatives •  4 months ago  (edited)

Source

I had first heard of Uniswap (a novel take on the decentralised exchange (DEX) based on the Ethereum blockchain) on a podcast of Unchained where the host Laura Shen interviewed the developer of Uniswap (Hayden Adams) about the project. At the time, Uniswap was the largest liquidity pool for MKR tokens (the governance token that regulates the Maker-Dai stablecoin system). I was instantly intrigued, as it became clear that Uniswap was also a liquidity pool provider for ERC-20 tokens (other coins can be supported by "wrapped" tokens that represent the claim on the other blockchain), one that was highly decentralised with a different model of providing liquidity in comparison to other existing liquidity pool providers. Uniswap functions more as a decentralised exchange (DEX) more than a borrowing/lending platform, however, users are also able to provide liquidity to the DEX in addition to using the more traditional token swap functions.

Uniswap is currently one of the featured dApps on State of the Dapps (who can also be found on Steem as @stateofthedapps). Currently standing at #51 in the listing of dApp rankings across multiple blockchains (Profile here, Uniswap boasts a high developer activity count and a decent amount of user activity, both essential metrics for a well functioning and "in-use" dApp.

The Theory

Unsplash

If you are more into podcasts, I highly recommend listening to this Unchained podcast for a bit of an overview about how Uniswap works. If you are looking for a more detailed overview of the theory behind Uniswap, I highly recommend this medium post by Scaler-Capital.

Uniswap replaces the more familiar order book of buys/sells that are found at other exchanges, instead replacing each order book (for each ETH-ERC20 pairing) with a liquidity pool that is balanced with equal funding of Ethereum (x) and the relevant ERC20 token (y) according to the inverse formula (x*y=constant, where the constant is set at the creation of the of the liquidity pool). Liquidity providers (originally the order book) provide Ethereum (ETH) and the ERC20 token to the liquidity pool (in exchange for a liquidity token which represents their share of the pool, 0.3% which is comparable to the taker fees on most exchanges) according to this formula, and as the pool grows (through the addition of fees through swap that utilise the pool) their stake is worth more.

Swaps (trades into or out of Ethereum, or using Ethereum as a bridge) are given a quoted rate from the liquidity pool, which is based upon the same formula (trying to hold the constant constant), noting that the formula is an asymptotic one which means that the price will not scale linearly (swapping twice as many tokens does not result in exactly twice the price, but slightly more). So, not that different to buying up the order book... but with just a single price quoted instead. So, the price will only shift significantly if the swap order is significant in size to the liquidity pool.... if that is the case, then you are better off doing an Over the Counter (OTC) order instead.

Again, this is just a quick overview of the mechanics behind the Uniswap DEX, for a more in-depth overview, please check the "Further Reading" section at the end of this review.

In Practice

Uniswap requires the use of the Metamask Ethereum wallet extention for a Web3.0 browser, this is to be able to sign and authorise transactions and swaps.Also required is pair of sunglasses, as the exchange has a colour theme that heavily favours hot pink and large expanses of white space! It's a small thing, but I'm a dark mode sort of guy... so the huge spaces of unused white space is pretty glaring to look at... I'm not so fussed about the hot pink though! All the space is unfortunately wasted, on the other hand, it does put functionality front and centre, so I'm a big fan of that. Plus, using the extra space could increase the attack surface on the website which are quite undesirable for a DEX! Anyway, I'm no web designer, so these things are minor quibbles, however, a dark theme would be hugely appreciated (but that might be coming to the Chrome web browser anyway...).

You will need to authorise Uniswap to connect to your Ethereum address via Metamask to continue with the functional part of the DEX.

Liquidity Provision

I will start with the provision of pool liquidity, which was the reason that I was first attracted to Uniswap. The first step requires that you allow access to your Ethereum wallet and then to authorise the unlocking (access) to the relevant ERC token, both are on-chain transactions that will require ETH (via gas fees) to sign... but they only need to be done once for each ERC liquidity pool that you wish to interact with (and just once for the ETH).

With the signing of the transactions out of the way... you are free to add liquidity to the selected ERC pool, keeping in mind that you need to add also ETH to the value that is set by the constant product (x*y=k) formula. The actual values of the ETH-ERC balance are set at the time of the transaction, and are heavily influenced by the current market prices (with safeguards to protect the pool and user from large swings during the confirmation time). As soon as the transaction is approved, you are credited with a corresponding amount of liquidity tokens, which represent your share of the pool.

The benefits of providing liquidity are that all the DEX fees (0.3% on the swaps) are deposited into the pool that is utilised. Thus, all the fees are spread evenly among the stakeholders in the pool.

Liquidity removal is just as simple, you select the relevant ERC pool and sign an on-chain transaction that burns your liquidity tokens in exchange for the amounts of ETH-ERC that you are entitled to. Keep in mind that the actual amounts of ETH and ERC tokens are dependent on keeping the constant product (x*y=k) formula, which means that you will have a differing amount of ETH/ERC depending on the difference in the market prices of ETH and ERC token between provision and withdrawal.

Anyone can create a liquidity pool (just not one that is already represented!) in any ERC20 token using the smart contact templates that are provided by the exchange. These are simplified so that you only need to input the required parameters and not do any coding. Unlike other DEXs there are no listing fees, just the ETH required for the gas fees.

Token Swaps

Token swaps are done between ETH and ERC20 tokens (or ERC20-ERC20 using ETH as a bridge currency). After signing a transaction that allows access to the relevant tokens, you only need to input how many tokens you wish to sell/receive and the DEX will quote you the relevant input (or output) required by the liquidity pool. From there, it is a simple on-chain transaction (gas fees required) to send the input (ETH/ERC20) to the liquidity pool, which will provide the required output back to your wallet. The DEX fee is 0.3% which is on par with other exchanges, of which all of the fees are deposited into the relevant pool to be distributed among the stakeholders.

Now, it is important that all swaps are done within a single liquidity pool. So, you are exchanging ETH for that pool's ERC-20 token (whilst keeping the constant product formula intact, x*y=k) or vice-versa. If you are exchanging ERC20-ERC-20, then you are performing TWO swaps, one from the input ERC20 to ETH and then another from the bridge ETH to the output ERC20 token. Thus, you are paying two fees... one for each pool.

All DEXs are held hostage by transaction times of the underlying blockchain, and so to prevent bad actors taking advantage of the transaction time (known as front-running), there are safeguards in place to protect the trader, ensuring a known maximum price for the trade at the time of the transaction signing.

Also related, is the possibility to have the output go to a different wallet (not the one that is interacting with the DEX). This is useful for sending tokens to another account, such as when you support a project with ETH and receive tokens in return. This provides a simple to use DEX tool to enable that sort of action.

My experience

My experience with the Uniswap DEX has been mostly as a liquidity provider. On that side of things, I have to say that the experience is seamless and simple for anyone with a passing familiarity with the way the Ethereum blockchain works. It might be a bit of a challenge for those who don't tend to use the Ethereum chain much, so please do your reading and research about the underlying infrastructure before using it. That said, it is quite hard to track how your liquidity provision is tracking from day to day, week to week.... as the market prices of Ethereum and the ERC20 tokens change so rapidly and wildly. Ideally, you want the prices to be similar in ratio to what you entered the pool with... or you will end up with more of one side of the balance and less of the other!

On the trade (swap) side, I've only had experience with using the send option. I support the CIVIL venture... and they utilised the "send" tool to enable their token distribution. Seamless, and does exactly what it needed to do!

Speed is normally the most problematic thing with a DEX, especially when using the order-book model. Prices can shift faster than the DEX can keep up with... Uniswap does have a great way of handling this with the liquidity pool model, plus there is a benefit to the pool providers for adding liquidity instead of having orders sitting around on an order book. It really is more of fire-and-forget model, after all... not all of us have time or the inclination to be day-trade... or having to deal with the re-jigging of orders when the price suddenly moves against you and you are left with orders that are far from the current market price.

On the whole, functional tools is what describes the Uniswap DEX. It is in beta, but the features are working and the entire thing is function over form! That said, that is what you need foremost in a DEX... it needs to be simple and easy to use, with not too many bells and whistles that could complicate a transaction. I'm very happy with the DEX, and plan to use it further as my go-to DEX for the Ethereum blockchain.

Further Reading

Unchained Podcast interview with founder, Hayden Adams

High Level overview of Uniswap

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thanks for the review.

The trend towards more transparency and proof of value/reserves is definitely attractive.

Namaste, JaiChai

No problem... I'm still up in the air about Uniswap... I'll see how it pand out in the longer term.

Nice extensive review on this one thanks. Always good to learn what is available, so many new ones arrive every day.

Thanks... Yes, there are lots of new projects coming and going...

Great review.. looks like another rabbit hole to dive in and explore... I've picked up various erc20 tokens along the way - maybe I cld swap them for other people's flops!

Posted using Partiko Android

Ha ha... If you prefer to provide liquidity the DAI has a good return on Compound.

I just stumbled upon the post.
We really REALLY need something like Uniswap to be implemented for SMT when they are here, preferably right away. When a new SMT is created, an account (that functions as smart contract for that SMT) without any key (just like @null) will also be created to handle swaps between STEEM-SMT and SMT-SMT. STEEM-SBD exchange should be able to be handled this way too. This way communities with their respective SMT don't need to worry about being listed on exchanges at all and able to focus on growing their community more. Order books is horrible especially for smaller communities because of the horrible liquidity (can lose 30-90% of value due to liquidity just to sell to STEEM let alone converting it to another SMT with low liquidity)

#sbi-skip

Yup... this does work better for low volume markets. It would avoid large orders completely obliterating the order book, giving an unwelcome surprise for both buyer and seller (depending on which way it goes!). Although, one downside of the model is that the constant product means that unless the prices stay roughly even in both assets, then if you choose to withdraw from providing liquidity, you are going to get a vastly different amount of tokens than what you put in... same value, just different balance!


We are SO proud to have you as a member of our
FANTABULOUS Power House Creatives family!
uvoted and/or resteemed!

❤ MWAH!!! ❤

Power House Creatives Logos FINAL_float.png

#powerhousecreatives

Posted using Partiko Android

Hi @bengy!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.617 which ranks you at #1873 across all Steem accounts.
Your rank has improved 30 places in the last three days (old rank 1903).

In our last Algorithmic Curation Round, consisting of 212 contributions, your post is ranked at #53.

Evaluation of your UA score:
  • Some people are already following you, keep going!
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server