npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

erc3156-wrappers

v0.0.1

Published

ERC3156 wrapper contracts for popular flash lenders

Downloads

19

Readme

ERC20 Flash

This project implements ERC-3156 wrappers for the flash loan functionality of dYdX, Aave, Uniswap and Yield.

Contracts deployed

Mainnet

So far, only the dYdX wrapper has been deployed, to allow for a degree of testing in mainnet. Please raise an issue if you would like to test any of the other wrappers. All wrappers will be deployed in mainnet no later than the date in which ERC3156 progresses to a Final state.

| Lender Contract | Lender Address | Commit | | ------------- |-------------- | | DYDXERC3156 | 0x6bdC1FCB2F13d1bA9D26ccEc3983d5D4bf318693 | 5493629 |

Fantom

| Lender Contract | Lender Address | | ------------- |-------------- | | UniswapERC3156 | 0xa89a83890Cc5d43D710846cEFCb4a41007a37347 | e9f4cdf |

Kovan

In all real use cases, you will have to create your own contract to take flashLoans, calling the flashLoan function on an ERC3156 compliant lender (or one of the wrappers in this repo), and implementing the onFlashLoan callback.

However, you can use FlashBorrower to kick the tires. You can give to the flashBorrow function the address of an ERC3156 compliant lender (such as any of the wrappers in this repo), the address of a supported ERC20 token (which for wrappers depends on the underlying lender such as Aave) and a loan value. Upon execution a flash loan will happen, which you can examine in etherscan.io or tenderly.co. You will need to have transferred to FlashBorrower enough of the ERC20 being borrowed beforehand to pay for the fees.

| Lender Contract | Lender Address | | ------------- |-------------- | | FlashBorrower | 0x5e3538099b9d19Dc8EB13cb1AD2b0e93D2cC2EbB | | FlashMinter | 0xC8df3958bb0D68e22e4d974CdA71d73A4e7E73b9 | | FlashLender | 0xeef77EAE62e80F5F56b85Be318B57BF1470874F5 | | AaveERC3156 | 0xC355Fb535757B069D84B3bB01c27240DF973FBa2 | | DYDXERC3156 | 0xf1E70c817C82975Dfb6a0B7AB65b803f871E2c4E | | UniswapERC3156 | 0x353939fcA37c1782512229d5D4f0d3E83Bf46B2C | | YieldDaiERC3156 | 0x8E1ceabD0996bbDd15E611D26d333b8e9d684a27 | | YieldFYDaiERC3156 | 0x2F01fa8f4377682018B74B696933528ba03f1eb0 |

Tested currencies

The flash loans have been tested with the ERC20 tokens below, but should work for any tokens that the underlying lenders make available.

| Lender Contract | Currency | | -------------------------- |-------------------- | | FlashMinter | FlashMinter - 0x1e198e90c7166f7f9fD24b9D7A0451D7AeE78a3F | | FlashLender, AaveERC3156, DYDXERC3156, UniswapERC3156 | WETH9 - 0xd0A1E359811322d97991E03f863a0C30C2cF029C | | FlashLender, YieldDaiERC3156, UniswapERC3156 | DAI - 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa | | DYDXERC3156 | DAI - 0xC4375B7De8af5a38a93548eb8453a498222C4fF2 | | AaveERC3156 | DAI - 0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD | | YieldFYDaiERC3156 | FYDAI - 0x6B166d6325586c86B44f01509Fc64e649DCfE7C4, 0x42AA68930d4430E2416036966983E6c9Fe8Ff2f8, 0x2b67866649AFcEFC63870E02EdefC318fd8760D3, 0x02B06417A3e3CB391970C6074AbcF2745a60b880, 0x6Abb65246346b2A52Faed338cB18880e70A57Cf8 |

Sample Execution

Let's say you want to test a flash loan of 10 DAI from Uniswap using FlashBorrower and the UniswapERC3156 wrapper.

  1. Head to the Flash Borrower contract
  2. Connect via Web3 and expand '1. flashBorrow'
  3. Input the following:
  lender: 0xeBe2432d4b8C59F33674F6076ddeE8643B8039d1
  token: 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa
  value: 10000000000000000000
  1. Then click Write to execute.
  2. If all went well it should look like this.

Flash Borrower needs to have enough of the borrowed token to pay for the flash loan fees.

  1. Check the fee amount with the flashFee function, the token is DAI (0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa).
  2. Check the DAI balance of flashBorrower (0xeeb0c120bF35fB0793b1c7d0D93230e552020398) balanceOf function of the DAI contract.
  3. If FlashBorrower doesn't have enough DAI to pay for the loan fees, go to Uniswap and making sure that you are in Kovan, buy some DAI by address (0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa) and send it to the FlashBorrower (0xeeb0c120bF35fB0793b1c7d0D93230e552020398).

Things to note

Flash loan basics still apply under this wrapper i.e.:

  • If you're flashing 100 DAI @ 9bps/flash, make sure there's at least 100 + 0.09 DAI on the contract by the end of the transaction
  • Native flash fees as at 31st Dec 2020 are: Aave 9bps, Uniswap 30 bps, dYdX 2 Wei, Yield 2.5 bps (time variant)
  • Flash lenders generally have significantly reduced liquidity on kovan testnet, so if your tx is reverting, check whether you're requesting an amount higher than their respective testnet reserves
  • Different protocols use different versions of the same token on kovan testnet, so make sure you pick the right one from above based on lender. This isn't an issue on mainnet.