Discover more from Economics Design Newsletter
Flash Loans 101
Using Flash Loans to Exploit US$33 million?
Victor, the ceo or the co-founder of Bitcurate, joined us to talk all about Flash Loans. Flash Loans are just a tool, they can be used for good (trading strategies) or for evil (exploits and hacks).
Welcome, premium subscribers! Thank you for subscribing. I appreciate you very much.
TLDR below. This is not financial advice.
Catch the episode on YouTube
What is a Flash Loan ?
Flash loan is essentially a loan that you can secure through a smart contract from the DeFi protocols liquidity pool.
For instance, Aave has a liquidity pool of 1 million USD. You can take a (flash) loan up to 1 million. The only condition is that you will need to return that loan within one single transaction.
We call this as atomic swap. You need to do it within one single block. So you go to code and write the scripts. Behind the scenes, you actually get the loan and return the loan within one single block that is the simple description of a flash loan.
Why is it used?
Generally people use it for two purposes :
They're actually using it to do arbitrage trading so that you can actually do trading without having your own capital that is very powerful.
Let's say you're taking a leveraged loan on like different platforms like MakerDao or compound and sometimes you know that you want to swap different assets, instead of you actually having to find some sort of collateral to replace the asset. You can use a flash loan to do that. Then you can just swap it by using flash loan. So there are a couple of scenarios whereby traders and investors can use this mechanism to help them to fulfil certain requirements that they have.
How it Work
Let's say we do a flash loan now — you and me. I give you 10 bucks and once I give you 10 bucks, I'm expected to get 10 bucks back correct? That's exactly how flash loan works. I give you 10 bucks to give me 10 bucks back.
Why do people do this? How do I make money with flash loans?
Question: if you have the 10 bucks in the first place why are you borrowing it from me and if the whole transaction is we giving each other 10 bucks then what's the point of it because you still have to pay gas fees for these transactions right?
Answer: To explain this let's say you are Aave. You have a million worth of $USDT or any other stable coins in your liquidity pool.
I as a trader or investor need to have a liquidity of a million US dollars added from someone so I go to you. I’m actually writing a script on a smart contract and I’ll be borrowing that one million dollar from you.
Side note: during this process, me (trader/investor/loan user) only has to pay gas fees and transaction fees. I do not need any collaterals.
In the process I will need to return that money to you within the same block. If I’m unable to return the same amount plus the fees that are supposed to be returned, then the whole transaction will be reverted back to its original state.
Can flash loan exist on non-blockchain platform?
Short answer: possible in theory.
Long answer: We have to go down in depth to look at the details of the mechanics or the foundation of the protocol itself whether they support it. For example, bitcoin is hard.
The reason why it is happening on ethereum is because you have a smart contract to it, which is the Turing complete ethereum virtual machine. But on the traditional side, let's say for example if you think about it from the bank perspective or the traditional finance perspective, I think that is much tougher because there is always a counterparty risk to this part. For crypto the counter party risk is actually slightly reduced because you actually hold your own key and your own wallet that's the difference.
Exploits using Flash Loans
Here are the recent hacks and exploits using flash loans.
Barrier to mass adoption
To get to get into the crypto space and to get in the DeFi space, there is already a layer of complication. First you have to understand finance. Then you have to understand technology. Then you have to understand some basic economics to understand how things work. And now we're going to have these like crazy massively powerful efficient products that make people feel lost and it's so complicated that people are just struggling to get used to it.
Credit delegation is so huge and it's so important but no one's really talking about it so let’s talk about three types of delegation :
The first kind of delegation is you know the friends and family things because If you have bad credit scores you can't get loans but if you can get a friend or family to sponsor you kind of thing then you can delegate your credit because you don't need that credit score and that's going to be very helpful for that person. I think that works because then you're allocating and distributing economic value to people who need it.
The second type of credit delegation is where you are looking at you know I don’t have really close friends and families but people in general that I trust within my bigger circle,social circle or my client or someone that I have a social contract with and then I can issue credit to them and they can be borrowing and then we can be doing business.
Then there's this credit delegation where you kind of just put it into the pool and people can take your credit so you delegate your credit to almost random people so that they can be using their credit to be borrowing other stuff and then executing whatever trade.
Note: Credit delegation are still being implemented and experimented. It could work well with staking mechanisms in place and governance voting in the future. Using credit delegation with flash loans might also be another use-case.
Advice to Economics Designers/Engineers
The first thing is to learn the code because a lot of people who are actually in finance don’t really understand how it works in the code world. There's a lot of things that could be imagined and could be done or could be executed but you need to understand the constraint of the code itself to know what actually could be possible and what is not possible so that itself is actually the first fundamental layer.
The second one of course to understand like the economics, the tokenomics, the basics of it right the mechanism and game theory. You know the fundamental and you still need to be on the code so if you are able to understand that you are already way better than a lot of people in terms of understanding and execution.
Flash loans are powerful, especially for traders and investors. It is a complicated tool that can be used for both good (reduce risk when trading) and evil (exploits and hacks).
Get smart: It's not a tool for everyone. At least not right now.
Get smarter: Crypto-insurance comes in handy because these could be seen as a smart contract technological risk and you could be covered.