@@ -171,16 +171,6 @@ contract EulerSwap is IEulerSwap, EVCUtil {
171
171
IEVC (evc).enableCollateral (eulerAccount, vault1);
172
172
}
173
173
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
-
184
174
/// @inheritdoc IEulerSwap
185
175
function verify (uint256 newReserve0 , uint256 newReserve1 ) public view returns (bool ) {
186
176
if (newReserve0 > type (uint112 ).max || newReserve1 > type (uint112 ).max) return false ;
@@ -231,6 +221,19 @@ contract EulerSwap is IEulerSwap, EVCUtil {
231
221
return amount;
232
222
}
233
223
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
+
234
237
function myDebt (address vault ) internal view returns (uint256 ) {
235
238
return IEVault (vault).debtOf (eulerAccount);
236
239
}
0 commit comments