Execution:
pact flashloans.repl -t
Description:
- This is just a demo to see how the flash loan workflow could be implemented.
- It only covers a subset of the use cases: only "simple" flavour (one asset) and the repayment is done in the transaction, there is no debt position.
- The real workflow involves moving assets temporarily from reserve to the smart contract received and invoke the caller contract (https://github.com/aave/aave-v3-core/blob/master/contracts/protocol/libraries/logic/FlashLoanLogic.sol) . This behaviour is only simulated in this demo.
- I don't check any address, signature, etc. It is mandatory to check them in order to avoid security risks. As long as no collateral is needed is a high-risk operation which may lead to extract liquidity from the pool. https://www.cpomagazine.com/cyber-security/flash-loan-attack-takes-beanstalk-defi-platform-for-182-million-largest-yet-of-its-type/