Flash loans: the most magical building block in DeFi Lego

Flash loans: the most magical building block in DeFi Lego

In my opinion, flash loans are the most magical building block in DeFi Lego. However, because they are often associated with hacker attacks and there are not enough applications based on them, the charm of flash loans has not been fully demonstrated.

Therefore, I tried to write this article, starting from the small use case of flash loans, to abstract some of its possible significance. However, it is a bit exaggerated to say that the significance is too high, so please only take this article as a personal point of view. I would also like to thank Gao Jin from the YFII community and Seb from the InstaDApp community for accepting the interview and providing their knowledge and insights on flash loans for this article.

1. Flash loans are a torrent that wipes out injustice

When the price of tokens on different DEXs is different, you can use flash loans for arbitrage. The process is simple: borrow a flash loan, use the money to buy tokens on a DEX with a lower price, then sell the purchased tokens on a DEX with a higher price, and finally use the money from selling the tokens to repay the flash loan. As long as the price difference between buying and selling tokens is higher than the sum of the flash loan fee and the gas fee, arbitrage can be completed; while arbitrage, the price difference between different DEXs is "leveled".

After the liquidation is triggered, the liquidation price is different from the market price, and a flash loan can be used for liquidation. The process is as follows: borrow a flash loan, first obtain collateral at the liquidation price, then sell the collateral at the market price, and finally use the money from the sale of the collateral to repay the flash loan. Generally speaking, the liquidation income may be 3%~5%, and the handling fee of the flash loan is 0.3% in uniswap v2, 0.09% in aave, and 2wei in dydx.

Arbitrage and liquidation involve different prices in the spatial dimension, while futures involve different prices in the time dimension. Flash loans can also be applied here.

For example, use a flash loan to go long on ETH: borrow DAI with a flash loan, then use DAI to buy ETH on DEX, then borrow DAI by mortgaging ETH on Compound (here ETH is the sum of ETH purchased with DAI and a small portion of the user’s own ETH), and finally use the borrowed DAI to repay the flash loan.

The above are just a few examples of price “unevenness”. In the absence of flash loans, these unevennesses may not be efficiently eliminated due to costs and risks.

But with flash loans, things are different. Flash loans have low costs but high efficiency, and can use large amounts of funds but with low risks. This is an unprecedented unequal relationship between advantages and disadvantages (perhaps it can be said that this relationship does not conform to the laws of the physical world). Under this premise, any form of price inequality is almost a deterministic opportunity.

Flash loans are like a torrent of funds that can smooth out unevenness along the way, and the most important thing is that everyone can summon it effortlessly. The DeFi world with flash loans is flat.

If we extend this, prices represent information, and flash loans can eliminate price imbalances, which may mean: in the DeFi world, as long as new information appears, the information will be transmitted to each participant at the speed of a flash loan, and the participants can make decisions based on the new information, and their decision information will also be transmitted at the speed of a flash loan.

This will result in a system that transmits information quickly and fully, and perhaps the biggest advantage of such a system is its efficiency. In addition, the system's rapid error correction capabilities can also reduce the accumulation of systemic risks.

2. Flash loans make money no longer expensive, but strategies become expensive

The money for flash loans will be cheap, and the amount of funds that can be used for flash loans will be huge. There are two main reasons for this:

First, zero risk. The biggest risk faced by traditional lenders is default risk, but this risk does not exist for flash loans: lenders never have to worry about borrowers not being able to repay the money. In terms of fund security, flash loan lenders have zero risk.

Second, it can be used part-time. The assets on the chain can be used as flash loan funds in the flash loan pool while fulfilling their original functions, because in the eyes of other operations on the chain, the flash loan funds are always unoccupied and always available.

An extreme example of part-time work is to build the flash loan function into the ERC20 token itself, which means that all assets of the token can naturally be borrowed through flash loans.

There is a view on flash loans that there is no opportunity cost for the funds used for flash loans, and using the funds for flash loans will not cause this part of the funds to lose other opportunities. This should be the same thing as "part-time job".

Because of the above reasons, competition in the flash loan market may lead to the transaction fees of flash loans approaching zero in the future, and the amount of funds that can be borrowed approaching infinity.

Outside of the flash loan market, there is a more extreme product called Flash Forge: you can create assets out of thin air through Flash Forge, as many as you want, as long as you destroy all the minted assets at the end of this atomic transaction. Think about the cost of using funds and the amount of funds in this case.

What will happen if flash loans make money less expensive? Perhaps we can decompose and abstract the financial activities on the chain into two categories: one is that flash loans cannot be used, that is, the type of occupying funds, and the other is that flash loans can be used, that is, the type of using funds. (Note: This classification is not accurate, it is only used in this article to distinguish the two different ways in which funds work)

