Instadapp / flashloan-aggregator

Flashloan Aggregator on all major chains.

Home Page:https://docs.instadapp.io/flashloan/flashloanAggregator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flashloan aggregator

KaymasJain opened this issue · comments

How flashloan works technically?

  • User's contract calls the flashloan contract with tokens, amounts and the encoded data in bytes to execute.
  • Flashloan contract sends the tokens to user's contract and calls a function (in Aave's case that function is executeOperation() with data and fees in the params.
  • User contracts decodes the data and use it in however manner they desire condition by the end of it user needs to return all the assets to the flashloan contract.

Aave flashloan docs.

Look at the readme here

This is our current flashloan. Not very much standardised at the moment.

Build an upgradable Flashloan aggregator contract.
It'll have a function like:

function initiateFlashLoan(	
        address[] memory tokens_,	
        uint256[] memory amounts_,
        uint256 route_,
        bytes calldata data	
    ) external isDSA isWhitelisted(data) {	
        // code
    }

route will help to decide from which flashloan provider do we need to flash borrow.