How Uniswap help you to change coins quickly

How Uniswap helps you to change coins quickly

By Lukas Wiesflecker on The Capital

Uniswap is a decentralized exchange platform that is realized via Ethereum Smart Contracts. The product is straightforward. You can exchange ERC-20 tokens among each other and against ether, and you are always in full possession of your assets or do not assign them to a third party or central authority. The only thing you have to rely on is the security of the Smart Contracts.

The Ethereum developer Hayden Adams is behind the project. Since May 2020, the second version of the protocol is Live, which brings some improvements.

Uniswap V1

The first version of the protocol was announced and launched at Devcon 4 in November 2018. It already contains the essential functions. With the function Swap, you can exchange ERC-20 tokens among each other or against ether.

The function Send is very similar to the function Swap, only here you can choose the recipient address yourself. The exchanged tokens then go to this address and not back to the address where the exchange token comes from. This function is also suitable for creating chained transactions, for example, for flash loans.

The Pool function allows you to add liquidity for the trading pair. You need to hold both tokens of the trading pair and add them to price-related relations. For example, if you have the trading pair Ether/Dai and the ether price is 240 Dai, the ratio must be 1/240. The constant rate is suggested by the input field itself. Unless you are the first to contribute to a liquidity pool, you can set the ratio or price (see below) yourself.

If you add liquidity to a pool, you get pool tokens. The order costs of the trades also flow into the lake. This increases the value of the pool token, and you can later withdraw more of the tokens than you have deposited. The platform benefits from this incentive system, as high liquidity allows for a quick exchange of tokens and minimizes slippage. The slippage indicates by how much the price changes for a specific trading volume.

How is the price determined?

The determination of the price works easily. The price is simply the ratio of the coins in the pools. For example, in the Ether/Dai trade pair, the number of Dai in the Dai ether pool is divided by the number of others in the Dai ether pool. This is also the reason why, to add liquidity, this ratio must be maintained so that the price is not changed.

The following example illustrates the problem of slippage. For instance, if for 240 DAI/ETH 5 ether is in the ether pool (1200 Dai in the DAI pool), and someone swaps three ether for Dai, the Dai stock shrinks to 480 Dai, and the ether stock rises to 8. The ether price on Uniswap is now 480/8 = 60 Dai/ether. If there were 1,000 ether in the pool or 240,000 dai, the cost would only have dropped to 238.56 dai/ether.

How does the price adjust?

This is done through arbitrage. In our example above, one ether costs 60 dai. In the markets, it still costs 240 dai on average. Now, of course, traders see the bargain on Uniswap and buy the ether cheaply. So the price of trading pairs on Uniswap adjusts to the global average rate.

Uniswap V2

As mentioned above, Uniswap V2 was launched in May 2020. Uniswap V1 continues to run in parallel. V2 has delivered some improvements. Wrapped ether is now supported. So ERC-20 tokens, which represent the value of the ether. This allows us to pool ether with any ERC-20. With V1, only pooling between native ether and ERC-20 was possible. A separate exchange contract had to be created for each trading pair.

The prices on Uniswap served as price feed or oracle for many other Smart Contracts. With V2, an optimized oracle function was introduced, which made manipulations more difficult. In the past, there were hacks that were possible by manipulating uniswap oracles.

Flash Swaps allow similar to Flashloans the borrowing of as many ERC-20 tokens as desired, should they be returned in the same transaction. It is also possible to reward the value via other tokens or a mixture of both. The fees go to the liquidity providers via the liquidity pool.

There are other performances and technical improvements that are less important to the user. If necessary, you can read about them in the official description.

Uniswap does not operate a business model with the platform. All fees go to the liquidity pools. However, there is the option of redirecting 0.05% of the trading volume for log development.

Operation of Uniswap

Uniswap is easy to use. There are several ways to connect to the Smart Contract, including Metamask and the Coinbase Wallet.

In a drop-down list, you will find a predefined selection of tokens. If the desired token does not appear, you can enter its Smart Contract address in the field. Since the interfaces are standardized, any ERC-20 token can be added.

In the picture, for example, we want to exchange 1.5 ether for the link. At the current price (14.07.2020) this is 44,111 link (0,0340051 ETH/LINK or 29,407 LINK/ETH). In the red-framed field, you can optionally enter the address where the link tokens should be sent to. By default, they go to the address that sends the ethers. Minimum Received indicates how many link tokens we get at least. Due to the slip, the price loses 0.04 %, which in the end affects the amount received. 0.0045 ether (0.3 %) flow into the liquidity pool.

Uniswap Settings

In the menu, you can set the maximum tolerated slippage. In the picture 0,5 % are set. That means in our ETH/LINK example. The price can only fall to 0.0338350745 ETH/LINK, otherwise, it will not be executed. The Transaction Deadline is also a practical tool. If the transaction waits longer than entered for confirmation, it becomes invalid. This can be a help in markets with strong price fluctuations.

Uniswap also offers a detailed statistics display, which can be found on the menu. It displays liquidity data of trading pairs, trading volumes, transactions, etc.

I share more intimate thoughts in a monthly newsletter that you can check out here. Please let me know in a comment and join me on various social media platforms:

TwitterInstagramFacebookSnapchat ● LinkedIn

WHATEVER YOU DO, DO IT WITH LOVE AND PASSION!

https://twitter.com/thecapital_io

https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href


How Uniswap help you to change coins quickly was originally published in The Capital on Medium, where people are continuing the conversation by highlighting and responding to this story.

Post fetched from this article