What kind of future can dismantling Uniswap launch? DeFi Will Eat CeFi
区块链研习社
2020-08-26 06:15
本文约7557字,阅读全文需要约30分钟
When DeFi can trade almost any asset, can support large transactions with very little slippage, DeFi will be more attractive than CeFi!
Uniswap is now a giant among DeFi projects.

According to the statistics of DeFi Pulse, the current lock-up volume is about 160 million US dollars. According to DeBank statistics, in the past 24 hours, the turnover was as high as 215 million US dollars. The trading volume of Uniswap has surpassed most centralized exchanges.image description

(DeFi Pulse: Uniswap locked position is about 169 million US dollars)

What is Uniswap?

Uniswap is a star DeFi project on the Ethereum blockchain. You can exchange tokens through Uniswap without a counterparty. The transaction is carried out on the chain and the transaction can be matched immediately. Whether you are a cryptocurrency enthusiast, a smart contract developer, or a fan interested in financial technology and financial trends, Uniswap is an object of attention not to be missed.

Uniswap is one of the leaders in the current DeFi boom. Through its decentralized design, many holders of ERC20 tokens can complete token transactions directly through their own wallets, without the need for centralized exchanges.

In addition, Uniswap allows users to become market makers to provide liquidity and earn benefits. In particular, Uniswap is one of the few DeFi projects on Ethereum that has not issued governance tokens.

Uniswap is not only a separate token exchange service, but also can be combined with other DeFi applications. Many smart contracts will use Uniswap as the cornerstone of their own services, which also reflects a feature of DeFi: as reliable as Lego toys. stitching.

In this article, we focus on the evolution process of Uniswap from V1 to V2, and focus on the new features of Uniswap V2. besides,We are very concerned about a topic: what kind of future can we infer from the design of Uniswap? And how will DeFi evolve with CeFi in the future?

secondary title

Two versions of Uniswap

What confuses many users about Uniswap is that Uniswap V1 and Uniswap V2 still coexist. Usually after the software is upgraded, the latest version will be used by default, but Uniswap is somewhat different. After the release of Uniswap V2, Uniswap V1 will continue to run. However, as time goes by, the number of users of Uniswap V1 is getting smaller and smaller.

secondary title

Uniswap V1: Possibility of automated market makers confirmed

The contribution of Uniswap V1 is: laying the foundation for on-chain token exchange and decentralized token circulation pool protocol, Uniswap V1 designed a way to charge a small fee for token exchange, and use this part of the fee to motivate users to provide liquidity. After all, for an instant exchange design, the depth of liquidity is crucial.

Different from the common exchange order book model, Uniswap adopts an algorithmic pricing method to automatically price user trading pairs based on the information of the current token circulation pool and the user's exchange volume. Different token trading pairs (such as DAI-ETH trading pair, or DAI-USDC trading pair) will have their own circulation pools. Users need to pay a small transaction fee for each transaction; in addition, users can also deposit corresponding tokens to provide liquidity according to the token value of 1:1, so as to share the fee income.

secondary title

Uniswap V2: Make Uniswap more perfect

Based on the V1 version, Uniswap V2 has made a lot of upgrades and improvements to the Uniswap protocol. In a nutshell, it includes the following:

  • Direct trading between ERC20 tokens becomes possible. Prior to this, transactions between ERC20 tokens required the use of ETH as an intermediary, but after the upgrade, the transaction volume and handling fee (gas) were greatly reduced. This also allows more DApps to have a more efficient way to create exchange methods between different tokens.

  • Added price oracle (Oracle) functionality. By increasing the weighted average price, Uniswap V2 can provide the value of the time-weighted average price for external contracts, so that the contract can track the time-weighted average price in any time interval, which increases the difficulty of attacks.

  • Added flash function. Completed in one transaction: operations of borrowing currency, arbitrage trading, and returning the original token. If the transaction fails at any stage, then the entire transaction will not be completed. In this way, users can use Uniswap's token circulation pool to perform arbitrage transactions. In addition, there are other uses, such as the completion of specific DeFi operations such as closing the market maker's vault, which can reduce gas costs.

  • secondary title

