‎Bitcoin Future

Uniswap—How Does It Work?

For a long time, centralized exchanges (CEXs) have supported the cryptocurrency market with their customer service, fiat on-ramps, speedier transactions, and deep liquidity. Decentralized exchanges (DEXs) offer lower trading fees, security, anonymity, and accessibility, which are attracting more and more customers.

DEXs provide advantages over CEX that make them a potentially attractive substitute. Uniswap is one such example. Its 2018 creator, Hayden Adams, took his cue from Vitalik Buterin, co-founder of Ethereum, who originally detailed the technology’s foundation. Uniswap was an early and pivotal figure in the creation of DEXs and the Automated Market Maker (AMM) paradigm. Uniswap is still one of the best DEXs out there, with a wide variety of tokens listed and a lot of liquidity.

What Is Uniswap?

Users of the decentralized exchange (DEX) Uniswap are able to trade cryptocurrencies directly with one another, without the need for a third party or censorship-resistant intermediary. Uniswap is an Ethereum-based platform that makes use of smart contracts, which are decentralized programs.

Instead of using conventional order books, Uniswap’s revolutionary AMM methodology facilitates frictionless trading by pooling liquidity. Users can add liquidity to these pools by depositing a pair of tokens with an equivalent value. They get LP tokens, which stand for Liquidity Provider, in exchange. The liquidity pools let other users to trade tokens with one another.

Check out Uniswap GitHub to see the open-source software that Uniswap employs.

How Does Uniswap Work?

How Does Uniswap Work?

The CPMM model underpins Uniswap. See how it works.

You deposit a trading pair to Uniswap’s liquidity pool as an LP. You can commit ETH and one ERC-20 token or two ERC-20 tokens of equal value. One token is commonly a stablecoin like DAI, USDC, or USDT. As an LP, you’ll get “liquidity tokens” representing your share of the liquidity pool and its trading costs.

Examine the ETH/USDT liquidity pool. We’ll name the pool’s ETH x and USDT y. Uniswap calculates pool liquidity (k) by multiplying x by y. Uniswap relies on k being constant. Total pool liquidity equals x * y = k. Let Alice buy 1 ETH for 300 USDT using the ETH/USDT liquidity pool. This boosts USDT and decreases ETH in the pool. This raises ETH prices.

Since there is less ETH in the pool after the transaction and we know that the overall liquidity (k) must remain constant, the price of ETH will be k/x. The pool’s ETH price depends on how much a trade changes the ratio between x and y.

Note that this model scales nonlinearly. The x-y balance shifts more with higher orders. Orders are more expensive and slip more as they get larger. The greater the liquidity pool, the less the shift between x and y, making large orders easier to fill.

The Evolution of Uniswap

Uniswap has evolved over time, with different protocol versions offering new features and improvements. Here’s a brief overview of Uniswap v1, v2, and v3:

Uniswap v1

It traded any ERC-20 token on Ethereum while being simple. This protocol was popular among Ethereum users and proved the notion of AMM-based decentralized exchanges.

Uniswap v2

Launched in 2020, Uniswap v2 was an upgrade over its predecessor. Most notably, liquidity providers are now able to make pair contracts for any two ERC-20 tokens thanks to the introduction of ERC-20 to ERC-20 pairs.

Users would also be able to trade between the tokens directly, without having to convert to Ethereum first. To sum up, Uniswap v2 removed the requirement to have both Ethereum and an ERC-20 token in order to form liquidity pools; instead, any two ERC-20 tokens could be used.

Uniswap v2 introduced new capabilities such flash swaps, which allowed for the delivery of tokens to receivers before confirming that enough input tokens had been received, and increased protocol efficiency by lowering gas fees. As a result of the enhancements and additional features, Uniswap became one of the biggest cryptocurrency spot exchanges and the usage of AMM grew exponentially.

Uniswap v3

Improvements to capital efficiency were among the most notable additions of Uniswap v3. Due to a feature of the aforementioned x * y = k model, most of the money included in AMMs are typically not being used, making them capital-inefficient. To put it simply, the system’s ability to support larger orders and price ranges is directly proportional to the pool’s liquidity.

Limited Partners (LPs) in these pools offer liquidity across a price curve that goes from zero to infinity, meaning that the money given by LPs in an AMM is spread evenly across all price ranges. This indicates that the location where the majority of the trade occurs only accounts for a fraction of the pool’s liquidity. It is counterproductive, though, to offer liquidity in a price range that is either unreachable or extremely distant from the current price.

Uniswap v3 aims to fix this by letting LPs choose specific price ranges where they want to bet, which should lead to a concentration of funds in the most active price range. If an LP specifies a price range of $1,000 to $2,000, for instance, the liquidity they offer can only allow trading within that range, not infinitely.

If you want to build an on-chain order book on Ethereum, where market makers can choose to supply liquidity in price ranges they choose, Uniswap v3 is a basic way to do so. Professional players that optimize their technique consistently may earn more trading fees than less active LPs due to this added layer of complexity.

Uniswap LP positions as NFTs

