Skip to content

Commit

Permalink
fix: make virtual
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Dec 21, 2023
1 parent 232b754 commit ac75d6f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
6 changes: 3 additions & 3 deletions contracts/debtAllocators/GenericDebtAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ contract GenericDebtAllocator is Governance {
// Can't be more than 10_000.
uint256 public debtRatio;

/// @notice Time to wait between debt updates.
uint256 public minimumWait;

/// @notice The minimum amount denominated in asset that will
// need to be moved to trigger a debt update.
uint256 public minimumChange;

/// @notice Time to wait between debt updates.
uint256 public minimumWait;

/// @notice Max loss to accept on debt updates in basis points.
uint256 public maxDebtUpdateLoss;

Expand Down
10 changes: 5 additions & 5 deletions contracts/debtAllocators/YieldManager/Keeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract Keeper is Governance {
* @notice Add a new strategy, using the current `management` as the owner.
* @param _strategy The address of the strategy.
*/
function addNewStrategy(address _strategy) external onlyGovernance {
function addNewStrategy(address _strategy) external virtual onlyGovernance {
address currentManager = IStrategy(_strategy).management();
require(strategyOwner[_strategy] == address(0), "already active");
require(IStrategy(_strategy).keeper() == address(this), "!keeper");
Expand All @@ -72,7 +72,7 @@ contract Keeper is Governance {
function updateStrategyOwner(
address _strategy,
address _newOwner
) external onlyStrategyOwner(_strategy) {
) external virtual onlyStrategyOwner(_strategy) {
require(
_newOwner != address(0) &&
_newOwner != address(this) &&
Expand All @@ -86,7 +86,7 @@ contract Keeper is Governance {
* @notice Removes the strategy.
* @param _strategy The address of the strategy.
*/
function removeStrategy(address _strategy) external {
function removeStrategy(address _strategy) external virtual {
// Only governance or the strategy owner can call.
if (msg.sender != governance) _checkStrategyOwner(_strategy);

Expand All @@ -99,7 +99,7 @@ contract Keeper is Governance {
* @notice Reports full profit for a strategy.
* @param _strategy The address of the strategy.
*/
function report(address _strategy) external onlyKeepers(_strategy) {
function report(address _strategy) external virtual onlyKeepers(_strategy) {
// Report profits.
IStrategy(_strategy).report();
}
Expand All @@ -108,7 +108,7 @@ contract Keeper is Governance {
* @notice Tends a strategy.
* @param _strategy The address of the strategy.
*/
function tend(address _strategy) external onlyKeepers(_strategy) {
function tend(address _strategy) external virtual onlyKeepers(_strategy) {
// Tend.
IStrategy(_strategy).tend();
}
Expand Down
20 changes: 13 additions & 7 deletions contracts/debtAllocators/YieldManager/YieldManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ contract YieldManager is Governance {
function updateAllocationPermissioned(
address _vault,
Allocation[] memory _newAllocations
) public onlyGovernance {
) public virtual onlyGovernance {
// Move funds
_allocate(_vault, _newAllocations);
}
Expand Down Expand Up @@ -113,6 +113,7 @@ contract YieldManager is Governance {
Allocation[] memory _newAllocations
)
external
virtual
onlyProposersOrOpen
returns (uint256 _currentYield, uint256 _afterYield)
{
Expand Down Expand Up @@ -213,7 +214,7 @@ contract YieldManager is Governance {
function validateAllocation(
address _vault,
Allocation[] memory _newAllocations
) external view returns (bool) {
) external view virtual returns (bool) {
// Get the total assets the vault has.
uint256 _totalAssets = IVault(_vault).totalAssets();

Expand Down Expand Up @@ -245,7 +246,12 @@ contract YieldManager is Governance {
function getCurrentAndExpectedYield(
address _vault,
Allocation[] memory _newAllocations
) external view returns (uint256 _currentYield, uint256 _expectedYield) {
)
external
view
virtual
returns (uint256 _currentYield, uint256 _expectedYield)
{
// Get the total assets the vault has.
uint256 _totalAssets = IVault(_vault).totalAssets();

Expand Down Expand Up @@ -290,7 +296,7 @@ contract YieldManager is Governance {
function _allocate(
address _vault,
Allocation[] memory _newAllocations
) internal {
) internal virtual {
address allocator = vaultAllocator[_vault];
require(allocator != address(0), "vault not added");
address _strategy;
Expand Down Expand Up @@ -350,7 +356,7 @@ contract YieldManager is Governance {
function setProposer(
address _address,
bool _allowed
) external onlyGovernance {
) external virtual onlyGovernance {
proposer[_address] = _allowed;

emit UpdateProposer(_address, _allowed);
Expand All @@ -364,7 +370,7 @@ contract YieldManager is Governance {
function setVaultAllocator(
address _vault,
address _allocator
) external onlyGovernance {
) external virtual onlyGovernance {
vaultAllocator[_vault] = _allocator;

emit UpdateVaultAllocator(_vault, _allocator);
Expand All @@ -374,7 +380,7 @@ contract YieldManager is Governance {
* @notice Sets the open status of the contract.
* @param _open The new open status to set.
*/
function setOpen(bool _open) external onlyGovernance {
function setOpen(bool _open) external virtual onlyGovernance {
open = _open;

emit UpdateOpen(_open);
Expand Down

0 comments on commit ac75d6f

Please sign in to comment.