Skip to content

Commit

Permalink
build: update to new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Oct 12, 2023
1 parent 10ecac8 commit 4084a7f
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 119 deletions.
8 changes: 4 additions & 4 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion contracts/AddressProvider.vy
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions contracts/accountants/GenericAccountant.vy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions contracts/debtAllocators/GenericDebtAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ 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
* @author yearn.finance
* @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
* manually by setting a `minimumChange` and a `targetRatio`.
*
* 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 {
Expand Down Expand Up @@ -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");
Expand Down
18 changes: 0 additions & 18 deletions contracts/interfaces/IFactory.sol

This file was deleted.

45 changes: 0 additions & 45 deletions contracts/interfaces/IVault.sol

This file was deleted.

32 changes: 16 additions & 16 deletions contracts/registry/Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -57,15 +57,15 @@ 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;
// The release number corresponding to the release registries version.
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;
}

Expand All @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand All @@ -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()
);
Expand All @@ -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
Expand All @@ -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()
);
Expand Down
2 changes: 1 addition & 1 deletion contracts/registry/RegistryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions contracts/registry/ReleaseRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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())
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down Expand Up @@ -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
)

Expand All @@ -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,
)
Expand All @@ -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
Expand Down
Loading

0 comments on commit 4084a7f

Please sign in to comment.