Uniswap LP positions are no longer interchangeable due to the fact that each LP can establish their own pricing range. A non-fungible token (NFT) now stands in for LP positions in Uniswap v3. The fungibility of the shared positions, however, is still possible (ERC-20).

Uniswap v3 LPs can now view all fees directly in their NFTs. Wallets can buy and sell these NFTs, and holders can earn position fees at any time. It’s essentially a digital picture that shows key details like the token pair and a curve that shows the “steepness” of the position. There is a distinct color scheme for each Uniswap v3 location, and various pools are denoted by different color variations.

Different fee tiers

There are three different fee levels available to LPs in Uniswap v3, allowing them to tailor their profit margins to the predicted volatility of the token pair. These levels are 0.05%, 0.30%, and 1.00%. For instance, LPs face more danger in ETH/USDT and other non-correlated pairs, and less danger in stablecoin pairs, which are correlated.

Uniswap on Layer 2

Ethereum transaction costs have historically climbed in tandem with the network’s usage. This can sometimes make Uniswap an expensive nonstarter, particularly for smaller users. Layer 2 scaling solutions may now scale smart contracts with the help of Uniswap v3, which eliminates this issue without sacrificing the safety of the Ethereum network. Enhanced transaction throughput and reduced user costs are other benefits of this design.

Uniswap live on BNB Chain

Uniswap went live on the BNB chain after receiving 66% support from governance voters. This move can potentially provide users with more efficient and cost-effective trading options. It also means Uniswap users will be able to take advantage of BNB Chain’s high speed and low transaction fees. Additionally, the integration allows Uniswap to tap into a new pool of liquidity and increase awareness and adoption among both retail and institutional investors.

What Is Impermanent Loss?

LPs should also consider temporary loss and liquidity fees for token swap traders. Assume Alice is an LP that invested 1 ETH and 100 USDT into a Uniswap pool with 10,000 liquidity (10 ETH x 1,000 USDT). Other LPs like her funded the rest. Alice’s initial deposit makes up 10% of the pool’s liquidity. Alice’s deposit was $200 (1 ETH x $100 + 100 USDT) because 1 ETH cost 100 USDT. Imagine ETH costs 400 USDT. Arbitrage traders add USDT to and remove ETH from the pool until the ratio matches the new price. This reduces the pool to 5 ETH and 2,000 USDT. Alice removes monies from the pool. Her portion is 10%, or 0.5 ETH and 200 USDT, totaling $400. Alice appears to have profited.

If she had kept her initial payment of 1 ETH and 100 USDT, she would have had $500 (1 ETH x $400 + 100 USDT). Alice missed the ETH price rise by depositing in Uniswap.

This loss is called “impermanent” because it can be reduced if the pooled tokens return to their original pricing. Since LPs earn fees, the loss may be offset. LPs should understand impermanent loss before investing in Uniswap. The aforementioned scenario applies whether the price grows or falls since deposit. If the price of ETH drops since the deposit, the LP’s losses may increase.

How Does Uniswap Make Money?

Uniswap makes money by charging a nominal fee for protocol trades. LPs profit from Uniswap, unlike typical exchanges. LPs can earn greater trading fees on Uniswap v3 by concentrating their liquidity within the chosen price range.

Uniswap is open-source and decentralized, so no one controls or profits from it. Instead, a community of developers and governance enhance it.

The Uniswap (UNI) Token 

Users and LPs have been flocking to Uniswap since September 2020’s debut of UNI, its native coin. UNI, an Ethereum-based ERC-20 token, can be saved in any cryptocurrency wallet that supports them.

The UNI token gives holders governance rights to vote on protocol upgrades. User voting power is proportionate to governance token holdings. Anyone can propose and vote in the decentralized governance process.

UNI tokens can be traded on cryptocurrency exchanges for other cryptocurrencies or decentralized finance (DeFi) applications. Community requests and governance votes can create new use cases.

How to Use Uniswap

To use Uniswap, you need to have a cryptocurrency wallet that contains some Ether or ERC-20 tokens. Here’s how to start using a simple swap option on Uniswap:

  1. Connect to your Ethereum wallet on the Uniswap website.

  2. Select the token you wish to trade. Uniswap supports several ERC-20 tokens; make sure you select the correct one.

  3. Enter the amount you wish to trade. The interface will then show you the estimated amount of the other token you will receive, based on the current exchange rate.

  4. If the amount is satisfactory, you can click “Swap”. Your wallet will then prompt you to confirm the transaction.

  5. After confirming the transaction, the trade will be executed on Ethereum. Finally, the tokens will be displayed in your wallet.

Closing Thoughts

Ethereum-based DEX Uniswap evolves. Anyone with a crypto wallet can exchange tokens without third parties. A new class of LPs can receive fees on idle assets and traders can simply transfer cryptocurrencies on the platform.

The issuance of the UNI governance token solidified Uniswap’s community-driven status. As the DeFi ecosystem grows, it will be interesting to see how DEXs adapt to user needs while retaining decentralization and trustlessness.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button