@@ -171,16 +171,6 @@ contract EulerSwap is IEulerSwap, EVCUtil {
171171 IEVC (evc).enableCollateral (eulerAccount, vault1);
172172 }
173173
174- function approveVault (address asset , address vault ) internal {
175- address permit2 = IEVault (vault).permit2Address ();
176- if (permit2 == address (0 )) {
177- IERC20 (asset).forceApprove (vault, type (uint256 ).max);
178- } else {
179- IERC20 (asset).forceApprove (permit2, type (uint256 ).max);
180- IAllowanceTransfer (permit2).approve (asset, vault, type (uint160 ).max, type (uint48 ).max);
181- }
182- }
183-
184174 /// @inheritdoc IEulerSwap
185175 function verify (uint256 newReserve0 , uint256 newReserve1 ) public view returns (bool ) {
186176 if (newReserve0 > type (uint112 ).max || newReserve1 > type (uint112 ).max) return false ;
@@ -231,6 +221,19 @@ contract EulerSwap is IEulerSwap, EVCUtil {
231221 return amount;
232222 }
233223
224+ /// @notice Approves tokens for a given vault, supporting both standard approvals and permit2
225+ /// @param asset The address of the token to approve
226+ /// @param vault The address of the vault to approve the token for
227+ function approveVault (address asset , address vault ) internal {
228+ address permit2 = IEVault (vault).permit2Address ();
229+ if (permit2 == address (0 )) {
230+ IERC20 (asset).forceApprove (vault, type (uint256 ).max);
231+ } else {
232+ IERC20 (asset).forceApprove (permit2, type (uint256 ).max);
233+ IAllowanceTransfer (permit2).approve (asset, vault, type (uint160 ).max, type (uint48 ).max);
234+ }
235+ }
236+
234237 function myDebt (address vault ) internal view returns (uint256 ) {
235238 return IEVault (vault).debtOf (eulerAccount);
236239 }
0 commit comments