import { ILendingPoolAddressesProvider } from "./ILendingPoolAddressesProvider.sol"; // 通过该接口获取LendingPool地址
import { FlashLoanReceiverBase } from "./FlashLoanReceiverBase.sol"; // 接收闪电贷金额的合约必须通过IFlashLoanReceiver 接口实现的 executeOperation()
import { ILendingPool } from "./ILendingPool.sol"; // 通过该接口调用flashloan
import { IERC20 } from "./IERC20.sol"; // 涉及到ERC20代币所需
请注意闪电贷将扣取一定量的手续费,平台手续费为0.09%
第二步,设置FlashLoanReceiverBase
FlashLoanReceiverBase.sol
abstractcontractFlashLoanReceiverBaseisIFlashLoanReceiver{usingSafeERC20forIERC20;usingSafeMathforuint256;ILendingPoolAddressesProviderpublicimmutableoverrideADDRESSES_PROVIDER;ILendingPoolpublicimmutableoverrideLENDING_POOL;constructor(ILendingPoolAddressesProviderprovider) public {ADDRESSES_PROVIDER=provider;LENDING_POOL=ILendingPool(provider.getLendingPool()); }}