Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15 - custom errors for keeper contract call failures #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions contracts/EverlongStrategyKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { DebtAllocator } from "vault-periphery/debtAllocators/DebtAllocator.sol"
import { IVault } from "yearn-vaults-v3/interfaces/IVault.sol";
import { Roles } from "yearn-vaults-v3/interfaces/Roles.sol";
import { IEverlongStrategy } from "./interfaces/IEverlongStrategy.sol";
import { IEverlongStrategyKeeper } from "./interfaces/IEverlongStrategyKeeper.sol";
import { IRoleManager } from "./interfaces/IRoleManager.sol";
import { EVERLONG_STRATEGY_KEEPER_KIND, EVERLONG_VERSION, ONE, MAX_BPS } from "./libraries/Constants.sol";
import { EverlongPortfolioLibrary } from "./libraries/EverlongPortfolio.sol";
Expand Down Expand Up @@ -115,9 +116,7 @@ contract EverlongStrategyKeeper is Ownable {
vaultCalldataOrReason
);
if (!success) {
revert(
string.concat("vault process_report failed: ", string(err))
);
revert IEverlongStrategyKeeper.VaultReportFailed(err);
}
}
}
Expand Down Expand Up @@ -150,7 +149,7 @@ contract EverlongStrategyKeeper is Ownable {
strategyCalldataOrReason
);
if (!success) {
revert(string.concat("strategy report failed: ", string(err)));
revert IEverlongStrategyKeeper.StrategyReportFailed(err);
}
}
}
Expand Down Expand Up @@ -178,7 +177,7 @@ contract EverlongStrategyKeeper is Ownable {
IEverlongStrategy(_strategy).setTendConfig(_config);
(bool success, bytes memory err) = _strategy.call(calldataOrReason);
if (!success) {
revert(string.concat("strategy tend failed: ", string(err)));
revert IEverlongStrategyKeeper.TendFailed(err);
}
}
}
Expand Down Expand Up @@ -209,9 +208,7 @@ contract EverlongStrategyKeeper is Ownable {
calldataOrReason
);
if (!success) {
revert(
string.concat("vault update debt failed: ", string(err))
);
revert IEverlongStrategyKeeper.UpdateDebtFailed(err);
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions contracts/interfaces/IEverlongStrategyKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ interface IEverlongStrategyKeeper {
/// @notice The owner is not a valid owner account. (eg. `address(0)`)
error OwnableInvalidOwner(address owner);

/// @notice Thrown when a strategy report reverts.
error StrategyReportFailed(bytes data);

/// @notice Thrown when `tend` reverts.
error TendFailed(bytes data);

/// @notice Thrown when `update_debt` reverts.
error UpdateDebtFailed(bytes data);

/// @notice Thrown when a vault report reverts.
error VaultReportFailed(bytes data);

// ╭───────────────────────────────────────────────────────────────────────╮
// │ Events │
// ╰───────────────────────────────────────────────────────────────────────╯
Expand Down
Loading