@@ -176,7 +176,7 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => {
176
176
}
177
177
} ) ;
178
178
179
- it ( 'Takes an authorized AAVE flash loan with mode = 0, returns the funds correctly' , async ( ) => {
179
+ it ( 'Takes an authorized AAVE flash loan with mode = 0, returns the funds correctly, premium should be 0 ' , async ( ) => {
180
180
const {
181
181
pool,
182
182
helpersContract,
@@ -194,17 +194,21 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => {
194
194
195
195
const totalLiquidityBefore = reserveData . totalAToken ;
196
196
197
- await pool
198
- . connect ( authorizedUser . signer )
199
- . flashLoan (
200
- _mockFlashLoanReceiver . address ,
201
- [ aave . address ] ,
202
- [ flashBorrowedAmount ] ,
203
- [ 0 ] ,
204
- _mockFlashLoanReceiver . address ,
205
- '0x10' ,
206
- '0'
207
- ) ;
197
+ await expect (
198
+ pool
199
+ . connect ( authorizedUser . signer )
200
+ . flashLoan (
201
+ _mockFlashLoanReceiver . address ,
202
+ [ aave . address ] ,
203
+ [ flashBorrowedAmount ] ,
204
+ [ 0 ] ,
205
+ _mockFlashLoanReceiver . address ,
206
+ '0x10' ,
207
+ '0'
208
+ )
209
+ )
210
+ . to . emit ( _mockFlashLoanReceiver , 'ExecutedWithSuccess' )
211
+ . withArgs ( [ aave . address ] , [ flashBorrowedAmount ] , [ 0 ] ) ;
208
212
209
213
await pool . mintToTreasury ( [ aave . address ] ) ;
210
214
@@ -570,7 +574,7 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => {
570
574
) . to . be . revertedWith ( COLLATERAL_BALANCE_IS_ZERO ) ;
571
575
} ) ;
572
576
573
- it ( 'Caller deposits 5 WETH as collateral, Takes a USDC flashloan with mode = 2, does not return the funds. A loan for caller is created' , async ( ) => {
577
+ it ( 'Caller deposits 5 WETH as collateral, Takes a USDC flashloan with mode = 2, does not return the funds. A loan for caller is created, premium should be 0 ' , async ( ) => {
574
578
const { usdc, pool, weth, users, helpersContract } = testEnv ;
575
579
576
580
const caller = users [ 2 ] ;
@@ -585,21 +589,26 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => {
585
589
586
590
await pool . connect ( caller . signer ) . deposit ( weth . address , amountToDeposit , caller . address , '0' ) ;
587
591
588
- await _mockFlashLoanReceiver . setFailExecutionTransfer ( true ) ;
589
-
590
592
const flashloanAmount = await convertToCurrencyDecimals ( usdc . address , '500' ) ;
591
593
592
- await pool
593
- . connect ( caller . signer )
594
- . flashLoan (
595
- _mockFlashLoanReceiver . address ,
596
- [ usdc . address ] ,
597
- [ flashloanAmount ] ,
598
- [ 2 ] ,
599
- caller . address ,
600
- '0x10' ,
601
- '0'
602
- ) ;
594
+ await _mockFlashLoanReceiver . setFailExecutionTransfer ( false ) ;
595
+
596
+ await expect (
597
+ pool
598
+ . connect ( caller . signer )
599
+ . flashLoan (
600
+ _mockFlashLoanReceiver . address ,
601
+ [ usdc . address ] ,
602
+ [ flashloanAmount ] ,
603
+ [ 2 ] ,
604
+ caller . address ,
605
+ '0x10' ,
606
+ '0'
607
+ )
608
+ )
609
+ . to . emit ( _mockFlashLoanReceiver , 'ExecutedWithSuccess' )
610
+ . withArgs ( [ usdc . address ] , [ flashloanAmount ] , [ 0 ] ) ;
611
+
603
612
const { variableDebtTokenAddress } = await helpersContract . getReserveTokensAddresses (
604
613
usdc . address
605
614
) ;
0 commit comments