Uniswap upgrade from V1 to V2

image description

(Image source: Medium)

Among the new features brought by Uniswap V2, the most noteworthy point may be that it allows direct exchange of ERC20.

Uniswap V2 Token Exchange Method

As mentioned above, in Uniswap V1, every time tokens are exchanged, ETH is used as an intermediary. Token A is first converted to ETH, and then ETH is converted to B token. The Uniswap team calls this approach the "prototype" of their decentralized automatic exchange design, because in the V2 version, they have created a more efficient transaction execution method: tokens can be completed without resorting to ETH deal.

As shown in the figure, if users want to exchange between Dai and LINK tokens, they can directly use Uniswap's DAI - LINK token circulation pool, without using ETH. Here comes a question: If there is no direct token circulation pool between token A and token B, but token A-ETH and token B-ETH circulation pools exist, can token A still be exchanged? Convert to Token B?

The answer is yes. Uniswap V2 retains the option to allow users to make these types of swaps. As shown below:

Here, the implementation is similar to the Uniswap V1 version. The smart contract first converts DAI to ETH, then converts ETH to LINK tokens, and then transfers LINK back to users. The price of this is that double the handling fee is required.

Not only that, there are more redemption tricks, as shown in the picture below:

Users want to exchange tokens between DAI and LINK, which can be realized by connecting multiple token pools in series and through multiple exchanges.

As a reminder, while this method of exchange is possible, there is no smart contract method that can automatically facilitate a large number of token swaps. On the contrary, the front-end application must manually write the function code and make multiple transaction calls to Uniswap to achieve it. This is just a possibility, but in fact, it is neither convenient nor cost-effective to use such a complicated exchange path. In reality, few people will do this. After all, the high gas fee will make this kind of exchange operation Lost the purpose.

Dismantling the four elements of Uniswap

August 20, 2020Haseeb Qureshi from the DragonFly team expressed his opinion: There is evidence that Uniswap will move towards splitting in the future, and the development of DeFi will gradually swallow CeFi.If you want to judge this point of view, you might as well take a look, what functions does Uniswap provide now?

In a nutshell, Uniswap provides the following four basic features:

  • Token Supply in a Decentralized Way

  • Fixed fee structure

  • real-time quotation

  • Fixed product algorithm, used to price assets (x*y = k)

secondary title

Decentralized supply of token stock

On Uniswap, creating a new token liquidity pool, like an entrepreneurial team creating a new market, requires start-up capital. If you want to create a market maker market, such as the REN/ETH token pair, you need to get funds from various scattered investors and inject them into this liquidity pool. If profits are generated, the people who inject liquidity into this fund pool can also share the profits.

Looks pretty cool from a cypherpunk perspective, huh?But if you think about it from another angle, it's very strange: whenever there is a profit to speak of, what kind of market maker would sell its own equity to increase its inventory?

Usually, most profitable market makers use debt financing. For example, if there is a reliable way to obtain a 20% market rate of return, you may use 10% interest rate financing, and then keep the profits earned for yourself. But Uniswap doesn't keep any profits for itself. At least for now.

Suppose you want to create a token pool for an automated market maker. You are pretty sure that this token pool will be profitable for you. If you are rich enough, you can use all your own funds to maintain this circulation pool, and then lock it to prevent outsiders from participating.This seems reasonable: why give up equity to someone else if you can make money?

Such AMM pools already exist. For example,The DAI/USDC pool has set permissions and only allows the 0x team to provide liquidity.Such an AMM pool does not change the core value proposition of Uniswap. It still allows anyone to participate in transactions, still uses the on-chain pricing algorithm, and still has all the advantages of standard AMMs. However, this trading pool does not allow people other than the 0x team to participate in liquidity, so that all profits belong to the team.

There are similar examples in other projects. For example, Balancer allows users to create private circulation pools, and only specific users can provide liquidity.

