@@ -127,15 +127,15 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
127
127
128
128
//deposit collateral back in the pool, if left after the swap(buy)
129
129
if (collateralBalanceLeft > 0 ) {
130
- IERC20 (collateralAsset).safeApprove (address (POOL), 0 );
131
130
IERC20 (collateralAsset).safeApprove (address (POOL), collateralBalanceLeft);
132
131
POOL.deposit (address (collateralAsset), collateralBalanceLeft, msg .sender , 0 );
132
+ IERC20 (collateralAsset).safeApprove (address (POOL), 0 );
133
133
}
134
134
135
135
// Repay debt. Approves 0 first to comply with tokens that implement the anti frontrunning approval fix
136
- IERC20 (debtAsset).safeApprove (address (POOL), 0 );
137
136
IERC20 (debtAsset).safeApprove (address (POOL), debtRepayAmount);
138
137
POOL.repay (address (debtAsset), debtRepayAmount, debtRateMode, msg .sender );
138
+ IERC20 (debtAsset).safeApprove (address (POOL), 0 );
139
139
140
140
{
141
141
//transfer excess of debtAsset back to the user, if any
@@ -188,9 +188,9 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
188
188
);
189
189
190
190
// Repay debt. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
191
- IERC20 (debtAsset).safeApprove (address (POOL), 0 );
192
191
IERC20 (debtAsset).safeApprove (address (POOL), debtRepayAmount);
193
192
POOL.repay (address (debtAsset), debtRepayAmount, rateMode, initiator);
193
+ IERC20 (debtAsset).safeApprove (address (POOL), 0 );
194
194
195
195
uint256 neededForFlashLoanRepay = amountSold.add (premium);
196
196
0 commit comments