Skip to content

Commit fc5cdab

Browse files
committed
Revert "fix: Reset allowance after Aave interaction"
This reverts commit 8952ac5.
1 parent 8952ac5 commit fc5cdab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
130131
IERC20(collateralAsset).safeApprove(address(POOL), collateralBalanceLeft);
131132
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);
136137
IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
137138
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);
191192
IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
192193
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

Comments
 (0)