This seems intuitive:If you know a market-making opportunity can make money, why give it up to others?secondary title

cost model

In Uniswap, the token liquidity provider (referred to as LP) will share the handling fee of each transaction. I expect there will be intense price competition between different AMMs, especially on assets like stablecoins.image description

(Source: Charlie Noyes, How impermanent losses vary with rates in Uniswap)

secondary title

Real-time quotation and fixed product algorithm pricing mechanism

image description

Uniswap's fixed product algorithm curve. Source: Dmitriy Berenzon

AMMs will always provide offers as long as tokens are available. But normal market makers don't do that!Consider 312 when the market plummeted. Facing a historic market crash, market makers withdrew their orders and fled. They didn't want to die in the market. Liquidity also dries up. That's bad for everyone else, but good for market makers who can manage risk.

Imagine a Uniswap twin that reads historical volatility and refuses to execute trades when volatility spikes. Or when all received orders are buy orders or sell orders, refuse to execute the transaction order. After all, side trade orders are often a signal of new information moving the market, which needs to be digested before market makers can offer profitable offers again.

Or the simplest approach is that the liquidity provider (LP) of the token pool can decide through governance that when they think that it is no longer meaningful to continue quoting, they will temporarily shut down the token pool and no longer accept transactions.

Obviously such a modification would break Uniswap's constant product algorithm. Because once the market makers restart, the price will need to reset somehow.

You should be able to understand what I want to express. These are the differences between Uniswap and fully intelligent market makers. To the extent you can mimic the behavior of a normal market maker, you may increase your profitability.

secondary title

Dismantling the pricing function of Uniswap

In almost every AMM project today, the pricing function is a continuous curve, and the only input value is the asset quantity. We call these pure pricing functions because they don't need to look at anything other than the token inventory in the contract. But there are a whole bunch of more complicated pricing functions!

For example: Suppose there is a price function that correlates the prices provided by Uniswap and Curve, and then reduces their net prices by ten thousandths as their own pricing. (Note that in this case, the design must be carefully designed, because the price may be manipulated by people using flash loans).

Or another scenario: There exists a pricing function that takes the Coinbase oracle signature price as input, and adds five percent on top of the Coinbase price as its own pricing.

These are just some of my thoughts. To be clear, both of these proposals are premature, but they work in principle. But both of these are not as good as a specific pricing function, and I think that in the future DeFi spot transactions, most of them will likely adopt this pricing function.

I think the most disruptive pricing function, is a simple signature-based pricing function. This pricing method will become a bridge between DeFi and CeFi, which will turn DeFi into a shadow market, and price changes will occur according to all liquidity changes in CeFi.

Let DeFi and CeFi begin to merge

You should be no stranger to OTC trading. There are a large number of encrypted asset transactions every day, which are carried out through OTC over-the-counter transactions. Suppose an OTC merchant makes an offer "1 ETH for $399", signed with a private key. All of his assets are on-chain, ready to execute quoted trades. If you accept the quotation, submit it to the smart contract on the chain of the OTC trader. The contract will verify the signature of the OTC trader, execute the order according to a specific price, and transfer the corresponding assets to you.

This is exactly the same as the OTC market, but in a fully programmatic way. You only need to visit the website/API to get the quotation, then confirm the transaction instruction in the wallet, send the quotation to the smart contract to execute the transaction, and you are done.

This contract is almost identical to Uniswap, except that the x * y = k pricing function is removed and signature verification is used instead. If the signature verification is passed and the quotation is valid, the transaction will be automatically executed to transfer assets.

This "OTC trading desk" is the AMM. But unlike Uniswap, an AMM can use whatever pricing function it wants.

It can look at the liquidity situation on other chains, it can look at Binance or Coinbase orders, it can use fancy machine learning algorithms and Twitter sentiment analysis or track exchange information on the blockchain, and when the market changes dramatically, it can stop Quote or stop the transaction to minimize losses.It can do all the chaotic and complicated things that a normal market maker can do! If the inventory of the contract is insufficient, the market maker can restructure its assets by itself.

