diff --git a/ape-config.yaml b/ape-config.yaml index e11bd91..6d64527 100644 --- a/ape-config.yaml +++ b/ape-config.yaml @@ -15,10 +15,10 @@ dependencies: version: 4.8.2 - name: yearn-vaults github: yearn/yearn-vaults-v3 - ref: v3.0.0 + ref: v3.0.1 - name: tokenized-strategy github: yearn/tokenized-strategy - ref: v3.0.0 + ref: v3.0.1 contracts_folder: src exclude: - src/test/**/* @@ -30,8 +30,8 @@ dependencies: solidity: import_remapping: - "@openzeppelin/contracts=openzeppelin/v4.8.2" - - "@yearn-vaults=yearn-vaults/v3.0.0" - - "@tokenized-strategy=tokenized-strategy/v3.0.0" + - "@yearn-vaults=yearn-vaults/v3.0.1" + - "@tokenized-strategy=tokenized-strategy/v3.0.1" - "@periphery=periphery/master" ethereum: diff --git a/contracts/AddressProvider.vy b/contracts/AddressProvider.vy index 38e2e49..0fe271d 100644 --- a/contracts/AddressProvider.vy +++ b/contracts/AddressProvider.vy @@ -119,7 +119,7 @@ def get_base_fee_provider() -> address: def get_apr_oracle() -> address: """ @ Get the current APR Oracle. - @return Current APR Oracel address. + @return Current APR Oracle address. """ return self._get_address(APR_ORACLE) diff --git a/contracts/accountants/GenericAccountant.vy b/contracts/accountants/GenericAccountant.vy index ba638dc..00942b1 100644 --- a/contracts/accountants/GenericAccountant.vy +++ b/contracts/accountants/GenericAccountant.vy @@ -10,13 +10,13 @@ https://github.com/yearn/yearn-vaults-v3/blob/master/contracts/VaultV3.vy It is designed to be able to be added to any number of vaults with any - underlying tokens. There is a degault fee config that will be used for - any strategy that reports through a vault thas has been added to this + underlying tokens. There is a default fee config that will be used for + any strategy that reports through a vault thats has been added to this accountant. But also gives the ability for the fee_manager to choose custom values for any value for any given strategy they want to. Funds received from the vaults can either be distributed to a specified - fee_recipient or redeemed for the underlying asset and held withen this + fee_recipient or redeemed for the underlying asset and held within this contract until distributed. """ from vyper.interfaces import ERC20 diff --git a/contracts/debtAllocators/GenericDebtAllocator.sol b/contracts/debtAllocators/GenericDebtAllocator.sol index 3aea17a..a4c85f2 100644 --- a/contracts/debtAllocators/GenericDebtAllocator.sol +++ b/contracts/debtAllocators/GenericDebtAllocator.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.18; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {Governance} from "@periphery/utils/Governance.sol"; -import {IVault} from "../interfaces/IVault.sol"; +import {IVault} from "@yearn-vaults/interfaces/IVault.sol"; /** * @title YearnV3 Generic Debt Allocator @@ -12,7 +12,7 @@ import {IVault} from "../interfaces/IVault.sol"; * @notice * This Generic Debt Allocator is meant to be used alongside * a Yearn V3 vault to provide the needed triggers for a keeper - * to perform automative debt updates for the vaults strategies. + * to perform automated debt updates for the vaults strategies. * * Each allocator contract will serve one Vault and each strategy * that should be managed by this allocator will need to be added @@ -20,7 +20,7 @@ import {IVault} from "../interfaces/IVault.sol"; * * The allocator aims to allocate debt between the strategies * based on their set target ratios. Which are denominated in basis - * points and repersnet the percent of total assets that specific + * points and represent the percent of total assets that specific * strategy should hold. */ contract GenericDebtAllocator is Governance { @@ -98,7 +98,7 @@ contract GenericDebtAllocator is Governance { // Cache the vault variable. IVault _vault = IVault(vault); - // Retrieve the strategy specifc parameters. + // Retrieve the strategy specific parameters. IVault.StrategyParams memory params = _vault.strategies(_strategy); // Make sure its an active strategy. require(params.activation != 0, "!active"); diff --git a/contracts/interfaces/IFactory.sol b/contracts/interfaces/IFactory.sol deleted file mode 100644 index dec41f5..0000000 --- a/contracts/interfaces/IFactory.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity 0.8.18; - -import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -interface IFactory { - function api_version() external view returns (string memory); - - function vault_blueprint() external view returns (address); - - function deploy_new_vault( - ERC20 asset, - string calldata name, - string calldata symbol, - address roleManager, - uint256 profitMaxUnlockTime - ) external returns (address); -} diff --git a/contracts/interfaces/IVault.sol b/contracts/interfaces/IVault.sol deleted file mode 100644 index ad2045b..0000000 --- a/contracts/interfaces/IVault.sol +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity 0.8.18; - -import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol"; - -interface IVault is IERC4626 { - struct StrategyParams { - uint256 activation; - uint256 last_report; - uint256 current_debt; - uint256 max_debt; - } - - function strategies( - address _strategy - ) external view returns (StrategyParams memory); - - function set_role(address, uint256) external; - - function roles(address _address) external view returns (uint256); - - function profitMaxUnlockTime() external view returns (uint256); - - function add_strategy(address) external; - - function update_max_debt_for_strategy(address, uint256) external; - - function update_debt(address, uint256) external; - - function set_deposit_limit(uint256) external; - - function shutdown_vault() external; - - function shutdown() external view returns (bool); - - function minimum_total_idle() external view returns (uint256); - - function totalDebt() external view returns (uint256); - - function totalIdle() external view returns (uint256); - - function transfer_role_manager(address role_manager) external; - - function accept_role_manager() external; -} diff --git a/contracts/registry/Registry.sol b/contracts/registry/Registry.sol index 2cf7bea..576a60d 100644 --- a/contracts/registry/Registry.sol +++ b/contracts/registry/Registry.sol @@ -5,7 +5,7 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {Governance} from "@periphery/utils/Governance.sol"; -import {IFactory} from "../interfaces/IFactory.sol"; +import {IVaultFactory} from "@yearn-vaults/interfaces/IVaultFactory.sol"; import {ReleaseRegistry} from "./ReleaseRegistry.sol"; interface IVault { @@ -57,7 +57,7 @@ contract Registry is Governance { ); // Struct stored for every endorsed vault or strategy for - // off chain use to easily retreive info. + // off chain use to easily retrieve info. struct Info { // The token thats being used. address asset; @@ -65,7 +65,7 @@ contract Registry is Governance { uint256 releaseVersion; // Time when the vault was deployed for easier indexing. uint256 deploymentTimestamp; - // String so that mangement to tag a vault with any info for FE's. + // String so that management to tag a vault with any info for FE's. string tag; } @@ -87,13 +87,13 @@ contract Registry is Governance { // asset => array of all endorsed strategies. mapping(address => address[]) internal _endorsedStrategies; - // vault/strategy address => Info stuct. + // vault/strategy address => Info struct. mapping(address => Info) public info; /** * @param _governance Address to set as owner of the Registry. * @param _name The custom string for this custom registry to be called. - * @param _releaseRegistry The Permisionless releaseRegistry to deploy vaults through. + * @param _releaseRegistry The Permissionless releaseRegistry to deploy vaults through. */ constructor( address _governance, @@ -107,7 +107,7 @@ contract Registry is Governance { } /** - * @notice Returns the total numer of assets being used as the underlying. + * @notice Returns the total number of assets being used as the underlying. * @return The amount of assets. */ function numAssets() external view returns (uint256) { @@ -165,7 +165,7 @@ contract Registry is Governance { /** * @notice Get all endorsed vaults deployed using the Registry. * @dev This will return a nested array of all vaults deployed - * seperated by their underlying asset. + * separated by their underlying asset. * * This is only meant for off chain viewing and should not be used during any * on chain tx's. @@ -189,7 +189,7 @@ contract Registry is Governance { /** * @notice Get all strategies endorsed through this registry. * @dev This will return a nested array of all endorsed strategies - * seperated by their underlying asset. + * separated by their underlying asset. * * This is only meant for off chain viewing and should not be used during any * on chain tx's. @@ -249,8 +249,8 @@ contract Registry is Governance { require(factory != address(0), "Registry: unknown release"); // Deploy New vault. - _vault = IFactory(factory).deploy_new_vault( - ERC20(_asset), + _vault = IVaultFactory(factory).deploy_new_vault( + _asset, _name, _symbol, _roleManager, @@ -284,7 +284,7 @@ contract Registry is Governance { _releaseDelta; // dev: no releases // Get the API version for the target specified - string memory apiVersion = IFactory( + string memory apiVersion = IVaultFactory( ReleaseRegistry(releaseRegistry).factories(releaseTarget) ).api_version(); @@ -364,7 +364,7 @@ contract Registry is Governance { _releaseDelta; // dev: no releases // Get the API version for this release - string memory apiVersion = IFactory( + string memory apiVersion = IVaultFactory( ReleaseRegistry(releaseRegistry).factories(_releaseTarget) ).api_version(); @@ -425,7 +425,7 @@ contract Registry is Governance { /** * @notice Remove a `_vault` at a specific `_index`. - * @dev Can be used as an efficent way to remove a vault + * @dev Can be used as an efficient way to remove a vault * to not have to iterate over the full array. * * NOTE: This will not remove the asset from the `assets` array @@ -442,7 +442,7 @@ contract Registry is Governance { // Get the asset the vault is using. address asset = IVault(_vault).asset(); - // Get the relase version for this specific vault. + // Get the release version for this specific vault. uint256 releaseTarget = ReleaseRegistry(releaseRegistry).releaseTargets( IVault(_vault).api_version() ); @@ -466,7 +466,7 @@ contract Registry is Governance { /** * @notice Remove a `_strategy` at a specific `_index`. - * @dev Can be used as a efficent way to remove a strategy + * @dev Can be used as a efficient way to remove a strategy * to not have to iterate over the full array. * * NOTE: This will not remove the asset from the `assets` array @@ -483,7 +483,7 @@ contract Registry is Governance { // Get the asset the vault is using. address asset = IStrategy(_strategy).asset(); - // Get the relase version for this specific vault. + // Get the release version for this specific vault. uint256 releaseTarget = ReleaseRegistry(releaseRegistry).releaseTargets( IStrategy(_strategy).apiVersion() ); diff --git a/contracts/registry/RegistryFactory.sol b/contracts/registry/RegistryFactory.sol index be81f81..ca63da2 100644 --- a/contracts/registry/RegistryFactory.sol +++ b/contracts/registry/RegistryFactory.sol @@ -40,7 +40,7 @@ contract RegistryFactory { /** * @notice Deploy a new Registry. * @param _name The name of the new registry. - * @param _governance Address to set as goveranance. + * @param _governance Address to set as governance. * @return Address of the new Registry. */ function createNewRegistry( diff --git a/contracts/registry/ReleaseRegistry.sol b/contracts/registry/ReleaseRegistry.sol index 2ee8e56..2408598 100644 --- a/contracts/registry/ReleaseRegistry.sol +++ b/contracts/registry/ReleaseRegistry.sol @@ -57,7 +57,7 @@ contract ReleaseRegistry is Governance { /** * @notice Issue a new release using a deployed factory. * @dev Stores the factory address in `factories` and the release - * target in `releaseTargests` with its associated API version. + * target in `releaseTargets` with its associated API version. * * Throws if caller isn't `governance`. * Throws if the api version is the same as the previous release. @@ -72,7 +72,7 @@ contract ReleaseRegistry is Governance { string memory apiVersion = IFactory(_factory).api_version(); if (releaseId > 0) { - // Make sure this isnt the same as the last one + // Make sure this isn't the same as the last one require( keccak256( bytes(IFactory(factories[releaseId - 1]).api_version()) diff --git a/package.json b/package.json index 0ce862b..935be1f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.0", "@commitlint/config-conventional": "^17.0.0", - "@openzeppelin/contracts": "^4.8.2", + "@openzeppelin/contracts": "4.8.2", "hardhat": "^2.13.0", "prettier": "^2.5.1", "prettier-plugin-solidity": "^1.0.0-beta.19", diff --git a/tests/conftest.py b/tests/conftest.py index d00a2cc..d518e05 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -62,7 +62,7 @@ def amount(): def vault_blueprint(project, daddy): blueprint_bytecode = b"\xFE\x71\x00" + HexBytes( project.dependencies["yearn-vaults"][ - "v3.0.0" + "v3.0.1" ].VaultV3.contract_type.deployment_bytecode.bytecode ) # ERC5202 len_bytes = len(blueprint_bytecode).to_bytes(2, "big") @@ -81,7 +81,7 @@ def vault_blueprint(project, daddy): @pytest.fixture(scope="session") def vault_factory(project, daddy, vault_blueprint): vault_factory = daddy.deploy( - project.dependencies["yearn-vaults"]["v3.0.0"].VaultFactory, + project.dependencies["yearn-vaults"]["v3.0.1"].VaultFactory, "Vault V3 Factory", vault_blueprint, daddy.address, @@ -141,7 +141,7 @@ def create_vault( ) event = list(tx.decode_logs(vault_factory.NewVault)) - vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault_address ) @@ -156,9 +156,9 @@ def create_vault( | ROLES.DEBT_MANAGER | ROLES.MAX_DEBT_MANAGER | ROLES.DEPOSIT_LIMIT_MANAGER + | ROLES.WITHDRAW_LIMIT_MANAGER | ROLES.MINIMUM_IDLE_MANAGER | ROLES.PROFIT_UNLOCK_MANAGER - | ROLES.SWEEPER | ROLES.EMERGENCY_MANAGER, sender=daddy, ) @@ -179,7 +179,7 @@ def vault(asset, create_vault): @pytest.fixture(scope="session") def create_strategy(project, management, asset): - def create_strategy(token=asset, apiVersion="3.0.0"): + def create_strategy(token=asset, apiVersion="3.0.1"): strategy = management.deploy(project.MockStrategy, token.address, apiVersion) return strategy diff --git a/tests/test_registry.py b/tests/test_registry.py index d77a7ad..f0179ba 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -37,11 +37,11 @@ def test__deploy_new_vault(registry, asset, release_registry, vault_factory, dad tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 0, sender=daddy) # address = tx.return_value - # new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at(address) + # new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at(address) block = tx.timestamp event = list(tx.decode_logs(registry.NewEndorsedVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -89,7 +89,7 @@ def test__endorse_deployed_vault( block = tx.timestamp event = list(tx.decode_logs(vault_factory.NewVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault_address ) @@ -127,7 +127,7 @@ def test__endorse_deployed_vault__default_values( tx = vault_factory.deploy_new_vault(asset, name, symbol, daddy, WEEK, sender=daddy) event = list(tx.decode_logs(vault_factory.NewVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault_address ) @@ -236,11 +236,11 @@ def test__deploy_vault_with_new_release( tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 0, sender=daddy) # address = tx.return_value - # new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at(address) + # new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at(address) block = tx.timestamp event = list(tx.decode_logs(registry.NewEndorsedVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -294,11 +294,11 @@ def test__deploy_vault_with_old_release( tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 1, sender=daddy) # address = tx.return_value - # new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at(address) + # new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at(address) block = tx.timestamp event = list(tx.decode_logs(registry.NewEndorsedVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -352,7 +352,7 @@ def test__endorse_deployed_vault_wrong_api__reverts( tx = vault_factory.deploy_new_vault(asset, name, symbol, daddy, WEEK, sender=daddy) event = list(tx.decode_logs(vault_factory.NewVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault_address ) @@ -402,7 +402,7 @@ def test__tag_vault(registry, asset, release_registry, vault_factory, daddy, str tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 0, sender=daddy) event = list(tx.decode_logs(registry.NewEndorsedVault)) - vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at(event[0].vault) + vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at(event[0].vault) # Make sure it is endorsed but not tagged. assert registry.info(vault.address).asset == asset.address @@ -448,11 +448,11 @@ def test__remove_vault(registry, asset, release_registry, vault_factory, daddy): tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 0, sender=daddy) # address = tx.return_value - # new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at(address) + # new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at(address) block = tx.timestamp event = list(tx.decode_logs(registry.NewEndorsedVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -515,7 +515,7 @@ def test__remove_vault__two_vaults( tx = registry.newEndorsedVault(asset, name, symbol, daddy, WEEK, 0, sender=daddy) event = list(tx.decode_logs(registry.NewEndorsedVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -524,7 +524,7 @@ def test__remove_vault__two_vaults( ) event = list(tx.decode_logs(registry.NewEndorsedVault)) - second_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + second_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault ) @@ -739,7 +739,7 @@ def test__access( tx = vault_factory.deploy_new_vault(asset, name, symbol, daddy, WEEK, sender=daddy) event = list(tx.decode_logs(vault_factory.NewVault)) - new_vault = project.dependencies["yearn-vaults"]["v3.0.0"].VaultV3.at( + new_vault = project.dependencies["yearn-vaults"]["v3.0.1"].VaultV3.at( event[0].vault_address ) diff --git a/tests/test_release_registry.py b/tests/test_release_registry.py index 5685231..4d44d18 100644 --- a/tests/test_release_registry.py +++ b/tests/test_release_registry.py @@ -8,7 +8,7 @@ def test__deployment(release_registry, daddy): assert release_registry.governance() == daddy assert release_registry.numReleases() == 0 assert release_registry.factories(0) == ZERO_ADDRESS - assert release_registry.releaseTargets("3.0.0") == 0 + assert release_registry.releaseTargets("3.0.1") == 0 def test_new_release(release_registry, daddy, vault_factory): diff --git a/tests/utils/constants.py b/tests/utils/constants.py index 581ece0..f5e4e83 100644 --- a/tests/utils/constants.py +++ b/tests/utils/constants.py @@ -19,10 +19,12 @@ class ROLES(IntFlag): DEBT_MANAGER = 64 MAX_DEBT_MANAGER = 128 DEPOSIT_LIMIT_MANAGER = 256 - MINIMUM_IDLE_MANAGER = 512 - PROFIT_UNLOCK_MANAGER = 1024 - SWEEPER = 2048 - EMERGENCY_MANAGER = 4096 + WITHDRAW_LIMIT_MANAGER = 512 + MINIMUM_IDLE_MANAGER = 1024 + PROFIT_UNLOCK_MANAGER = 2048 + DEBT_PURCHASER = 4096 + EMERGENCY_MANAGER = 8192 + ALL = 16383 class StrategyChangeType(IntFlag):