-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: update keeper * feat: turn off health check * fix: new role * fix: categorize * build: keeper * feat: force registry * fix: use base fee provider * fix: downgrade oz
- Loading branch information
1 parent
b5f0610
commit 0668495
Showing
12 changed files
with
746 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity 0.8.18; | ||
|
||
interface IStrategy { | ||
function report() external returns (uint256, uint256); | ||
|
||
function tend() external; | ||
} | ||
|
||
interface IVault { | ||
function process_report(address) external returns (uint256, uint256); | ||
} | ||
|
||
/** | ||
* @title Keeper | ||
* @notice | ||
* To allow permissionless reporting on V3 vaults and strategies. | ||
* | ||
* This will do low level calls so that in can be used without reverting | ||
* it the roles have not been set or the functions are not available. | ||
*/ | ||
contract Keeper { | ||
/** | ||
* @notice Reports on a strategy. | ||
*/ | ||
function report(address _strategy) external returns (uint256, uint256) { | ||
// Call the target with the provided calldata. | ||
(bool success, bytes memory result) = _strategy.call( | ||
abi.encodeWithSelector(IStrategy.report.selector) | ||
); | ||
|
||
if (success) { | ||
return abi.decode(result, (uint256, uint256)); | ||
} | ||
} | ||
|
||
/** | ||
* @notice Tends a strategy. | ||
*/ | ||
function tend(address _strategy) external { | ||
_strategy.call(abi.encodeWithSelector(IStrategy.tend.selector)); | ||
} | ||
|
||
/** | ||
* @notice Report strategy profits on a vault. | ||
*/ | ||
function process_report( | ||
address _vault, | ||
address _strategy | ||
) external returns (uint256, uint256) { | ||
// Call the target with the provided calldata. | ||
(bool success, bytes memory result) = _vault.call( | ||
abi.encodeCall(IVault.process_report, _strategy) | ||
); | ||
|
||
if (success) { | ||
return abi.decode(result, (uint256, uint256)); | ||
} | ||
} | ||
} |
Oops, something went wrong.