diff --git a/src/contracts/base/BaseParaSwapAdapter.sol b/src/contracts/base/BaseParaSwapAdapter.sol index 51057da..b08a268 100644 --- a/src/contracts/base/BaseParaSwapAdapter.sol +++ b/src/contracts/base/BaseParaSwapAdapter.sol @@ -120,4 +120,17 @@ abstract contract BaseParaSwapAdapter is Ownable, IBaseParaSwapAdapter { POOL.withdraw(reserve, aTokenBalanceDiff, address(this)); return aTokenBalanceDiff; } + + /** + * @dev Renews the asset allowance in case the current allowance is below a given threshold + * @param asset The address of the asset + * @param minAmount The minimum required allowance to the Aave Pool + */ + function _conditionalRenewAllowance(address asset, uint256 minAmount) internal { + uint256 allowance = IERC20(asset).allowance(address(this), address(POOL)); + if (allowance < minAmount) { + IERC20(asset).safeApprove(address(POOL), 0); + IERC20(asset).safeApprove(address(POOL), type(uint256).max); + } + } } diff --git a/src/contracts/base/ParaSwapDebtSwapAdapter.sol b/src/contracts/base/ParaSwapDebtSwapAdapter.sol index a0e716b..a4cdab7 100644 --- a/src/contracts/base/ParaSwapDebtSwapAdapter.sol +++ b/src/contracts/base/ParaSwapDebtSwapAdapter.sol @@ -44,11 +44,6 @@ abstract contract ParaSwapDebtSwapAdapter is } } - function renewAllowance(address reserve) public { - IERC20WithPermit(reserve).safeApprove(address(POOL), 0); - IERC20WithPermit(reserve).safeApprove(address(POOL), type(uint256).max); - } - /** * @dev Swaps one type of debt to another. Therefore this methods performs the following actions in order: * 1. Delegate credit in new debt @@ -235,11 +230,4 @@ abstract contract ParaSwapDebtSwapAdapter is ); return amountSold; } - - function _conditionalRenewAllowance(address asset, uint256 minAmount) internal { - uint256 allowance = IERC20(asset).allowance(address(this), address(POOL)); - if (allowance < minAmount) { - renewAllowance(asset); - } - } } diff --git a/src/contracts/base/ParaSwapLiquiditySwapAdapter.sol b/src/contracts/base/ParaSwapLiquiditySwapAdapter.sol index d20f548..bce99c9 100644 --- a/src/contracts/base/ParaSwapLiquiditySwapAdapter.sol +++ b/src/contracts/base/ParaSwapLiquiditySwapAdapter.sol @@ -51,15 +51,6 @@ abstract contract ParaSwapLiquiditySwapAdapter is } } - /** - * @notice Renews the asset allowance to the Aave Pool - * @param reserve The address of the asset - */ - function renewAllowance(address reserve) public { - IERC20(reserve).safeApprove(address(POOL), 0); - IERC20(reserve).safeApprove(address(POOL), type(uint256).max); - } - /// @inheritdoc IParaSwapLiquiditySwapAdapter function swapLiquidity( LiquiditySwapParams memory liquiditySwapParams, @@ -191,18 +182,6 @@ abstract contract ParaSwapLiquiditySwapAdapter is return amountReceived; } - /** - * @dev Renews the asset allowance in case the current allowance is below a given threshold - * @param asset The address of the asset - * @param minAmount The minimum required allowance to the Aave Pool - */ - function _conditionalRenewAllowance(address asset, uint256 minAmount) internal { - uint256 allowance = IERC20(asset).allowance(address(this), address(POOL)); - if (allowance < minAmount) { - renewAllowance(asset); - } - } - /** * @dev Triggers the flashloan passing encoded params for the collateral swap * @param liquiditySwapParams struct describing the liquidity swap diff --git a/src/contracts/base/ParaSwapRepayAdapter.sol b/src/contracts/base/ParaSwapRepayAdapter.sol index da4b414..4ab2583 100644 --- a/src/contracts/base/ParaSwapRepayAdapter.sol +++ b/src/contracts/base/ParaSwapRepayAdapter.sol @@ -53,15 +53,6 @@ abstract contract ParaSwapRepayAdapter is } } - /** - * @notice Renews the asset allowance to the Aave Pool - * @param reserve The address of the asset - */ - function renewAllowance(address reserve) public { - IERC20(reserve).safeApprove(address(POOL), 0); - IERC20(reserve).safeApprove(address(POOL), type(uint256).max); - } - /// @inheritdoc IParaSwapRepayAdapter function repayWithCollateral( RepayParams memory repayParams, @@ -240,18 +231,6 @@ abstract contract ParaSwapRepayAdapter is ); } - /** - * @dev Renews the asset allowance in case the current allowance is below a given threshold - * @param asset The address of the asset - * @param minAmount The minimum required allowance to the Aave Pool - */ - function _conditionalRenewAllowance(address asset, uint256 minAmount) internal { - uint256 allowance = IERC20(asset).allowance(address(this), address(POOL)); - if (allowance < minAmount) { - renewAllowance(asset); - } - } - /** * @dev Returns the amount of debt to repay for the user * @param debtAsset The address of the asset to repay the debt