Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Oct 14, 2024
1 parent bb559da commit 13a369a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
25 changes: 15 additions & 10 deletions src/debtAllocators/DebtAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface IBaseFee {
* Yearn V3 vaults to provide the needed triggers for a keeper
* to perform automated debt updates for the vaults strategies.
*
* @dev
* Each vault that should be managed by this allocator will
* need to be added by first setting a `minimumChange` for the
* vault, which will act as the minimum amount of funds to move that will
Expand All @@ -26,7 +27,7 @@ interface IBaseFee {
* The allocator aims to allocate debt between the strategies
* based on their set target ratios. Which are denominated in basis
* points and represent the percent of total assets that specific
* strategy should hold.
* strategy should hold (i.e 1_000 == 10% of the vaults `totalAssets`).
*
* The trigger will attempt to allocate up to the `maxRatio` when
* the strategy has `minimumChange` amount less than the `targetRatio`.
Expand Down Expand Up @@ -408,9 +409,11 @@ contract DebtAllocator is Governance {
address _strategy,
uint256 _increase
) external virtual {
uint256 _currentRatio = getStrategyConfig(_vault, _strategy)
.targetRatio;
setStrategyDebtRatio(_vault, _strategy, _currentRatio + _increase);
setStrategyDebtRatio(
_vault,
_strategy,
getStrategyTargetRatio(_vault, _strategy) + _increase
);
}

/**
Expand All @@ -423,9 +426,11 @@ contract DebtAllocator is Governance {
address _strategy,
uint256 _decrease
) external virtual {
uint256 _currentRatio = getStrategyConfig(_vault, _strategy)
.targetRatio;
setStrategyDebtRatio(_vault, _strategy, _currentRatio - _decrease);
setStrategyDebtRatio(
_vault,
_strategy,
getStrategyTargetRatio(_vault, _strategy) - _decrease
);
}

/**
Expand Down Expand Up @@ -460,7 +465,7 @@ contract DebtAllocator is Governance {
uint256 _targetRatio,
uint256 _maxRatio
) public virtual onlyManagers {
VaultConfig storage vaultConfig = _vaultConfigs[_vault];
VaultConfig storage vaultConfig = getVaultConfig(_vault);
// Make sure a minimumChange has been set.
require(vaultConfig.minimumChange != 0, "!minimum");
// Cannot be more than 100%.
Expand Down Expand Up @@ -734,7 +739,7 @@ contract DebtAllocator is Governance {
function getStrategyTargetRatio(
address _vault,
address _strategy
) external view virtual returns (uint256) {
) public view virtual returns (uint256) {
return getStrategyConfig(_vault, _strategy).targetRatio;
}

Expand All @@ -747,7 +752,7 @@ contract DebtAllocator is Governance {
function getStrategyMaxRatio(
address _vault,
address _strategy
) external view virtual returns (uint256) {
) public view virtual returns (uint256) {
return getStrategyConfig(_vault, _strategy).maxRatio;
}

Expand Down
2 changes: 1 addition & 1 deletion src/registry/Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IVaultFactory {
* @title YearnV3 Registry
* @author yearn.finance
* @notice
* Serves as an on chain registry to track any Yearn
* Serves as an on chain registry to track any Yearn V3
* vaults and strategies that a certain party wants to
* endorse.
*
Expand Down
3 changes: 2 additions & 1 deletion src/registry/ReleaseRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ contract ReleaseRegistry is Governance2Step {
function latestRelease() external view virtual returns (string memory) {
uint256 _numReleases = numReleases;
if (_numReleases == 0) return "";
return IFactory(factories[numReleases - 1]).apiVersion(); // dev: no release
return IFactory(factories[numReleases - 1]).apiVersion();
}

/**
Expand All @@ -82,6 +82,7 @@ contract ReleaseRegistry is Governance2Step {
*
* Throws if caller isn't `governance`.
* Throws if the api version is the same as the previous release.
* Throws if the factory does not have the same api version as the tokenized strategy.
* Emits a `NewRelease` event.
*
* @param _factory The factory that will be used create new vaults.
Expand Down

0 comments on commit 13a369a

Please sign in to comment.