If you've been following DeFi or Ethereum over the past few months, you've likely heard the term "flash loan" mentioned again and again.

This new DeFi primitive has been at the core of a number of economic exploits and arbitrages.

A thread on the basics of flash loans - 👇

Most DeFi loans take place across days, weeks, or even months.

You can deposit Ethereum into Aave, then withdraw stablecoins for yield farming in Yearn, for instance.

On-chain loans have garnered much traction, with total debt outstanding moving toward $2.5 billion.
While popular, DeFi loans are not capital efficient: to account for custodial risk and volatility risk, you need to put up 130-150% of the value of your loan in collateral.

If your collateral slips below the threshold, you're liquidated, resulting in a fee anywhere from 5-13%.
Flash loans are much different than longer-term DeFi loans.

Flash loans are non-custodial, take place over the course of one block, and require no collateralization.

That's to say, the coins you borrow never appear in your wallet.
When taking a flash loan, you can direct the coins to any protocol and function, as long as you pay back the loan + interest fee within the same transaction.

So what the hell? What are flash loans used for?

More often than not, arbitrage.
This means that if you spot mispriced markets between AMMs or dexs, you can take a flash loan to arbitrage the pools.

Here's a simple example I spotted in the mempool a few months back:

https://t.co/hiBHuTerQH

More on what's happening in the next tweet.
- This user flash borrowed 2,048,000 USDC from dYdX

- Traded that USDC for 2,028,367 DAI in Curve's Y pool

- Traded that DAI for 2,064,182 USDC in Curve's sUSD pool

- Paid dYdX back + 2 wei

All in one block...

Profit: 16,182 USDC
Cost: $60 in gas

Crazy, right?
The transaction I mentioned is just one of many simple arbitrages between different AMMs and diff pools. (More on AMMs in the linked thread.)

There are also advanced arb strategies that enabled the "attacks" on Eminence, Harvest, etc.

Let's take a look.

https://t.co/wftj1YuPtG
Many of these arbs are not AMM based. Instead, these arbs are accomplished by leveraging some faulty or buggy logic in the economic design of a protocol.
Eminence:

- Borrow 15 million DAI from Uniswap
- Mint EMN
- Burn some EMN for eToken, driving up EMN up the curve
- Sell remaining EMN for DAI
- Make millions

The bug was the bonding curve was steep and could be manipulated.

https://t.co/fP3ae4oDXQ
Harvest:

The bug was that Harvest didn't use the get_virtual_price() function from Curve, allowing for manipulation.
Flash loans can also be used for other purposes.

Governance attacks are a good example. They're scary but still kind of sick, to be honest.

On October 26th, a user used flash loans to influence a MakerDAO proposal.

https://t.co/naqLqOi1bS
This user completed multiple complex functions with a single tx, within a single block.

They

- borrowed $20m worth of WETH from dYdX
- deposited it on Aave to borrow $7m worth of MKR
- Locked MKR in governance
- Voted on a proposal
- Unlocked MKR
- Sent MKR, then ETH back
Related to flash loans, developers are working on flash mints for Wrapped Ethereum and DAI. Will do another thread on these later.

Flash loans will be similar in concept to flash mints but will involve the minting, then burning of tokens rapidly to accomplish some feat.
To conclude: Flash loans are an extremely powerful DeFi primitive.

I forgot who said it but they're going to accelerate the wheat from the chaff when it comes to protocols with good economic design.

I'm excited (and scared) to see what flash loans are used for next.

More from Crypto

Quick Thread on #Altcoins/ #Altseason

Step 1: $BTC has a huge correction. Every range starts with either a pump (or dump) and then follows with a dump (or pump). In this case, #Bitcoin pumped and is now pulling back. This is


Step 2: $BTC ranges big once it finds a bottom. This will allow it to reaccumulate for a big summer run in 2021. This is HEALTHY IMO.


Step 3: Once $BTC finds a bottom and starts to grind up again, I expect $ALTS to do very very well in both alt/usd and alt/btc pairs. ALTSZN is almost always characterized by strong alt/btc pairs moving- I've already accumulated most and have done my final buying today and more.

$BTC.D typically has a very nice time during this time of the year. I was off on December prediction bc I thought $BTC was going to pull back by then but oh well! #Altcoins will start their pumping time VERY soon now.


More information on what #Altseason is and $ALTS market

You May Also Like

