Skip to content

Commit e93deae

Browse files
committed
handle EulerEarn-style ZeroShares errors
1 parent 153cf82 commit e93deae

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libraries/FundsLib.sol

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol"
66

77
import {IEVC} from "evc/interfaces/IEthereumVaultConnector.sol";
88
import {IEVault, IBorrowing, IERC4626, IRiskManager} from "evk/EVault/IEVault.sol";
9-
import {Errors as EVKErrors} from "evk/EVault/shared/Errors.sol";
109

1110
import {IEulerSwap} from "../interfaces/IEulerSwap.sol";
1211

@@ -15,6 +14,9 @@ library FundsLib {
1514

1615
error DepositFailure(bytes reason);
1716

17+
error E_ZeroShares(); // EVK error
18+
error ZeroShares(); // Euler Earn error
19+
1820
/// @notice Approves tokens for a given vault, supporting both standard approvals and permit2
1921
/// @param vault The address of the vault to approve the token for
2022
function approveVault(address vault) internal {
@@ -97,7 +99,10 @@ library FundsLib {
9799
if (amount > 0) {
98100
try IEVault(supplyVault).deposit(amount, eulerAccount) {}
99101
catch (bytes memory reason) {
100-
require(bytes4(reason) == EVKErrors.E_ZeroShares.selector, DepositFailure(reason));
102+
require(
103+
bytes4(reason) == E_ZeroShares.selector || bytes4(reason) == ZeroShares.selector,
104+
DepositFailure(reason)
105+
);
101106
amount = 0;
102107
}
103108

0 commit comments

Comments
 (0)