.The Decentralized Finance (DeFi) fever has begun in the middle of June 2020 and has been receiving. an ever-growing bubble of attention since. However, DeFi is not new since one of the first DeFi solutions, .MakerDAO, was launched 3 years ago in December 2017. Since then, DeFi implications such as DeFi exchanges (Dexes) have solved many of the problems. that their centralized counterparts could not, including the risks of hacking, mismanagement, and arbitrary fees. However, the Dexes have their own problems: the lack of liquidity—which means a lack of money. sloshing around an exchange that makes trading faster and more efficient. Conventional market makers cannot keep up with the extreme growing speed. of these exchange trading flows, hence, the automated market maker protocols were invested.
What are automated market makers?
Automated market makers, or AMMs, are a class of decentralized exchanges that. rely on mathematical formulas to set the price of a token. Like normal exchanges, they have various trading pairs: for example, Ether (ETH) to Dai.
But there are no buy or sell orders, and traders don’t need to find someone else to sell their coins to. Instead, a smart contract acts as the maker in an exchange transaction. The concept is similar to quick-swap services like ShapeShift and Changelly, but the difference is that. the company’s reserves are replaced with liquidity pools based on smart contracts.
A liquidity pool contains two assets in a trading pair. The relative percentage of each token in that pool is what determines the. theoretical price of a particular asset. The first live AMM was Bancor, launched in 2017, but one of. the most popular platforms today are Uniswap.
What is Uniswap?
Uniswap is a protocol on Ethereum for swapping ERC20 tokens. Unlike most exchanges, which are designed to take fees, Uniswap is designed to function. as a public good—a tool for the community trade tokens without platform fees or middlemen. Also unlike most exchanges, which match buyers and sellers to determine prices and execute. trades, Uniswap uses a simple math equation and pools of tokens and ETH to do the same job.
What’s so special about Uniswap?
Uniswap’s main distinction from other decentralized exchanges is the use of a pricing mechanism. called the “Constant Product Market Maker Model.”
Any token can be added to Uniswap by funding it with an equivalent value of ETH and the ERC20. token being traded. For example, if you wanted to make an exchange for an altcoin called Poop Token, you would launch a new Uniswap. smart contract for Poop Token and create a liquidity pool with–for example–$10 worth of Poop Token. and $10 worth of ETH.
Where Uniswap differs is that instead of connecting buyers and sellers to determine the price of Poop. Token, Uniswap uses a constant equation: x * y = k.
In the equation, x and y represent the quantity of ETH and ERC20 tokens available in a liquidity pool and. k is a constant value. This equation uses the balance between the ETH and ERC20 tokens–and supply and demand–to determine the price. of a particular token. Whenever someone buys Poop Token with ETH, the supply of Poop Token decreases while the supply. of ETH increases–the price of Poop Token goes up.
As a result, the price of tokens on Uniswap can only change if trades occur. Essentially what Uniswap is. doing is balancing out the value of tokens, and the swapping of them based on how much people. want to buy and sell them.
What else is different about Uniswap?
Absolutely any ERC20 token can be listed on Uniswap–no permission required. Each token has its own smart contract and liquidity pool–if one doesn’t exist, it can be created easily. Once a token has its own exchange smart contract and liquidity pool, anyone can trade the token or contribute to the liquidity pool while earning a liquidity provider fee of 0.3%. To contribute to a liquidity pool, you need an equal value of ETH and ERC20 tokens.
How are Uniswap tokens produced?
Whenever new ETH/ERC20 tokens are contributed to a Uniswap liquidity pool, the contributor receives a “pool token”, which is also an ERC20 token. Pool tokens are created whenever funds are deposited into the pool and as an ERC20 token, pool tokens can be freely exchanged, moved, and used in other dapps. When funds are reclaimed, the pool tokens are burned or destroyed. Each pool token represents a user’s share of the pool’s total assets and share of the pool’s 0.3% trading fee.
How to swap tokens using Uniswap
The Uniswap protocol can be accessed through its front-end at uniswap.exchange. You’ll also need an Ethereum address, for example using a wallet such as MetaMask.
Thus armed, you can swap tokens or add tokens to a Uniswap liquidity pool; it’s just a matter of selecting the token that you want to swap out of, and the token you want to swap into. Then you’ll need to approve the transaction using your wallet, and confirm the swap (remembering to bear in mind any additional Ethereum fees for swapping).
Since Uniswap is an open protocol of smart contracts, a number of front-end user interfaces have already been created for it. For example, InstaDApp allows you to add funds into Uniswap pools without needing to access the official Uniswap user interface. Interfaces such as Zapper.fi allow users to add funds to Uniswap pools using just ETH instead of ETH and another token. The interface even offers simple one-click solutions for purchasing pool tokens in combination with bZx token strategies.
With an array of official and unofficial resources for the developers to build on the protocol, we should expect to see many more integration between Uniswap’s unique token swapping system and new DeFi products in the coming years.