@@ -127,15 +127,15 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
127127
128128 //deposit collateral back in the pool, if left after the swap(buy)
129129 if (collateralBalanceLeft > 0 ) {
130- IERC20 (collateralAsset).safeApprove (address (POOL), 0 );
131130 IERC20 (collateralAsset).safeApprove (address (POOL), collateralBalanceLeft);
132131 POOL.deposit (address (collateralAsset), collateralBalanceLeft, msg .sender , 0 );
132+ IERC20 (collateralAsset).safeApprove (address (POOL), 0 );
133133 }
134134
135135 // Repay debt. Approves 0 first to comply with tokens that implement the anti frontrunning approval fix
136- IERC20 (debtAsset).safeApprove (address (POOL), 0 );
137136 IERC20 (debtAsset).safeApprove (address (POOL), debtRepayAmount);
138137 POOL.repay (address (debtAsset), debtRepayAmount, debtRateMode, msg .sender );
138+ IERC20 (debtAsset).safeApprove (address (POOL), 0 );
139139
140140 {
141141 //transfer excess of debtAsset back to the user, if any
@@ -188,9 +188,9 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
188188 );
189189
190190 // Repay debt. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
191- IERC20 (debtAsset).safeApprove (address (POOL), 0 );
192191 IERC20 (debtAsset).safeApprove (address (POOL), debtRepayAmount);
193192 POOL.repay (address (debtAsset), debtRepayAmount, rateMode, initiator);
193+ IERC20 (debtAsset).safeApprove (address (POOL), 0 );
194194
195195 uint256 neededForFlashLoanRepay = amountSold.add (premium);
196196
0 commit comments