Flash Loan Using UniswapV2-Based AMMs

What is Flash Loan?

Performing a Swap on UniswapV2

Swapping Diagram from https://uniswap.org/docs/v2/core-concepts/swaps/
Swapping helper functions from UniswapV2Router contract
swap function in UniswapV2Pair

Performing a Flash Loan

if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);

About Inspex

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Inspex

Cybersecurity professional service, specialized in blockchain and smart contract auditing https://twitter.com/InspexCo