Have you heard of the recently popular Uniswap protocol?
黑色马里奥
2020-04-06 02:33
本文约1568字,阅读全文需要约6分钟
Briefly introduce the following basic model Uniswap protocol about SWAP DEX.

With the popularity of decentralized financial DEFI, it actually provides a theoretical basis for many infrastructures in the blockchain world. And Li Lizhong of Ant Financial once said that the first field of blockchain technology to be implemented must also be the financial field. So now we look at the DEFI field, although there are often various problems, such as the BZX theft incident, the 0DAI incident, etc., which also reflect the immaturity of the current DEFI industry, and in the face of batches of DEFI projects Decline and rise, we are all witnesses in the development process of DEFI.

According to Dappreview data (it is recommended that friends who study DEFI can go to Dappreview to view the corresponding data, which is relatively comprehensive), currently DEFI includes lending, reserve DEX (Ethereum flash exchange model), order book DEX, payment, stable currency, prediction market, There are seven categories of financial derivatives, and all DEFI projects included in it (basically the projects currently in operation) include 25, with a total lock-up value of 751,084,393 US dollars, and the Ethereum loan project MAKER accounts for 41.86 of all lock-ups %. In fact, the current volume of DEFI is still very small, and the loan funds are in a state of dominance in the DEFI field. Although the current distribution is not healthy, it is gradually developing towards a trend of one super and many strong.

And a category in DEFI, the reserve DEX (called SWAP DEX is more pleasing to the ear) has often appeared in our field of vision recently. Then the following content will briefly introduce the Uniswap protocol, the basic model of SWAP DEX, from Mario's personal perspective.

In fact, I prefer to understand the Uniswap protocol as a kind of "flash exchange". Users can convert one TOKEN into another TOKEN through the Uniswap protocol. From the perspective of ETH, it is ETH and ERC2.0 tokens A flash in between.

In the Uniswap protocol, there is a fund pool, and each currency corresponds to a fund pool. For example, if I want to exchange ETH for a certain ERC2.0TOEKNN, let’s call him A, then I actually send the ETH in my hand to the contract Enter the ETH fund pool, and the algorithm coefficient set by the system program. You will get the tokens sent by the corresponding amount of A TOKEN funds. In fact, we can understand it as a transaction between the user and the smart contract.

In the Uniswap protocol, there are two types of transaction contracts and factory contracts. In fact, it is easy to understand literally. Each currency will correspond to a unique fund pool. This fund pool can actually be understood as a transaction contract, which automatically transfers assets in and out with users. There may be many, many transaction contracts. The factory contract is used to deploy the transaction contract. If you want to deploy a transaction contract for your ERC2.0 token, you must deploy it through the factory contract.

And when the two currencies are traded, reserve funds are prepared in the corresponding transaction contract, that is, the fund pool, then the transaction exchange rate of the first trader provides an initial ratio for the two, then according to the continuous Trading, liquidity is constantly increasing. Based on its constant product value algorithm, the prices of the two tokens will gradually be consistent with the outside world. If the price of UEFA Champions League tokens in the equivalent is out of balance, traders will come to move bricks to balance the price with the outside world. This is the Uniswap protocol. Approximate idea.

In fact, the "order book" matching transactions of traditional exchanges rely on the buying and selling market, so if there is not a sufficient buying and selling market depth, the trading experience will be extremely poor. Then the Uniswap protocol solves this problem very well, and in the DEX that is considered to be weak in intervention, the Uniswap protocol can be used as the basic model of transactions.

At present, the Uniswap protocol has been used as a section of SWAP DEX in DEFI, which includes four "flash swap" protocols: Uniswap, Bancor, Kyber, and Tokenlon. In fact, it is OK to call it DEX or flash swap. The Uniswap protocol model has actually been deployed on the Ethereum network in November 2018, and it has gone through a one-year development period before. Today, the Uniswap protocol cannot be said to be mature, but its feasibility has been confirmed. At present, some DEXs in the EOS ecosystem are also trying to deploy the Uniswap protocol, such as the recently launched Newdex Swap, and this is the first practice of the Uniswap protocol in a system other than the Ethereum chain.

However, the Uniswap protocol is more autonomous, and autonomy will include many human factors, so the credit for TOKEN, such as a low-quality TOKEN (capital token), will directly affect the development of the entire system.

黑色马里奥
作者文库