• Stars
    star
    269
  • Rank 152,662 (Top 4 %)
  • Language
    Solidity
  • Created over 2 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Comparison of flash loan solutions on Ethereum

Comparison of flash loan solutions on Ethereum

Results

Obtained via:

$ forge test --fork-url $ETH_RPC_URL --gas-report --optimize --optimizer-runs 10

AAVE (0.09% fee on WETH)

╭────────────────────────────┬─────────────────┬───────┬────────┬────────┬─────────╮
│ src/AAVE.sol:AAVE contract ┆                 ┆       ┆        ┆        ┆         │
╞════════════════════════════╪═════════════════╪═══════╪════════╪════════╪═════════╡
│ Deployment Cost            ┆ Deployment Size ┆       ┆        ┆        ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ 290331                     ┆ 1482            ┆       ┆        ┆        ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ Function Name              ┆ min             ┆ avg   ┆ median ┆ max    ┆ # calls │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ executeOperation           ┆ 24562           ┆ 24772 ┆ 24562  ┆ 26662  ┆ 10      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ flashLoan                  ┆ 69708           ┆ 81912 ┆ 69708  ┆ 191757 ┆ 10      │
╰────────────────────────────┴─────────────────┴───────┴────────┴────────┴─────────╯

Balancer (free)

╭────────────────────────────────────┬─────────────────┬───────┬────────┬───────┬─────────╮
│ src/Balancer.sol:Balancer contract ┆                 ┆       ┆        ┆       ┆         │
╞════════════════════════════════════╪═════════════════╪═══════╪════════╪═══════╪═════════╡
│ Deployment Cost                    ┆ Deployment Size ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ 247087                             ┆ 1266            ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ Function Name                      ┆ min             ┆ avg   ┆ median ┆ max   ┆ # calls │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ flashLoan                          ┆ 24407           ┆ 25727 ┆ 24407  ┆ 37608 ┆ 10      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ receiveFlashLoan                   ┆ 4150            ┆ 4150  ┆ 4150   ┆ 4150  ┆ 10      │
╰────────────────────────────────────┴─────────────────┴───────┴────────┴───────┴─────────╯

Euler (free)

╭──────────────────────────────┬─────────────────┬───────┬────────┬───────┬─────────╮
│ src/Euler.sol:Euler contract ┆                 ┆       ┆        ┆       ┆         │
╞══════════════════════════════╪═════════════════╪═══════╪════════╪═══════╪═════════╡
│ Deployment Cost              ┆ Deployment Size ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ 187632                       ┆ 969             ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ Function Name                ┆ min             ┆ avg   ┆ median ┆ max   ┆ # calls │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ flashLoan                    ┆ 18570           ┆ 20594 ┆ 18570  ┆ 38812 ┆ 10      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ onFlashLoan                  ┆ 3627            ┆ 3627  ┆ 3627   ┆ 3627  ┆ 10      │
╰──────────────────────────────┴─────────────────┴───────┴────────┴───────┴─────────╯

UniswapV2 (0.3009027% fee)

╭──────────────────────────────────────┬─────────────────┬───────┬────────┬───────┬─────────╮
│ src/UniswapV2.sol:UniswapV2 contract ┆                 ┆       ┆        ┆       ┆         │
╞══════════════════════════════════════╪═════════════════╪═══════╪════════╪═══════╪═════════╡
│ Deployment Cost                      ┆ Deployment Size ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ 173220                               ┆ 897             ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ Function Name                        ┆ min             ┆ avg   ┆ median ┆ max   ┆ # calls │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ flashLoan                            ┆ 20154           ┆ 24835 ┆ 20154  ┆ 66970 ┆ 10      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ uniswapV2Call                        ┆ 4502            ┆ 4502  ┆ 4502   ┆ 4502  ┆ 10      │
╰──────────────────────────────────────┴─────────────────┴───────┴────────┴───────┴─────────╯

UniswapV3 (0.05%, 0.3%, 1% fee, depending on pool)

╭──────────────────────────────────────┬─────────────────┬───────┬────────┬───────┬─────────╮
│ src/UniswapV3.sol:UniswapV3 contract ┆                 ┆       ┆        ┆       ┆         │
╞══════════════════════════════════════╪═════════════════╪═══════╪════════╪═══════╪═════════╡
│ Deployment Cost                      ┆ Deployment Size ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ 171014                               ┆ 886             ┆       ┆        ┆       ┆         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ Function Name                        ┆ min             ┆ avg   ┆ median ┆ max   ┆ # calls │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ flashLoan                            ┆ 22899           ┆ 26339 ┆ 22899  ┆ 57299 ┆ 10      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ uniswapV3FlashCallback               ┆ 4348            ┆ 4348  ┆ 4348   ┆ 4348  ┆ 10      │
╰──────────────────────────────────────┴─────────────────┴───────┴────────┴───────┴─────────╯

More Repositories

1

blockchain_go

A simplified blockchain implementation in Golang
Go
4,102
star
2

uniswapv3-book

Uniswap V3 Development Book
JavaScript
596
star
3

uniswapv3-code

Uniswap V3 clone built to learn smart-contracts development in Solidity
Solidity
281
star
4

zuniswapv2

UniswapV2 clone made in educational purposes
Solidity
171
star
5

awesome-blockchain

A curated list of blockchain resources for developers
Makefile
119
star
6

zuniswap

UniswapV1 clone made in educational purposes
JavaScript
117
star
7

tinybit

Tiny Bitcoin Node [Work in Progress]
Go
40
star
8

uniswapv3-unrefunded-eth-poc

Solidity
38
star
9

upgradeable-proxy-from-scratch

Code from "Upgradeable proxy contract from scratch" blog post
JavaScript
24
star
10

defi-strategy-eth-staking

Leveraged ETH staking strategy contract
Solidity
21
star
11

uniswapv2-contracts

Uniswap V2 contracts, ready to be deployed to local or test network
Solidity
14
star
12

ethernaut-solutions

My solutions for Ethernaut, https://ethernaut.openzeppelin.com/
Solidity
10
star
13

rails_telegram_bot

Rails Telegram Bot
Ruby
8
star
14

eosgo

Instead, use:
Go
7
star
15

StackUnderflow

A clone of StackOverflow
Ruby
6
star
16

eos-abi

ABI deserializer for EOS
Go
4
star
17

uniswapv4-book

🚧 WORK IN PROGRESS 🚧
JavaScript
4
star
18

eosio-alpine

Alpine Linux based Docker image of EOS blockchain
Dockerfile
3
star
19

titan-finance-analysis

Analysis of the TITAN fall
JavaScript
3
star
20

manzana-client

Ruby
2
star
21

opscript

A viewer and debugger of Bitcoin scripts.
Go
2
star
22

go-blogs-demo

An example multi-tenancy application in Golang
Go
1
star
23

bank_client

Ruby
1
star
24

micros

A basic microservices setup
Go
1
star
25

switter

Twitter-like application on Ruby on Rails from scratch
Ruby
1
star
26

jeiwan.github.io

A blog about blockchains and smart contracts development
HTML
1
star