2020 has seen a surge in the usage of decentralized finance protocols and applications. The DeFi sector has gone through a similar boom to altcoins, having exploded back in 2017. At the time, the altcoin boom was driven by new investment opportunities and ICOs. But now we have Uniswap.
DeFi has grown from small beginnings with less than $500 million in total value locked across all platforms in August 2019, to a thriving ecosystem of almost $9 billion in total value locked (TVL) one year later. This rapid expansion has given rise to a number of yield farming, or liquidity providing, opportunities for investors wanting to earn interest on their crypto assets.
In a previous DeFi guide, we described how to take out a loan using crypto collateral. In this one, we will delve into the art of token swapping using decentralized exchanges (DEXs) such as Uniswap. A DEX is simply an exchange that does not have a central point of control, it is peer-to-peer running autonomously on network fees alone.
Conversely, centralized exchanges (CEXs) such as Coinbase and Binance operate on a profit basis and need to charge fees, spreads, and commissions to make money for their CEOs, employees, and shareholders.
It’s worth noting that Uniswap hit $254 million in 24-hour volume in August 2020, and the platform launched its UNI Token the very next month. Now, those who provided liquidity to the platform before September 1st will receive free UNI in an airdrop from its four new liquidity pools: ETH/WBTC, ETH/DAI, ETH/USDC, and ETH/USDT.
As for this guide, we’re going to teach you how Uniswap works.
In this article:
- What is Token Swapping?
- How does Uniswap Work?
- Uniswap Pros and Cons
- How to use Uniswap
- How to Make Money on Uniswap
- Uniswap Alternatives
- Resources and Conclusion
What is Token Swapping?
In centralized finance (CeFi) token trading is done on crypto exchanges which take a fee or spread for the service. There is an order book which contains open orders between buyers and sellers.
DeFi is different in that swapping, on a DEX is done with automated market makers (AMMs). These use algorithmic equations to dynamically calculate the swap rates depending on the token supply and demand, and liquidity on the platform.
Token swapping is the fastest, easiest, and often the cheapest way to convert tokens for use on DeFi protocols for lending, borrowing, or yield farming.
How Does Uniswap Work?
Uniswap was launched in November 2018, founded by Ethereum developer Hayden Adams, following a grant of $100,000 from the Ethereum Foundation. In April 2019, the team was able to secure a $1 million seed round lead by Paradigm, an investment firm focused on blockchain technology. Project history and the early days of development have been detailed by Adams on the Uniswap blog.
In essence, Uniswap is an open-source, Ethereum-based liquidity protocol for swapping ERC-20 tokens. It comprises a series of smart contracts that allow anyone to directly trade with anyone else directly on the Ethereum blockchain. Uniswap uses mathematical equations, pools of tokens, and Ethereum to do the same job as a centralized exchange does, but without the middle man. Detailed information on the (x*y=k) market maker mechanism can be found here.
Its pricing mechanism is called the ‘Constant Product Market Maker Model’. Rather than specifying buy and sell price, users simply choose an input and output token and the DEX provides the best market rate at the time. Uniswap can provide liquidity for most tokens at all times since the price of a particular token would rise and fall as the demand for it increases and decreases.
Uniswap may also route the swap through a third token if there is no liquidity or provision for a specific pair such as Dai to Tether or vice versa. Any ERC-20 token can be listed on Uniswap, if it doesn’t exist yet, a smart contract and liquidity pool can be created. Uniswap also has a liquidity provider fee of 0.3% per trade which is allocated as a reward to providers of crypto collateral to these token pools.
What is the difference between Uniswap v1 and v2?
Uniswap v1 is the original version of the platform, launched in November 2018. Its primary drawback is that it requires liquidity providers to deposit an equivalent value in ETH for every token they add to a pool, further exposing them to volatility in Ethereum markets. There are two transactions made as every swap is routed through ETH, resulting in two sets of fees. It is still in operation but the majority of activity has now switched to Uniswap v2.
The second iteration of Uniswap was launched in May 2020. This was because the team realized an automated liquidity provision was the way forward. Instead of relying on ETH as the intermediary, Uniswap v2 allows any ERC-20 token to be pooled directly with any other ERC-20 token. Other new features were added such as price oracles, flash swaps, and a swapping router.
Whenever a new ERC-20 token is contributed to a Uniswap liquidity pool, the contributor receives a ‘pool token’, which is also an ERC20 token, and it is burnt on withdrawal of the collateral. Each pool token represents the user’s share of the liquidity pool’s total assets plus a share of its 0.3% trading fee.
Uniswap Pros and Cons
As with any crypto or DeFi platform, there are many advantages over centralized exchanges, but also a couple of drawbacks.
- No KYC – there is no account opening or proof of identity required to use it.
- No limits – there are no ceilings for withdrawals or deposits.
- Transaction speed – token swaps are usually instantaneous.
- User friendly – the dashboard is simple and very user friendly.
- Low fees – fees are typically much lower than those for centralized exchanges.
- Decentralized – there is no CEO or central point of control.
- Earning potential – liquidity providers can benefit from contributing collateral to liquidity pools.
- Technical knowledge – token swapping does require some knowledge of crypto wallets and transactions.
- Slippage – price movement in a trading pair between when a transaction is submitted and when it is executed.
- Gas prices – under high demand Ethereum network fees increase … a lot.
- Flash swaps – malicious actors can take advantage of imbalances between different marketplaces.
- Fake tokens – anyone can create, name tokens, and list them on the exchange including fake versions of existing tokens.
How to use Uniswap
Uniswap has been designed with the user in mind; therefore it has a pretty simple interface. With this guide, we’ll be focusing on Uniswap best strategies. We will be using Uniswap v2 where the majority of token swapping happens these days.
Before engaging in a token swap, you need to have an ERC-20 crypto wallet with a balance of whatever tokens you intend to use. Metamask is one of the most popular, but Uniswap will also work with WalletConnect, Coinbase Wallet, Fortmatic, and Portis. Connecting your wallet is simple and does not require a gas fee.
Once you have selected both tokens, your wallet will pop up again for confirmation of the token swap. It will also show the gas fee for the transaction. Once confirmed, you will see pending transactions appear on the top right side of the exchange interface. It will take a few minutes to validate the transaction on the Ethereum blockchain.
Balances will be displayed in your wallet once the transaction is complete.
You should be aware of slippage, which is a movement in price during the transaction. The percentage of expected slippage is displayed and will vary depending on market volatility.
Slippage tolerance can be adjusted to allow for greater or smaller levels of fluctuation. If the slippage tolerance is too low the transaction may fail. Uniswap sets it at 0.5% by default.
Additionally, there is a transaction deadline that indicates the absolute maximum time that you’re willing to let the swap be pending. It is set at 20 minutes by default. There is also a liquidity provider fee of 0.3% to pay for every transaction
Gas fees for Ethereum transactions hit an all-time high in mid-2020 so, it is imperative to monitor these things as the three costs (gas, slippage, and LP fee) can exceed the amount being exchanged for very small swaps.
Uniswap analytics, data, volumes, and liquidity can all be found on Uniswap.info. This dashboard can also be used to search for token pairs.
How to Make Money on Uniswap
Swapping tokens alone is not a big money-making venture unless there is arbitrage involved and very large sums. Providing liquidity, however, can produce better returns and this is done by clicking ‘Pool’ on the exchange interface.
It will then ask you for two tokens to use for your liquidity pool. You need to have enough of either one to cover the liquidity of the other one.
Again, Metamask (or whatever wallet you use) will pop-up asking for confirmation and gas fee. Once you have added the tokens, you will receive Pool tokens or ‘p tokens’ that represent your position in that pool.
Once the transaction is complete you can examine the liquidity pool. This will show how much of each token you have deposited. Removing liquidity is just as easy. It can be done by clicking the ‘Remove’ button under the ‘Pool’ option when viewing your own liquidity pools.
Impermanent losses should be mentioned at this stage as this can happen when a liquidity provider’s stake decreases despite the additional rewards as the token value has increased since it was deposited in the pool. Sometimes it can be more profitable to simply hold on to a token rather than use it for liquidity provision. If prices were to return to the same value as when the liquidity provider added their liquidity, this loss would disappear.
This loss is only realized when the liquidity provider withdraws its liquidity. It is based on the divergence in price between deposit and withdrawal. It can therefore be called divergence loss (previously described as an impermanent loss). There is a full explanation, using Uniswap equations, here.
Uniswap is not the only token swapping automated market maker at the moment, but it is the most popular one at the time of writing. Is Uniswap safe? For the most part, but there’s no reason not to consider alternatives if interested.
Kyber is another on-chain liquidity protocol that lets token holders contribute liquidity, called reserves on this platform. It can be integrated into various dApps and wallets and offers multiple types of reserves.
The Kyber Network has its own native KNC token which is used to align ecosystem incentives. KNC holders can stake tokens to participate in governance and earn rewards.
At the time of writing, Uniswap did not have its own native token. That said, one was rumored to be in the pipeline.
Matcha is a new token swap platform from DEX protocol 0x. It was launched in early July 2020 to offer price aggregation across multiple liquidity platforms in order to find the best swap rates. It also aims to simplify the process and provide more information on the tokens listed. Matcha uses smart order routing to ensure trades are completed in a quick, efficient manner. It also employs meta transactions and gas tokens to enable savings on Ethereum gas fees.
SushiSwap is the latest thing in DeFi and is actually a fork of Uniswap launched in late August 2020. Building on the Uniswap protocol, it offers greater incentives in its own native SUSHI tokens for providing Uniswap liquidity pool tokens as collateral. Unlike Uniswap, SUSHI tokens will also entitle users to continue to earn a portion of the protocol’s fees. This applies even if they decide to no longer participate in the liquidity provision.
Resources and Conclusion
DeFi has come a long way in 2020, and token swapping platforms have evolved into much more. In order to provide fast and fluid transactions, they need a lot of liquidity which has given rise to a yield farming frenzy.
Uniswap is the current industry leader with over a billion dollars locked in collateral, according to DeFi Pulse. However, swapping tokens alone is not a get rich quick scheme. But it is far more convenient than using a centralized exchange. Providing liquidity is a better way of solidifying earnings on crypto holdings, but in the rapidly changing DeFi sector, investors still have to do their homework. That and there are still inherent risks with unaudited smart contracts.
The following resources offer more information and analytics on decentralized exchanges and the DeFi ecosystem:
https://uniswap.info/ – full analytics dashboard for Uniswap
https://uniswap.org/blog/ – latest updates from Uniswap
https://defipulse.com/ – top DeFi platforms by total value locked
https://thedefiant.substack.com/ – DeFi newsletter covering the latest industry developments
https://beincrypto.com/defi/ – the latest DeFi news and updates
Happy token swapping and yield farming!