DeFi Saver
Action that gets and receives a flash loan from Aave V2 protocol.
Aave V2 flash loans are specific as you can borrow multiple assets all at once and repay them at the end or incur debt at the end. When repaying the Aave V2 FL you only need to set an approval and tokens will get pulled with no need to send the FL amount anywhere.
Inputs are not parsed as the FL action is always the first action and there are no return values before this action. Inputs are the following:


  • address[] tokens - Array of tokens being flash loaned.
  • uint256[] amounts - Array of amounts being flash loaned.
  • uint256[] modes - Modes we want to flash loan (repay debt or incur debt, only 0 debt type is supported).
  • address onBehalfOf - If we are not repaying the flash loan what address will incur the debt (can be empty if we are just repaying the loan).
  • address flParamGetterAddr - Address of an on chain contract that can change (amount, token) while calling the action. If it's an empty address it will not be called.
  • bytes flParamGetterData - Data that will be supplied to flParamGetter contract
  • {} - An extra empty parameter (explained why it's needed in the Flash loans section)
The return of the flashloan action is the amount[0] + fee[0] as we can only return one value from the action.
Copy link