The capital-occupying operating model may be similar to the traditional model, in which capital occupies a core position; but the capital-using operating model may be completely different from the traditional model, because the source of funds is easily available and cheap flash loans, and funds are no longer important to the model.

When capital is no longer expensive, what is expensive is strategy. Good strategies occupy a core position, which is beneficial to both those who propose strategies and those who invest in strategies. The benefits will flow to them, rather than to the capital that drives the strategy. The flow of benefits to strategies will encourage the emergence and development of more good strategies, which is meaningful to the evolution of the entire ecosystem.

When funds are no longer expensive, the design logic of financial products also needs to change. The simplest change is for example some arbitrage and liquidation protocols, where one of their important tasks was to attract user funds. But if the cost of using flash loans approaches zero in the future, they don’t need to consider user or funding issues when designing.

From another perspective, like Gao Jin's point of view, he believes that flash loans make more funds available to users. One of its major application scenarios is that there is some opportunity in the market that can make you make money, but you lack funds.

However, at this stage, flash loans are not cheap enough. The cost of using some funds is lower than that of flash loans, and many arbitrage activities will not choose flash loans. So now we can only say that flash loans are the highest cost of funds for this type of financial activities, but we cannot say that flash loans are the best or only choice. However, the future will depend on the development of the flash loan market.

An extended topic is: when financial activities that use funds no longer need to occupy funds, funds can be used for financial activities that occupy funds, which is equivalent to increasing the total amount of available funds in disguise (previously the funds had to be divided into two halves and used in two places, but now the funds only need to be used in one place). It can also be considered to have improved the utilization rate of available funds (some funds were previously waiting to be used, but now they are all in use).

3. Flash loans are a bridge for deploying funds, providing users with the ability to manage assets across protocols

InstaDApp seems to be the application that has developed the most flash loan usage and packaged it for users to use directly. I contacted its community manager Seb on Discord to learn about the usage of flash loans in the application and their views on flash loans.

Seb told me that according to the data, a popular use of flash loans is as a bridge for users to deploy funds. For example, when SAI migrated to DAI, they saw many use cases of flash loans. (Note: Seb is collating the relevant data of flash loans. After he provides it to me later, I will put it in the comments of this article for reference)

It is easy to migrate assets or debts using flash loans. For example, if you want to transfer your lending relationship from protocol A to protocol B, you can: borrow a flash loan, use the money to redeem the collateral in protocol A, then deposit the collateral into protocol B to borrow funds, and finally use the borrowed funds to repay the flash loan.

With flash loans, funds can flow from one protocol to another, and from one asset class to another, almost unimpeded.

From an ecological perspective, flash loans have made the walled garden of applications/protocols shorter. As long as users think that a certain protocol or type of asset is a better choice for them, they can easily migrate their assets there. This will lead to a more competitive and more evolutionary system.

From the user's perspective, Seb believes that the liquidity provided by flash loans can provide users with the ability to manage assets across protocols, which is also an ability to automate asset management (automated account management).

Users only need to set their own strategies, and their accounts can borrow from flash loans, and automatically complete operations when conditions are triggered, such as refinancing when interest rates change. Where does liquidity come from? From flash loans.

Conclusion:

Money has been given too many functions by us. What will happen if we separate these functions? For the human brain, it may be much easier to identify and process a multi-function than to process multiple single functions, but for computers, processing single functions is its strength.

So when money exists and operates in the form of code, if we separate the functions of money, can we improve the efficiency of all individual functions? Is this a more reasonable direction?

In my opinion, what flash loans are doing is to separate the function of money.

So let’s end with this really lightning-fast excerpt from a poem by William Blake:

A grain of sand is a world.

A flower is a paradise.

Infinite in the palm of your hand,

A moment becomes eternity.

<<:  Popular Science丨What is Cryptocurrency Mining?

>>:  Bitcoin saw a net outflow of $1.5 billion in 24 hours. The big waterfall has finally arrived. Is this year's market over?

Recommend

El Salvador Government Plans to Deploy 200 Bitcoin ATMs in the Country

The government of El Salvador plans to deploy 200...

What do women who are born to suffer look like?

Some people work hard all their lives and still ac...

Physiognomy analysis of who is more likely to fail in their career

Physiognomy analysis of who is more likely to fai...

What is the face of a woman who brings good luck to her husband?

If a woman is able to bring good luck to her husb...

Let you understand the whole picture of Bitcoin in three minutes

In 2008, Bitcoin was invented by a mysterious per...

Payments and marijuana: alternative uses for blockchain

Rage Comment : Blockchain is often regarded as om...

Talking about blockchain (10): Events and Logs in Ethereum

Events and logs in Ethereum are particularly conf...

Hysterical face girl

Hysteria is a word that everyone is familiar with...

A good-looking woman who can marry

A good-looking woman who can marry Marriage is li...