How Does Uniswap Works?
Create your own DEX with like Uniswap our Uniswap clone script. Get decentralized exchange development from BlockchainX experts.
Uniswap is now much more than just a DEX. First of all, we have that Uniswap was created as an AMM (Automated Market Maker) protocol. This means that Uniswap clone enable its users to create markets from which third parties can benefit. The creation of these markets is self-sustaining, allowing the protocol to generate income that serves to encourage the injection of liquidity in exchange for a small interest to its investors. They are the well-known pools, where investors inject tokens to increase its liquidity, and as it is used by third parties, these transactions generate commissions that are used to maintain the protocol and give rewards to investors in said pool.It is, in a few words, the germ of the well-known liquidity mining.
Second, the creation of these pools allows the protocol to amass liquidity to allow rapid exchange of assets . This exchange system is controlled by smart contracts (like the rest of the functions of the Uniswap protocol) giving rise to its DEX functionalities. And finally, build around these two functions a complex system of rewards, decentralized extchange development governance and complementary functions within the increasingly relevant DeFi ecosystem.
Liquidity control in the pool
Now, at this point we can say that liquidity pools are the heart of Uniswap. The creation and management of them is what allows Uniswap to provide all the services for which it was designed. But also, it is the "hook", that which attracts investors to invest in Uniswap with the promise of making a return on their investment. Let us remember that each token in a liquidity pool is an opportunity for investors to obtain rewards.This is possible because your tokens are used to carry out trades and other operations that generate commissions within Uniswap. From these commissions, the profits come both for the development of the protocol and those that go to the investors in each pool. Thus, as a pool has a lot of use, the greater the profits it generates in relation to its liquidity.
This simple formulation is controlled by an economic mechanism known as the Constant Product Market Maker (CPMM), controlled by a simple formulation:
x, are the total coins of a token A
y, are the total coins of a token B
k, a constant resulting from the multiplication of said tokens
This simple relationship creates the so-called market curve x*y=k, which is the basis of Uniswap's CPMM in its versions V1 and V2. However, Uniswap V3 has abandoned this model and changed it to a dynamic model more adjusted to the reality of the markets, especially those with high liquidity and volatility. The idea of the pools in V3 is that they can concentrate their capital within personalized price ranges, providing greater amounts of liquidity at the desired prices. In this way, pools can build their own price curves adjusted to their reality.
The basis for this change is to allow Uniswap V3 to have a base to build new functionalities designed to make the use of capital in LP more efficient, generate higher profits and avoid the well-known impermanent loss (impermanent losses) that are usually seen in the AMMs that follow. the model x*y=k.
Oracles and commissions
Oracles also have an important role within Uniswap, as the platform needs information about the price of tokens that are on its platform. On Uniswap, this feature is controlled by Time Weighted Average Price (TWAP) oracles. This type of oracle is capable of offering information about the different tokens within Unsiwap, and feeding the system to recognize and configure the prices within the protocol. This function of the oracles is essential because the commission and reward system of the Uniswap protocol depends on it.
Creation of pools and markets
The creation of a pool is essential for Uniswap clone script, because each pool is made up of a pair of cryptocurrencies that serve as an exchange point. As we mentioned at the beginning, these pools can only be made up of ERC-20 Ethereum tokens. Thus, for example, a group of investors can create a pool of ETH/DAI, with a commission of 1% per exchange. This can be read very simply:
The pool allows the exchange of cryptocurrencies from ETH to DAI, and vice versa.
Each operation within the pool has a commission of 1% on the total of the operation.
Of course, at this point the TWAP oracles come into operation, allowing Uniswap to correctly work the prices of both assets, to carry out operations according to the real price levels of those assets. However, pool creators can also create so-called "Price Ranges" which is a new feature within V3. These price ranges allow you to specify a percentage or customizable price level that is adjusted taking into account the price offered by TWAP. Said in a simpler way: it is a spread adjusted by the investors of the pool. This tool is useful because it helps investors to get more profits, but if it is abused it can bankrupt the pool, because no one will want to use it, especially if there are other pools with lower liquidity and token prices.
However, Uniswap on its own is quite capable of handling these details giving investors excellent levels of profit right from the start, especially if the pool (and thus its trading pair) is heavily used. This makes sense because the idea of Uniswap can be summed up in two points:
If token A is highly purchased and its supply decreases, the price of that token increases.
Contrary to token A, token B is oversold and its supply increases, because its price decreases.
Said in this simple way, Uniswap clone and its exchange policy is the same as what we see in traditional markets, here the market and supply-demand are everything.