हिमालय पर्वत की एक बड़ी पवित्र गुफा थी।उस गुफा के निकट ही गंगा जी बहती थी।एक बार देवर्षि नारद विचरण करते हुए वहां आ पहुंचे।वह परम पवित्र गुफा नारद जी को अत्यंत सुहावनी लगी।वहां का मनोरम प्राकृतिक दृश्य,पर्वत,नदी और वन देख उनके हृदय में श्रीहरि विष्णु की भक्ति अत्यंत बलवती हो उठी।


और देवर्षि नारद वहीं बैठकर तपस्या में लीन हो गए।इन्द्र नारद की तपस्या से घबरा गए।उन्हें हमेशा की तरह अपना सिंहासन व स्वर्ग खोने का डर सताने लगा।इसलिए इन्द्र ने नारद की तपस्या भंग करने के लिए कामदेव को उनके पास भेज दिया।वहां पहुंच कामदेव ने अपनी माया से वसंतऋतु को उत्पन्न कर दिया।


पेड़ और पौधों पर रंग बिरंगे फूल खिल गए और कोयलें कूकने लगी,पक्षी चहकने लगे।शीतल,मंद,सुगंधित और सुहावनी हवा चलने लगी।रंभा आदि अप्सराएं नाचने लगीं ।किन्तु कामदेव की किसी भी माया का नारद पे कोई प्रभाव नहीं पड़ा।तब कामदेव को डर सताने लगा कि कहीं नारद क्रोध में आकर मुझे श्राप न देदें।

जैसे ही नारद ने अपनी आंखें खोली, उसी क्षण कामदेव ने उनसे क्षमा मांगी।नारद मुनि को तनिक भी क्रोध नहीं आया और उन्होने शीघ्र ही कामदेव को क्षमा कर दिया।कामदेव प्रसन्न होकर वहां से चले गए।कामदेव के चले जाने पर देवर्षि के मन में अहंकार आ गया कि मैने कामदेव को हरा दिया।

नारद फिर कैलाश जा पहुंचे और शिवजी को अपनी विजयगाथा सुनाई।शिव समझ गए कि नारद अहंकारी हो गए हैं और अगर ये बात विष्णु जी जान गए तो नारद के लिए अच्छा नहीं होगा।ये सोचकर शिवजी ने नारद को भगवन विष्णु को ये बात बताने के लीए मना किया। परंतु नारद जी को ये बात उचित नहीं लगी।
क्या आप जानते हैं कि क्या है, पितृ पक्ष में कौवे को खाना देने के पीछे का वैज्ञानिक कारण!

श्राद्ध पक्ष में कौओं का बड़ा ही महत्व है। कहते है कौआ यम का प्रतीक है, यदि आपके हाथों दिया गया भोजन ग्रहण कर ले, तो ऐसा माना जाता है कि पितरों की कृपा आपके ऊपर है और वे आपसे ख़ुश है।


कुछ लोग कहते हैं की व्यक्ति मरकर सबसे पहले कौवे के रूप में जन्म लेता है और उसे खाना खिलाने से वह भोजन पितरों को मिलता है

शायद हम सबने अपने घर के किसी बड़े बुज़ुर्ग, किसी पंडित या ज्योतिषाचार्य से ये सुना होगा। वे अनगिनत किस्से सुनाएंगे, कहेंगे बड़े बुज़ुर्ग कह गए इसीलिए ऐसा करना

शायद ही हमें कोई इसके पीछे का वैज्ञानिक कारण बता सके।

हमारे ऋषि मुनि और पौराणिक काल में रहने वाले लोग मुर्ख नहीं थे! कभी सोचियेगा कौवों को पितृ पक्ष में खिलाई खीर हमारे पूर्वजों तक कैसे पहुंचेगी?

हमारे ऋषि मुनि विद्वान थे, वे जो बात करते या कहते थे उसके पीछे कोई न कोई वैज्ञानिक कारण छुपा होता था।

एक बहुत रोचक तथ्य है पितृ पक्ष, भादो( भाद्रपद) प्रकृति और काक के बीच।

एक बात जो कह सकते कि हम सब ने स्वतः उग आये पीपल या बरगद का पेड़/ पौधा किसी न किसी दीवार, पुरानी

इमारत, पर्वत या अट्टालिकाओं पर ज़रूर देखा होगा। देखा है न?

ज़रा सोचिये पीपल या बरगद की बीज कैसे पहुंचे होंगे वहाँ तक? इनके बीज इतने हल्के भी नहीं होते के हवा उन्हें उड़ाके ले जा सके।