packages/hardhat/contractsfolder and check out what contracts we have there.
DAI.sol. All other contracts contain interfaces and constants for smooth development.
IFlashLoanReceiverinterface by implementing the relevant
FlashLoanReceiverBase, which conforms to the
WETH. Also, we will trade using two different exhanges:
Sushiswap. Sushiswap is just a fork of Uniswap. That's why they have absolutely identical Router interfaces.
500 DAI. However, you can choose any token and borrow any amount. Check out
loanSizeconstant in our contract.
MyV2FlashLoan.solcontract. This function will be executed right after we receive our requested assets -
mustdo this if you do not want to lose your money.
MyV2FlashLoanand send it
Snatchtab on your website.
myFlashLoanCalland watch what happens. After our transaction ends, let's check our DAI balance again.