@@ -670,19 +670,18 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => {
670670 const amountToRepay = new BigNumber ( expectedDaiAmount . toString ( ) )
671671 . multipliedBy ( 1.1 )
672672 . toFixed ( 0 ) ;
673+ const liquidityToSwap = await convertToCurrencyDecimals ( weth . address , '10.8' ) ;
674+ await mockAugustus . expectBuy ( weth . address , dai . address , liquidityToSwap , expectedDaiAmount , amountToRepay ) ;
675+
676+ const mockAugustusCalldata = mockAugustus . interface . encodeFunctionData (
677+ 'buy' ,
678+ [ weth . address , dai . address , flashLoanAmount , expectedDaiAmount ]
679+ ) ;
673680
674- await mockAugustus . expectBuy ( weth . address , dai . address , flashLoanAmount , expectedDaiAmount , amountToRepay ) ;
675- const liquidityToSwap = await convertToCurrencyDecimals ( weth . address , '10.8' ) ;
676-
677- const mockAugustusCalldata = mockAugustus . interface . encodeFunctionData (
678- 'buy' ,
679- [ weth . address , dai . address , liquidityToSwap , expectedDaiAmount ]
680- ) ;
681-
682- const flashloanPremium = flashLoanAmount . mul ( 9 ) . div ( 10000 ) ;
683- const flashloanTotal = flashLoanAmount . add ( flashloanPremium ) ;
684- await aWETH . connect ( user ) . approve ( paraswapRepayAdapter . address , flashloanTotal ) ;
685- const userAEthBalanceBefore = await aWETH . balanceOf ( userAddress ) ;
681+ const flashloanPremium = flashLoanAmount . mul ( 9 ) . div ( 10000 ) ;
682+ const flashloanTotal = flashLoanAmount . add ( flashloanPremium ) ;
683+ await aWETH . connect ( user ) . approve ( paraswapRepayAdapter . address , flashloanTotal ) ;
684+ const userAEthBalanceBefore = await aWETH . balanceOf ( userAddress ) ;
686685
687686
688687 // Add a % to repay on top of the debt
@@ -772,10 +771,10 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => {
772771 . multipliedBy ( 1.1 )
773772 . toFixed ( 0 ) ;
774773
775- await mockAugustus . expectBuy ( weth . address , dai . address , flashLoanAmount , expectedDaiAmount , amountToRepay ) ;
774+ await mockAugustus . expectBuy ( weth . address , dai . address , liquidityToSwap , expectedDaiAmount , amountToRepay ) ;
776775 const mockAugustusCalldata = mockAugustus . interface . encodeFunctionData (
777776 'buy' ,
778- [ weth . address , dai . address , liquidityToSwap , expectedDaiAmount ]
777+ [ weth . address , dai . address , flashLoanAmount , expectedDaiAmount ]
779778 ) ;
780779
781780 const flashloanPremium = flashLoanAmount . mul ( 9 ) . div ( 10000 ) ;
0 commit comments