source: https://giphy.com/samjackgilmore

How to create Flash loans with Aave — Part 1

Naz
Coinmonks
Published in
3 min readSep 13, 2020

--

What is a flash loan? It is an uncollateralized debt. Woah!? There is no equivalent in the real world. With Aave Protocol’s smart contracts, you can borrow any amount of Ethereum or ERC20 within your smart contract, if you pay it back by the end of the transaction, plus a fee (currently @ 0.09%)

source: me

Your smart contract must follow a certain blueprint to flash loans. It needs a

(i) a function that asks for a loan from Aave (above: flash loan)

(ii) a function that executes the operations with the lent funds (above: executeOperation)

If by the end of the second function you give back the lent amounts + fee (currently set at 0.09%), the transaction will succeed, if not, Aave will revert the transaction (Ethereum allows for atomicity of transactions. This is possible because all of this code gets executed inside of the sandboxed Ethereum Virtual Machine, which is just an application that runs on each Ethereum client. So before any state transition can happen in Ethereum, a bunch of EVM code is ran)

Take this course and learn about the Flash loans

--

--

Naz
Coinmonks

I crave knowledge. Mathematical knowledge and then computer science.