1
1
// SPDX-License-Identifier: UNLICENSED
2
2
pragma solidity ^ 0.8.27 ;
3
3
4
+ import {SafeERC20, IERC20 } from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol " ;
4
5
import {IEVC} from "evc/interfaces/IEthereumVaultConnector.sol " ;
5
- import {IEVault, IERC20 , IBorrowing, IERC4626 , IRiskManager} from "evk/EVault/IEVault.sol " ;
6
+ import {IEVault, IBorrowing, IERC4626 , IRiskManager} from "evk/EVault/IEVault.sol " ;
6
7
import {Errors as EVKErrors} from "evk/EVault/shared/Errors.sol " ;
7
8
import {IUniswapV2Callee} from "./interfaces/IUniswapV2Callee.sol " ;
8
9
import {IEulerSwap} from "./interfaces/IEulerSwap.sol " ;
@@ -11,6 +12,8 @@ import {EVCUtil} from "evc/utils/EVCUtil.sol";
11
12
import {Math} from "openzeppelin-contracts/utils/math/Math.sol " ;
12
13
13
14
contract EulerSwap is IEulerSwap , EVCUtil {
15
+ using SafeERC20 for IERC20 ;
16
+
14
17
bytes32 public constant curve = keccak256 ("EulerSwap v1 " );
15
18
16
19
address public immutable vault0;
@@ -155,17 +158,17 @@ contract EulerSwap is IEulerSwap, EVCUtil {
155
158
156
159
address permit2 = IEVault (vault0).permit2Address ();
157
160
if (permit2 == address (0 )) {
158
- IERC20 (asset0).approve (vault0, type (uint256 ).max);
161
+ IERC20 (asset0).forceApprove (vault0, type (uint256 ).max);
159
162
} else {
160
- IERC20 (asset0).approve (permit2, type (uint256 ).max);
163
+ IERC20 (asset0).forceApprove (permit2, type (uint256 ).max);
161
164
IAllowanceTransfer (permit2).approve (asset0, vault0, type (uint160 ).max, type (uint48 ).max);
162
165
}
163
166
164
167
permit2 = IEVault (vault1).permit2Address ();
165
168
if (permit2 == address (0 )) {
166
- IERC20 (asset1).approve (vault1, type (uint256 ).max);
169
+ IERC20 (asset1).forceApprove (vault1, type (uint256 ).max);
167
170
} else {
168
- IERC20 (asset1).approve (permit2, type (uint256 ).max);
171
+ IERC20 (asset1).forceApprove (permit2, type (uint256 ).max);
169
172
IAllowanceTransfer (permit2).approve (asset1, vault1, type (uint160 ).max, type (uint48 ).max);
170
173
}
171
174
0 commit comments