|
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 {IUniswapV2Callee} from "./interfaces/IUniswapV2Callee.sol";
|
7 | 8 | import {IEulerSwap} from "./interfaces/IEulerSwap.sol";
|
8 | 9 | import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol";
|
9 | 10 | import {EVCUtil} from "evc/utils/EVCUtil.sol";
|
10 | 11 |
|
11 | 12 | contract EulerSwap is IEulerSwap, EVCUtil {
|
| 13 | + using SafeERC20 for IERC20; |
| 14 | + |
12 | 15 | bytes32 public constant curve = keccak256("EulerSwap v1");
|
13 | 16 |
|
14 | 17 | address public immutable vault0;
|
@@ -154,17 +157,17 @@ contract EulerSwap is IEulerSwap, EVCUtil {
|
154 | 157 |
|
155 | 158 | address permit2 = IEVault(vault0).permit2Address();
|
156 | 159 | if (permit2 == address(0)) {
|
157 |
| - IERC20(asset0).approve(vault0, type(uint256).max); |
| 160 | + IERC20(asset0).forceApprove(vault0, type(uint256).max); |
158 | 161 | } else {
|
159 |
| - IERC20(asset0).approve(permit2, type(uint256).max); |
| 162 | + IERC20(asset0).forceApprove(permit2, type(uint256).max); |
160 | 163 | IAllowanceTransfer(permit2).approve(asset0, vault0, type(uint160).max, type(uint48).max);
|
161 | 164 | }
|
162 | 165 |
|
163 | 166 | permit2 = IEVault(vault1).permit2Address();
|
164 | 167 | if (permit2 == address(0)) {
|
165 |
| - IERC20(asset1).approve(vault1, type(uint256).max); |
| 168 | + IERC20(asset1).forceApprove(vault1, type(uint256).max); |
166 | 169 | } else {
|
167 |
| - IERC20(asset1).approve(permit2, type(uint256).max); |
| 170 | + IERC20(asset1).forceApprove(permit2, type(uint256).max); |
168 | 171 | IAllowanceTransfer(permit2).approve(asset1, vault1, type(uint160).max, type(uint48).max);
|
169 | 172 | }
|
170 | 173 |
|
|
0 commit comments