The market maker is centralized, but trustless to its clients. Even if the market maker gives you a bad price, just don’t accept it!

In fact, if the market maker wants to, it can even raise funds from decentralized liquidity providers! Of course, a centralized market maker can do evil things, such as taking the assets of liquidity asset providers away. But you can mitigate this by using trusted hardware like Intel SGX, which has pre-programmed off-chain pricing algorithms that can be verified on-chain. In this way, for liquidity providers (LP) or users, there is no need to trust that market makers will not do evil when participating in financing.

But now it seems that this has not happened yet, and it is just a fantasy. I expect the first versions of this type of trading to be self-funded by market makers who already have off-chain systems generating quotes. This will allow current market makers or OTC markets to easily set up mechanisms to accept DeFi orders.

But the problem also arises: if someone receives a signed offer, then waits 20 seconds, and only executes if the price is in his favor, wouldn't this happen? In a sense, isn't AMM just constantly creating free options?

That's right, it will be like this! You can imagine this kind of AMM using behavioral signals from Ethereum addresses and IPs to give better offers to high-trust buyers and worse offers to spam creators. Or you can set decay quotes so that if a user waits too long after getting a quote, it will programmatically make the quote worse.

Imagine that every market maker could create its own API by deploying standardized contracts and software templates. Each contract has a configurable IP pointer so users and aggregators know how to check the current price or request a quote, and once their standardized contract is deployed to mainnet, it will be automatically indexed by the aggregator. Anywhere, any market maker can create their own service stall and start serving DeFi users in a few minutes, just like magic.

Of course many market makers are unable to do this for regulatory reasons. But you don’t need so many market makers involved to get network effects.As long as there are a few well-capitalized market makers in the world building businesses on DeFi and competing with each other, they can bridge price and liquidity between centralized exchanges and DeFi.

We know that ultimately an order book based approach will be the most efficient way to trade and form of price discovery. But for now, the cost of executing the order book trading model on-chain is high.

A true DeFi market maker will be the bridge that connects DeFi users to the world of centralized order books. Like a centralized exchange that hosts orders off-chain, DeFi becomes a shadow brokerage — a trustless front end that accesses liquidity across all cryptocurrency exchanges.

All of a sudden, all users using DeFi will be able to use the prices, assets and liquidity of exchanges such as Binance.

The future of DeFi

My attention to DeFi and DEX has been around for a long time. But recently I've had some inspiration. A friend came to me and said he wanted to invest in a newly listed token. He said: "I can find out which exchange has listed this token, which ones have sufficient liquidity, and then transfer my ETH there to exchange the token. But this process is too painful. Finally, I passed the aggregation transaction of 1inch app, you can buy it in a few clicks, and the price is pretty good."

This gave me some inspiration.People will use DeFi, not because DeFi is "truly decentralized" or because they like "no-custodial autonomous transactions", these reasons have no value. They are lazy and don't want to go to the exchange by themselves, so they will use DeFi.

Once DeFi becomes a brokerage company, which can trade almost any asset, can support large transactions with little slippage, then DeFi will be more attractive than centralized exchanges.For users who just want to buy and hold some cryptocurrencies, and are not active traders, using DeFi is as convenient as using a centralized company like Coinbase.

We might as well think about it: Once that day is reached, what chain reaction will there be? What else are those users doing on DeFi?

Like centralized exchanges, DeFi can offer many cross-selling services.

at last,

at last,People on DeFi and CeFi will have the same idea: good user experience, safe and fair pricing, and a wide range of investment assets to choose from.DeFi will provide users with more and more services that were originally provided by centralized exchanges.

I believe that one day, the idea of ​​DeFi swallowing CeFi will no longer be strange. I predict that day will be later than most people think. But the arrival of that day will exceed the expectations of most CeFi people.

-END-

original:

original:https://medium.com/

Disclaimer: This article is the author's independent opinion, and does not represent the position of the Blockchain Institute (public account), nor does it constitute any investment opinion or suggestion.

区块链研习社
作者文库