@@ -18,8 +18,11 @@ import { waitForTx } from '@aave/deploy-v3';
1818makeSuite ( 'Pool: Simple FlashLoan' , ( testEnv : TestEnv ) => {
1919 let _mockFlashLoanSimpleReceiver = { } as MockFlashLoanSimpleReceiver ;
2020
21- const { ERC20_TRANSFER_AMOUNT_EXCEEDS_BALANCE , INVALID_FLASHLOAN_EXECUTOR_RETURN } =
22- ProtocolErrors ;
21+ const {
22+ ERC20_TRANSFER_AMOUNT_EXCEEDS_BALANCE ,
23+ INVALID_FLASHLOAN_EXECUTOR_RETURN ,
24+ FLASHLOAN_DISABLED ,
25+ } = ProtocolErrors ;
2326 const TOTAL_PREMIUM = 9 ;
2427 const PREMIUM_TO_PROTOCOL = 3000 ;
2528
@@ -178,6 +181,30 @@ makeSuite('Pool: Simple FlashLoan', (testEnv: TestEnv) => {
178181 ) . to . be . equal ( reservesBefore ) ;
179182 } ) ;
180183
184+ it ( 'Takes a simple ETH flashloan after flashloaning disabled' , async ( ) => {
185+ const { pool, configurator, helpersContract, weth } = testEnv ;
186+
187+ expect ( await configurator . setReserveFlashLoaning ( weth . address , false ) ) ;
188+ let wethFlashLoanEnabled = await helpersContract . getFlashLoanEnabled ( weth . address ) ;
189+ expect ( wethFlashLoanEnabled ) . to . be . equal ( false ) ;
190+
191+ const wethFlashBorrowedAmount = ethers . utils . parseEther ( '0.8' ) ;
192+
193+ await expect (
194+ pool . flashLoanSimple (
195+ _mockFlashLoanSimpleReceiver . address ,
196+ weth . address ,
197+ wethFlashBorrowedAmount ,
198+ '0x10' ,
199+ '0'
200+ )
201+ ) . to . be . revertedWith ( FLASHLOAN_DISABLED ) ;
202+
203+ expect ( await configurator . setReserveFlashLoaning ( weth . address , true ) ) ;
204+ wethFlashLoanEnabled = await helpersContract . getFlashLoanEnabled ( weth . address ) ;
205+ expect ( wethFlashLoanEnabled ) . to . be . equal ( true ) ;
206+ } ) ;
207+
181208 it ( 'Takes WETH flashloan, does not return the funds (revert expected)' , async ( ) => {
182209 const { pool, weth, users } = testEnv ;
183210 const caller = users [ 1 ] ;
0 commit comments