testnet-flash-liquidity

BSD-3-CLAUSE License

Stars
26
Committers
2

Testnet Flash Liquidity Demo

Template smart contracts for accessing flash liquidity from Aave V3 testnet markets. Two variants: simple (borrowing a single token) and batch (multiple tokens).

These templates utilize faucet of Aave testnet markets to mint flashloan premium, allowing an address to call executeFlashloan and execute a simple borrow and return transaction.

Notes:

  • Aave V3 faucets have a per-txn limit of 10000 (in underlying token decimals)
  • BGD Labs Address Registry contains PoolAddressesProvider, Faucet, and underlying reserve token addresses
  • It's recommended to add access modifiers (e.g. onlyOwner) to any public facing functions to prevent griefing attacks, especially if funds are stored on contract
  • For more instructions on deploying a contract in Remix, check out this awesome guide from Chainlink

Steps

  • 1.) Open contract in remix:
  • 2.) Complile and deploy to any network with Aave Protocol market, passing in the PoolAddressesProvider and Faucet for Aave market to the constructor, addresses here
  • 3.) Call executeFlashloan with underlyingToken and amount parameters, token addresses here,

* To get the underlying token address and available amount, go to the overview page for the reserve you want to borrow:

  • underlying token address is: A
  • max amount available to borrow is: B / C * (10^D)

If an underlying token has a debtCeiling, the max amount available to borrow is min(totalBorrowed - debtCeiling, availableLiquidity).

Aave V3 testnet faucets which are used in templates have a per-tx mint limit of 10000 (in underlying token decimals).