From abd8f923eebf35218213516a8fd00578b0733b50 Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Thu, 18 Apr 2024 16:42:27 -0500 Subject: [PATCH] Metadata Functions (#989) * Added a `name` and `version` function to each of the Hyperdrive instances * Add `name` and `version` functions to the `HyperdriveFactory` * Added a `name` and `version` function to the deployer coordinators * Added a `name` and `version` function to the registry * Fixed the rust tests * Fixed the rust tests * Addressed review feedback from @jrhea and @mcclurejt * Used the constant for the `HyperdriveRegistry` * Fixed remaining nit --- .../HyperdriveDeployerCoordinator.sol | 11 +++ .../ERC4626HyperdriveDeployerCoordinator.sol | 4 + .../EzETHHyperdriveDeployerCoordinator.sol | 3 + .../LsETHHyperdriveDeployerCoordinator.sol | 3 + .../RETHHyperdriveDeployerCoordinator.sol | 3 + .../StETHHyperdriveDeployerCoordinator.sol | 3 + contracts/src/external/HyperdriveTarget0.sol | 11 +++ contracts/src/factory/HyperdriveFactory.sol | 13 ++- contracts/src/factory/HyperdriveRegistry.sol | 15 +++- .../src/instances/erc4626/ERC4626Target0.sol | 9 +++ .../src/instances/ezeth/EzETHTarget0.sol | 9 +++ .../src/instances/lseth/LsETHTarget0.sol | 9 +++ contracts/src/instances/reth/RETHTarget0.sol | 9 +++ .../src/instances/steth/StETHTarget0.sol | 9 +++ .../IHyperdriveDeployerCoordinator.sol | 8 ++ .../IHyperdriveGovernedRegistry.sol | 4 +- contracts/src/interfaces/IHyperdriveRead.sol | 8 ++ contracts/src/libraries/Constants.sol | 3 + contracts/test/MockHyperdrive.sol | 2 + contracts/test/MockHyperdriveDeployer.sol | 5 ++ crates/test-utils/src/chain/deploy.rs | 66 ++++++++------- .../instances/erc4626/ERC4626Hyperdrive.t.sol | 26 +++++- .../instances/erc4626/ERC4626Validation.t.sol | 3 +- test/instances/erc4626/UsdcERC4626.t.sol | 3 +- test/instances/ezETH/EzETHHyperdrive.t.sol | 1 + test/instances/lseth/LsETHHyperdrive.t.sol | 1 + test/instances/reth/RETHHyperdrive.t.sol | 1 + test/instances/steth/StETHHyperdrive.t.sol | 1 + .../deployers/DeployerCoordinator.t.sol | 2 + .../ERC4626DeployerCoordinator.t.sol | 3 +- .../deployers/RethDeployerCoordinator.t.sol | 3 +- .../deployers/StethDeployerCoordinator.t.sol | 3 +- .../factory/HyperdriveFactory.t.sol | 80 +++++++++++++------ test/units/HyperdriveRegistry.t.sol | 22 +++-- test/utils/InstanceTest.sol | 29 ++++++- test/utils/Lib.sol | 8 ++ 36 files changed, 323 insertions(+), 70 deletions(-) diff --git a/contracts/src/deployers/HyperdriveDeployerCoordinator.sol b/contracts/src/deployers/HyperdriveDeployerCoordinator.sol index 3be9fab40..28b830098 100644 --- a/contracts/src/deployers/HyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/HyperdriveDeployerCoordinator.sol @@ -5,6 +5,7 @@ import { IHyperdrive } from "../interfaces/IHyperdrive.sol"; import { IHyperdriveCoreDeployer } from "../interfaces/IHyperdriveCoreDeployer.sol"; import { IHyperdriveDeployerCoordinator } from "../interfaces/IHyperdriveDeployerCoordinator.sol"; import { IHyperdriveTargetDeployer } from "../interfaces/IHyperdriveTargetDeployer.sol"; +import { VERSION } from "../libraries/Constants.sol"; import { ONE } from "../libraries/FixedPointMath.sol"; /// @author DELV @@ -103,6 +104,16 @@ abstract contract HyperdriveDeployerCoordinator is _; } + /// @notice Returns the deployer coordinator's name. + /// @notice The deployer coordinator's name. + function name() external pure virtual returns (string memory); + + /// @notice Returns the deployer coordinator's version. + /// @notice The deployer coordinator's version. + function version() external pure returns (string memory) { + return VERSION; + } + /// @notice Deploys a Hyperdrive instance with the given parameters. /// @dev This can only be deployed by the associated factory. /// @param _deploymentId The ID of the deployment. diff --git a/contracts/src/deployers/erc4626/ERC4626HyperdriveDeployerCoordinator.sol b/contracts/src/deployers/erc4626/ERC4626HyperdriveDeployerCoordinator.sol index c263b38fa..915203f31 100644 --- a/contracts/src/deployers/erc4626/ERC4626HyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/erc4626/ERC4626HyperdriveDeployerCoordinator.sol @@ -18,6 +18,10 @@ import { HyperdriveDeployerCoordinator } from "../HyperdriveDeployerCoordinator. contract ERC4626HyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { using SafeERC20 for ERC20; + /// @notice The deployer coordinator's name. + string public constant override name = + "ERC4626HyperdriveDeployerCoordinator"; + /// @notice Instantiates the deployer coordinator. /// @param _factory The factory that this deployer will be registered with. /// @param _coreDeployer The core deployer. diff --git a/contracts/src/deployers/ezeth/EzETHHyperdriveDeployerCoordinator.sol b/contracts/src/deployers/ezeth/EzETHHyperdriveDeployerCoordinator.sol index 19feb8197..54f94dc7c 100644 --- a/contracts/src/deployers/ezeth/EzETHHyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/ezeth/EzETHHyperdriveDeployerCoordinator.sol @@ -21,6 +21,9 @@ contract EzETHHyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { using SafeERC20 for ERC20; using FixedPointMath for uint256; + /// @notice The deployer coordinator's name. + string public constant override name = "EzETHHyperdriveDeployerCoordinator"; + /// @notice The Renzo contract. IRestakeManager public immutable restakeManager; diff --git a/contracts/src/deployers/lseth/LsETHHyperdriveDeployerCoordinator.sol b/contracts/src/deployers/lseth/LsETHHyperdriveDeployerCoordinator.sol index c8f76159f..61b9fbeb4 100644 --- a/contracts/src/deployers/lseth/LsETHHyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/lseth/LsETHHyperdriveDeployerCoordinator.sol @@ -20,6 +20,9 @@ contract LsETHHyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { using SafeERC20 for ERC20; using FixedPointMath for uint256; + /// @notice The deployer coordinator's name. + string public constant override name = "LsETHHyperdriveDeployerCoordinator"; + /// @dev The LsETH contract. IRiverV1 internal immutable river; diff --git a/contracts/src/deployers/reth/RETHHyperdriveDeployerCoordinator.sol b/contracts/src/deployers/reth/RETHHyperdriveDeployerCoordinator.sol index 025428745..2a56fe219 100644 --- a/contracts/src/deployers/reth/RETHHyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/reth/RETHHyperdriveDeployerCoordinator.sol @@ -20,6 +20,9 @@ contract RETHHyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { using SafeERC20 for ERC20; using FixedPointMath for uint256; + /// @notice The deployer coordinator's name. + string public constant override name = "RETHHyperdriveDeployerCoordinator"; + /// @dev The Rocket Token RETH contract. IRocketTokenRETH internal immutable rocketTokenReth; diff --git a/contracts/src/deployers/steth/StETHHyperdriveDeployerCoordinator.sol b/contracts/src/deployers/steth/StETHHyperdriveDeployerCoordinator.sol index c650ea553..03fbaebdd 100644 --- a/contracts/src/deployers/steth/StETHHyperdriveDeployerCoordinator.sol +++ b/contracts/src/deployers/steth/StETHHyperdriveDeployerCoordinator.sol @@ -17,6 +17,9 @@ import { HyperdriveDeployerCoordinator } from "../HyperdriveDeployerCoordinator. contract StETHHyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { using FixedPointMath for uint256; + /// @notice The deployer coordinator's name. + string public constant override name = "StETHHyperdriveDeployerCoordinator"; + /// @notice The Lido contract. ILido public immutable lido; diff --git a/contracts/src/external/HyperdriveTarget0.sol b/contracts/src/external/HyperdriveTarget0.sol index f1e5e4ef2..2ee5ab522 100644 --- a/contracts/src/external/HyperdriveTarget0.sol +++ b/contracts/src/external/HyperdriveTarget0.sol @@ -12,6 +12,7 @@ import { HyperdriveMultiToken } from "../internal/HyperdriveMultiToken.sol"; import { HyperdriveShort } from "../internal/HyperdriveShort.sol"; import { HyperdriveStorage } from "../internal/HyperdriveStorage.sol"; import { AssetId } from "../libraries/AssetId.sol"; +import { VERSION } from "../libraries/Constants.sol"; import { FixedPointMath } from "../libraries/FixedPointMath.sol"; import { LPMath } from "../libraries/LPMath.sol"; @@ -229,6 +230,16 @@ abstract contract HyperdriveTarget0 is /// Getters /// + /// @notice Gets the instance's name. + /// @return The instance's name. + function name() external pure virtual returns (string memory); + + /// @notice Gets the instance's version. + /// @return The instance's version. + function version() external pure returns (string memory) { + _revert(abi.encode(VERSION)); + } + /// @notice Gets the pauser status of an address. /// @param _account The account to check. /// @return The pauser status. diff --git a/contracts/src/factory/HyperdriveFactory.sol b/contracts/src/factory/HyperdriveFactory.sol index 9b4e12c66..d56dc51c4 100644 --- a/contracts/src/factory/HyperdriveFactory.sol +++ b/contracts/src/factory/HyperdriveFactory.sol @@ -5,6 +5,7 @@ import { IHyperdrive } from "../interfaces/IHyperdrive.sol"; import { IHyperdriveFactory } from "../interfaces/IHyperdriveFactory.sol"; import { IHyperdriveDeployerCoordinator } from "../interfaces/IHyperdriveDeployerCoordinator.sol"; import { FixedPointMath, ONE } from "../libraries/FixedPointMath.sol"; +import { VERSION } from "../libraries/Constants.sol"; import { HyperdriveMath } from "../libraries/HyperdriveMath.sol"; /// @author DELV @@ -17,6 +18,12 @@ import { HyperdriveMath } from "../libraries/HyperdriveMath.sol"; contract HyperdriveFactory is IHyperdriveFactory { using FixedPointMath for uint256; + /// @notice The factory's name. + string public name; + + /// @notice The factory's version. + string public constant version = VERSION; + /// @dev Signifies an unlocked receive function, used by isReceiveLocked uint256 private constant RECEIVE_UNLOCKED = 1; @@ -165,7 +172,11 @@ contract HyperdriveFactory is IHyperdriveFactory { /// @notice Initializes the factory. /// @param _factoryConfig Configuration of the Hyperdrive Factory. - constructor(FactoryConfig memory _factoryConfig) { + /// @param _name The factory's name. + constructor(FactoryConfig memory _factoryConfig, string memory _name) { + // Set the factory's name. + name = _name; + // Ensure that the minimum checkpoint duration is greater than or equal // to the checkpoint duration resolution and is a multiple of the // checkpoint duration resolution. diff --git a/contracts/src/factory/HyperdriveRegistry.sol b/contracts/src/factory/HyperdriveRegistry.sol index 61a0be705..cd2eedb12 100644 --- a/contracts/src/factory/HyperdriveRegistry.sol +++ b/contracts/src/factory/HyperdriveRegistry.sol @@ -3,17 +3,30 @@ pragma solidity 0.8.20; import { IHyperdriveGovernedRegistry } from "../interfaces/IHyperdriveGovernedRegistry.sol"; import { IHyperdriveRegistry } from "../interfaces/IHyperdriveRegistry.sol"; +import { VERSION } from "../libraries/Constants.sol"; contract HyperdriveRegistry is IHyperdriveRegistry, IHyperdriveGovernedRegistry { + /// @notice The registry's name. + string public name; + + /// @notice The registry's version. + string public constant version = VERSION; + + /// @notice The registry's governance address. address public governance; + /// @notice A mapping from hyperdrive instances to info associated with + /// those instances. mapping(address hyperdrive => uint256 data) internal _hyperdriveInfo; - constructor() { + /// @notice Instantiates the hyperdrive registry. + /// @param _name The registry's name. + constructor(string memory _name) { governance = msg.sender; + name = _name; } modifier onlyGovernance() { diff --git a/contracts/src/instances/erc4626/ERC4626Target0.sol b/contracts/src/instances/erc4626/ERC4626Target0.sol index 78d453890..17eebf412 100644 --- a/contracts/src/instances/erc4626/ERC4626Target0.sol +++ b/contracts/src/instances/erc4626/ERC4626Target0.sol @@ -14,9 +14,18 @@ import { ERC4626Base } from "./ERC4626Base.sol"; /// only, and is not intended to, and does not, have any /// particular legal or regulatory significance. contract ERC4626Target0 is HyperdriveTarget0, ERC4626Base { + /// @dev The instance's name. + string internal constant NAME = "ERC4626Hyperdrive"; + /// @notice Initializes the target0 contract. /// @param _config The configuration of the Hyperdrive pool. constructor( IHyperdrive.PoolConfig memory _config ) HyperdriveTarget0(_config) {} + + /// @notice Returns the instance's name. + /// @return The instance's name. + function name() external pure override returns (string memory) { + _revert(abi.encode(NAME)); + } } diff --git a/contracts/src/instances/ezeth/EzETHTarget0.sol b/contracts/src/instances/ezeth/EzETHTarget0.sol index a552432f0..f686ed1eb 100644 --- a/contracts/src/instances/ezeth/EzETHTarget0.sol +++ b/contracts/src/instances/ezeth/EzETHTarget0.sol @@ -19,6 +19,9 @@ import { EzETHBase } from "./EzETHBase.sol"; contract EzETHTarget0 is HyperdriveTarget0, EzETHBase { using SafeERC20 for ERC20; + /// @dev The instance's name. + string internal constant NAME = "EzETHHyperdrive"; + /// @notice Initializes the target0 contract. /// @param _config The configuration of the Hyperdrive pool. /// @param _restakeManager The Renzo contract. @@ -29,6 +32,12 @@ contract EzETHTarget0 is HyperdriveTarget0, EzETHBase { /// Extras /// + /// @notice Returns the instance's name. + /// @return The instance's name. + function name() external pure override returns (string memory) { + _revert(abi.encode(NAME)); + } + /// @notice Returns the Renzo contract. /// @return The Renzo contract. function renzo() external view returns (IRestakeManager) { diff --git a/contracts/src/instances/lseth/LsETHTarget0.sol b/contracts/src/instances/lseth/LsETHTarget0.sol index 46a802456..66dc399de 100644 --- a/contracts/src/instances/lseth/LsETHTarget0.sol +++ b/contracts/src/instances/lseth/LsETHTarget0.sol @@ -14,6 +14,9 @@ import { LsETHBase } from "./LsETHBase.sol"; /// only, and is not intended to, and does not, have any /// particular legal or regulatory significance. contract LsETHTarget0 is HyperdriveTarget0, LsETHBase { + /// @dev The instance's name. + string internal constant NAME = "LsETHHyperdrive"; + /// @notice Initializes the target0 contract. /// @param _config The configuration of the Hyperdrive pool. constructor( @@ -22,6 +25,12 @@ contract LsETHTarget0 is HyperdriveTarget0, LsETHBase { /// Getters /// + /// @notice Returns the instance's name. + /// @return The instance's name. + function name() external pure override returns (string memory) { + _revert(abi.encode(NAME)); + } + /// @notice Returns the MultiToken's decimals. /// @return The MultiToken's decimals. function decimals() external pure override returns (uint8) { diff --git a/contracts/src/instances/reth/RETHTarget0.sol b/contracts/src/instances/reth/RETHTarget0.sol index b542f1f04..48de23f60 100644 --- a/contracts/src/instances/reth/RETHTarget0.sol +++ b/contracts/src/instances/reth/RETHTarget0.sol @@ -14,6 +14,9 @@ import { RETHBase } from "./RETHBase.sol"; /// only, and is not intended to, and does not, have any /// particular legal or regulatory significance. contract RETHTarget0 is HyperdriveTarget0, RETHBase { + /// @dev The instance's name. + string internal constant NAME = "RETHHyperdrive"; + /// @notice Initializes the target0 contract. /// @param _config The configuration of the Hyperdrive pool. constructor( @@ -22,6 +25,12 @@ contract RETHTarget0 is HyperdriveTarget0, RETHBase { /// Getters /// + /// @notice Returns the instance's name. + /// @return The instance's name. + function name() external pure override returns (string memory) { + _revert(abi.encode(NAME)); + } + /// @notice Returns the MultiToken's decimals. /// @return The MultiToken's decimals. function decimals() external pure override returns (uint8) { diff --git a/contracts/src/instances/steth/StETHTarget0.sol b/contracts/src/instances/steth/StETHTarget0.sol index 2f5ef062d..06c63eb4b 100644 --- a/contracts/src/instances/steth/StETHTarget0.sol +++ b/contracts/src/instances/steth/StETHTarget0.sol @@ -14,6 +14,9 @@ import { StETHBase } from "./StETHBase.sol"; /// only, and is not intended to, and does not, have any /// particular legal or regulatory significance. contract StETHTarget0 is HyperdriveTarget0, StETHBase { + /// @dev The instance's name. + string internal constant NAME = "StETHHyperdrive"; + /// @notice Initializes the target0 contract. /// @param _config The configuration of the Hyperdrive pool. constructor( @@ -22,6 +25,12 @@ contract StETHTarget0 is HyperdriveTarget0, StETHBase { /// Getters /// + /// @notice Returns the instance's name. + /// @return The instance's name. + function name() external pure override returns (string memory) { + _revert(abi.encode(NAME)); + } + /// @notice Returns the MultiToken's decimals. /// @return The MultiToken's decimals. function decimals() external pure override returns (uint8) { diff --git a/contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol b/contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol index d41fafeca..e8b0cd096 100644 --- a/contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol +++ b/contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol @@ -90,6 +90,14 @@ interface IHyperdriveDeployerCoordinator { /// Functions /// + /// @notice Returns the deployer coordinator's name. + /// @return The deployer coordinator's name. + function name() external pure returns (string memory); + + /// @notice Returns the deployer coordinator's version. + /// @return The deployer coordinator's version. + function version() external pure returns (string memory); + /// @notice Deploys a Hyperdrive instance with the given parameters. /// @param _deploymentId The ID of the deployment. /// @param _deployConfig The deploy configuration of the Hyperdrive pool. diff --git a/contracts/src/interfaces/IHyperdriveGovernedRegistry.sol b/contracts/src/interfaces/IHyperdriveGovernedRegistry.sol index 2bdd4c1a1..6a850bf5d 100644 --- a/contracts/src/interfaces/IHyperdriveGovernedRegistry.sol +++ b/contracts/src/interfaces/IHyperdriveGovernedRegistry.sol @@ -1,7 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.20; -interface IHyperdriveGovernedRegistry { +import { IHyperdriveRegistry } from "./IHyperdriveRegistry.sol"; + +interface IHyperdriveGovernedRegistry is IHyperdriveRegistry { /// @notice Emitted when governance is transferred. event GovernanceUpdated(address indexed governance); diff --git a/contracts/src/interfaces/IHyperdriveRead.sol b/contracts/src/interfaces/IHyperdriveRead.sol index c6d1f80c4..36fbb6b0e 100644 --- a/contracts/src/interfaces/IHyperdriveRead.sol +++ b/contracts/src/interfaces/IHyperdriveRead.sol @@ -5,6 +5,14 @@ import { IHyperdrive } from "./IHyperdrive.sol"; import { IMultiTokenRead } from "./IMultiTokenRead.sol"; interface IHyperdriveRead is IMultiTokenRead { + /// @notice Gets the instance's name. + /// @return The instance's name. + function name() external pure returns (string memory); + + /// @notice Gets the instance's version. + /// @return The instance's version. + function version() external pure returns (string memory); + /// @notice Gets the Hyperdrive pool's base token. /// @return The base token. function baseToken() external view returns (address); diff --git a/contracts/src/libraries/Constants.sol b/contracts/src/libraries/Constants.sol index fa364ffed..d70f897fd 100644 --- a/contracts/src/libraries/Constants.sol +++ b/contracts/src/libraries/Constants.sol @@ -3,3 +3,6 @@ pragma solidity 0.8.20; /// @dev The placeholder address for ETH. address constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + +/// @dev The version of the contracts. +string constant VERSION = "v1.0.2"; diff --git a/contracts/test/MockHyperdrive.sol b/contracts/test/MockHyperdrive.sol index dbf061d16..91e585d9b 100644 --- a/contracts/test/MockHyperdrive.sol +++ b/contracts/test/MockHyperdrive.sol @@ -447,6 +447,8 @@ contract MockHyperdrive is Hyperdrive, MockHyperdriveBase { } contract MockHyperdriveTarget0 is HyperdriveTarget0, MockHyperdriveBase { + string public constant override name = "MockHyperdrive"; + constructor( IHyperdrive.PoolConfig memory _config ) HyperdriveTarget0(_config) {} diff --git a/contracts/test/MockHyperdriveDeployer.sol b/contracts/test/MockHyperdriveDeployer.sol index aca9277fc..bea257b6b 100644 --- a/contracts/test/MockHyperdriveDeployer.sol +++ b/contracts/test/MockHyperdriveDeployer.sol @@ -5,9 +5,14 @@ import { IERC20 } from "contracts/src/interfaces/IERC20.sol"; import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; import { IHyperdriveDeployerCoordinator } from "contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol"; import { IHyperdriveTargetDeployer } from "contracts/src/interfaces/IHyperdriveTargetDeployer.sol"; +import { VERSION } from "contracts/src/libraries/Constants.sol"; import { MockHyperdrive } from "./MockHyperdrive.sol"; contract MockHyperdriveDeployer is IHyperdriveDeployerCoordinator { + string public constant name = "MockHyperdriveDeployer"; + + string public constant version = VERSION; + mapping(address => mapping(bytes32 => address)) internal _deployments; function deploy( diff --git a/crates/test-utils/src/chain/deploy.rs b/crates/test-utils/src/chain/deploy.rs index a759235ac..8da69bafb 100644 --- a/crates/test-utils/src/chain/deploy.rs +++ b/crates/test-utils/src/chain/deploy.rs @@ -381,9 +381,10 @@ impl Chain { } // Deploy the HyperdriveRegistry contract to track familiar instances. - let hyperdrive_registry = HyperdriveRegistry::deploy(client.clone(), ())? - .send() - .await?; + let hyperdrive_registry = + HyperdriveRegistry::deploy(client.clone(), ("HyperdriveRegistry".to_string(),))? + .send() + .await?; // Deploy the mock Lido system. We fund Lido with 1 eth to start to // avoid reverts when we initialize the pool. @@ -416,36 +417,39 @@ impl Chain { let factory = { HyperdriveFactory::deploy( client.clone(), - (( - address, // governance - config.admin, // hyperdrive governance - vec![config.admin], // default pausers - config.admin, // fee collector - config.admin, // sweep collector - config.factory_checkpoint_duration_resolution, - config.factory_min_checkpoint_duration, - config.factory_max_checkpoint_duration, - config.factory_min_position_duration, - config.factory_max_position_duration, - config.factory_min_fixed_apr, - config.factory_max_fixed_apr, - config.factory_min_time_stretch_apr, - config.factory_max_time_stretch_apr, - ( - config.factory_min_curve_fee, - config.factory_min_flat_fee, - config.factory_min_governance_lp_fee, - config.factory_min_governance_zombie_fee, - ), + ( ( - config.factory_max_curve_fee, - config.factory_max_flat_fee, - config.factory_max_governance_lp_fee, - config.factory_max_governance_zombie_fee, + address, // governance + config.admin, // hyperdrive governance + vec![config.admin], // default pausers + config.admin, // fee collector + config.admin, // sweep collector + config.factory_checkpoint_duration_resolution, + config.factory_min_checkpoint_duration, + config.factory_max_checkpoint_duration, + config.factory_min_position_duration, + config.factory_max_position_duration, + config.factory_min_fixed_apr, + config.factory_max_fixed_apr, + config.factory_min_time_stretch_apr, + config.factory_max_time_stretch_apr, + ( + config.factory_min_curve_fee, + config.factory_min_flat_fee, + config.factory_min_governance_lp_fee, + config.factory_min_governance_zombie_fee, + ), + ( + config.factory_max_curve_fee, + config.factory_max_flat_fee, + config.factory_max_governance_lp_fee, + config.factory_max_governance_zombie_fee, + ), + erc20_forwarder_factory.address(), + erc20_forwarder_factory.erc20link_hash().await?, ), - erc20_forwarder_factory.address(), - erc20_forwarder_factory.erc20link_hash().await?, - ),), + "HyperdriveFactory".to_string(), + ), )? .send() .await? diff --git a/test/instances/erc4626/ERC4626Hyperdrive.t.sol b/test/instances/erc4626/ERC4626Hyperdrive.t.sol index 6e4753c96..a19617d87 100644 --- a/test/instances/erc4626/ERC4626Hyperdrive.t.sol +++ b/test/instances/erc4626/ERC4626Hyperdrive.t.sol @@ -19,6 +19,7 @@ import { IERC4626 } from "contracts/src/interfaces/IERC4626.sol"; import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; import { IHyperdriveDeployerCoordinator } from "contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol"; import { AssetId } from "contracts/src/libraries/AssetId.sol"; +import { VERSION } from "contracts/src/libraries/Constants.sol"; import { FixedPointMath, ONE } from "contracts/src/libraries/FixedPointMath.sol"; import { HyperdriveMath } from "contracts/src/libraries/HyperdriveMath.sol"; import { ERC20ForwarderFactory } from "contracts/src/token/ERC20ForwarderFactory.sol"; @@ -27,9 +28,11 @@ import { MockERC4626, ERC20 } from "contracts/test/MockERC4626.sol"; import { MockERC4626Hyperdrive } from "contracts/test/MockERC4626Hyperdrive.sol"; import { HyperdriveTest } from "test/utils/HyperdriveTest.sol"; import { HyperdriveUtils } from "test/utils/HyperdriveUtils.sol"; +import { Lib } from "test/utils/Lib.sol"; contract ERC4626HyperdriveTest is HyperdriveTest { using FixedPointMath for *; + using Lib for *; HyperdriveFactory factory; @@ -99,7 +102,8 @@ contract ERC4626HyperdriveTest is HyperdriveTest { }), linkerFactory: address(forwarderFactory), linkerCodeHash: forwarderFactory.ERC20LINK_HASH() - }) + }), + "HyperdriveFactory" ); coreDeployer = address(new ERC4626HyperdriveCoreDeployer()); target0Deployer = address(new ERC4626Target0Deployer()); @@ -173,6 +177,26 @@ contract ERC4626HyperdriveTest is HyperdriveTest { vm.recordLogs(); } + function test_erc4626_name() external view { + assert( + IHyperdrive(address(mockHyperdrive)).name().eq("ERC4626Hyperdrive") + ); + assert( + IHyperdriveDeployerCoordinator(deployerCoordinator).name().eq( + "ERC4626HyperdriveDeployerCoordinator" + ) + ); + } + + function test_erc4626_version() external view { + assert(IHyperdrive(address(mockHyperdrive)).version().eq(VERSION)); + assert( + IHyperdriveDeployerCoordinator(deployerCoordinator).version().eq( + VERSION + ) + ); + } + function test_erc4626_deposit() external { // First we add some interest vm.startPrank(alice); diff --git a/test/instances/erc4626/ERC4626Validation.t.sol b/test/instances/erc4626/ERC4626Validation.t.sol index e718229fe..03ccac6eb 100644 --- a/test/instances/erc4626/ERC4626Validation.t.sol +++ b/test/instances/erc4626/ERC4626Validation.t.sol @@ -80,7 +80,8 @@ abstract contract ERC4626ValidationTest is HyperdriveTest { }), linkerFactory: address(forwarderFactory), linkerCodeHash: forwarderFactory.ERC20LINK_HASH() - }) + }), + "HyperdriveFactory" ); coreDeployer = address(new ERC4626HyperdriveCoreDeployer()); target0Deployer = address(new ERC4626Target0Deployer()); diff --git a/test/instances/erc4626/UsdcERC4626.t.sol b/test/instances/erc4626/UsdcERC4626.t.sol index ec2b9d537..ff57184bd 100644 --- a/test/instances/erc4626/UsdcERC4626.t.sol +++ b/test/instances/erc4626/UsdcERC4626.t.sol @@ -98,7 +98,8 @@ contract UsdcERC4626 is ERC4626ValidationTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + "HyperdriveFactory" ); coreDeployer = address(new ERC4626HyperdriveCoreDeployer()); target0Deployer = address(new ERC4626Target0Deployer()); diff --git a/test/instances/ezETH/EzETHHyperdrive.t.sol b/test/instances/ezETH/EzETHHyperdrive.t.sol index 8afa8a939..4ad1aef1a 100644 --- a/test/instances/ezETH/EzETHHyperdrive.t.sol +++ b/test/instances/ezETH/EzETHHyperdrive.t.sol @@ -61,6 +61,7 @@ contract EzETHHyperdriveTest is InstanceTest { // The configuration for the Instance testing suite. InstanceTestConfig internal __testConfig = InstanceTestConfig( + "EzETHHyperdrive", whaleAccounts, IERC20(ETH), IERC20(EZETH), diff --git a/test/instances/lseth/LsETHHyperdrive.t.sol b/test/instances/lseth/LsETHHyperdrive.t.sol index 09a49b114..82e4e8f2a 100644 --- a/test/instances/lseth/LsETHHyperdrive.t.sol +++ b/test/instances/lseth/LsETHHyperdrive.t.sol @@ -48,6 +48,7 @@ contract LsETHHyperdriveTest is InstanceTest { // The configuration for the Instance testing suite. InstanceTestConfig internal __testConfig = InstanceTestConfig( + "LsETHHyperdrive", whaleAccounts, IERC20(ETH), IERC20(RIVER), diff --git a/test/instances/reth/RETHHyperdrive.t.sol b/test/instances/reth/RETHHyperdrive.t.sol index d545f1392..c93ee9aa3 100644 --- a/test/instances/reth/RETHHyperdrive.t.sol +++ b/test/instances/reth/RETHHyperdrive.t.sol @@ -52,6 +52,7 @@ contract RETHHyperdriveTest is InstanceTest { // The configuration for the Instance testing suite. InstanceTestConfig internal __testConfig = InstanceTestConfig( + "RETHHyperdrive", whaleAccounts, IERC20(ETH), IERC20(rocketTokenRETH), diff --git a/test/instances/steth/StETHHyperdrive.t.sol b/test/instances/steth/StETHHyperdrive.t.sol index 6011dbfdd..7bd0b814e 100644 --- a/test/instances/steth/StETHHyperdrive.t.sol +++ b/test/instances/steth/StETHHyperdrive.t.sol @@ -43,6 +43,7 @@ contract StETHHyperdriveTest is InstanceTest { // The configuration for the Instance testing suite. InstanceTestConfig internal __testConfig = InstanceTestConfig( + "StETHHyperdrive", whaleAccounts, IERC20(ETH), IERC20(LIDO), diff --git a/test/integrations/deployers/DeployerCoordinator.t.sol b/test/integrations/deployers/DeployerCoordinator.t.sol index 2e539ccb4..547a000c1 100644 --- a/test/integrations/deployers/DeployerCoordinator.t.sol +++ b/test/integrations/deployers/DeployerCoordinator.t.sol @@ -14,6 +14,8 @@ import { MockERC4626 } from "contracts/test/MockERC4626.sol"; import { Lib } from "test/utils/Lib.sol"; contract MockHyperdriveDeployerCoordinator is HyperdriveDeployerCoordinator { + string public constant override name = "MockHyperdriveDeployerCoordinator"; + bool internal _checkMessageValueStatus = true; bool internal _checkPoolConfigStatus = true; diff --git a/test/integrations/deployers/ERC4626DeployerCoordinator.t.sol b/test/integrations/deployers/ERC4626DeployerCoordinator.t.sol index a28524a39..00ece9b4f 100644 --- a/test/integrations/deployers/ERC4626DeployerCoordinator.t.sol +++ b/test/integrations/deployers/ERC4626DeployerCoordinator.t.sol @@ -88,7 +88,8 @@ contract ERC4626DeployerCoordinatorTest is DeployerCoordinatorTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + "HyperdriveFactory" ) ); diff --git a/test/integrations/deployers/RethDeployerCoordinator.t.sol b/test/integrations/deployers/RethDeployerCoordinator.t.sol index 56fb40f6f..77e3187b7 100644 --- a/test/integrations/deployers/RethDeployerCoordinator.t.sol +++ b/test/integrations/deployers/RethDeployerCoordinator.t.sol @@ -80,7 +80,8 @@ contract RethDeployerCoordinatorTest is DeployerCoordinatorTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + "HyperdriveFactory" ) ); diff --git a/test/integrations/deployers/StethDeployerCoordinator.t.sol b/test/integrations/deployers/StethDeployerCoordinator.t.sol index 54bc26e98..713b12281 100644 --- a/test/integrations/deployers/StethDeployerCoordinator.t.sol +++ b/test/integrations/deployers/StethDeployerCoordinator.t.sol @@ -80,7 +80,8 @@ contract StethDeployerCoordinatorTest is DeployerCoordinatorTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + "HyperdriveFactory" ) ); diff --git a/test/integrations/factory/HyperdriveFactory.t.sol b/test/integrations/factory/HyperdriveFactory.t.sol index c94c04619..3fbafc462 100644 --- a/test/integrations/factory/HyperdriveFactory.t.sol +++ b/test/integrations/factory/HyperdriveFactory.t.sol @@ -24,7 +24,7 @@ import { IHyperdriveFactory } from "contracts/src/interfaces/IHyperdriveFactory. import { IHyperdriveDeployerCoordinator } from "contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol"; import { ILido } from "contracts/src/interfaces/ILido.sol"; import { AssetId } from "contracts/src/libraries/AssetId.sol"; -import { ETH } from "contracts/src/libraries/Constants.sol"; +import { ETH, VERSION } from "contracts/src/libraries/Constants.sol"; import { FixedPointMath, ONE } from "contracts/src/libraries/FixedPointMath.sol"; import { HyperdriveMath } from "contracts/src/libraries/HyperdriveMath.sol"; import { ERC20ForwarderFactory } from "contracts/src/token/ERC20ForwarderFactory.sol"; @@ -33,9 +33,13 @@ import { MockHyperdriveDeployer, MockHyperdriveTargetDeployer } from "contracts/ import { MockLido } from "contracts/test/MockLido.sol"; import { HyperdriveTest } from "test/utils/HyperdriveTest.sol"; import { HyperdriveUtils } from "test/utils/HyperdriveUtils.sol"; +import { Lib } from "test/utils/Lib.sol"; contract HyperdriveFactoryTest is HyperdriveTest { using FixedPointMath for *; + using Lib for *; + + string internal constant NAME = "HyperdriveFactory"; HyperdriveFactory internal factory; @@ -114,7 +118,7 @@ contract HyperdriveFactoryTest is HyperdriveTest { linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) }); - factory = new HyperdriveFactory(config); + factory = new HyperdriveFactory(config, NAME); } function test_constructor() external { @@ -146,7 +150,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -175,7 +180,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -204,7 +210,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -233,7 +240,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum position @@ -259,7 +267,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -286,7 +295,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -312,7 +322,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -339,7 +350,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -365,7 +377,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(2 * ONE, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -391,7 +404,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, 2 * ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -417,7 +431,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, 2 * ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a maximum @@ -443,7 +458,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, 2 * ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -469,7 +485,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(0, ONE, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -495,7 +512,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, 0, ONE, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -521,7 +539,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, 0, ONE), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can't be constructed with a minimum @@ -547,7 +566,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { maxFees: IHyperdrive.Fees(ONE, ONE, ONE, 0), linkerFactory: address(0), linkerCodeHash: bytes32(0) - }) + }), + NAME ); // Ensure that the factory can be constructed with a valid configuration @@ -573,7 +593,9 @@ contract HyperdriveFactoryTest is HyperdriveTest { linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) }); - factory = new HyperdriveFactory(config); + factory = new HyperdriveFactory(config, NAME); + assert(factory.name().eq(NAME)); + assert(factory.version().eq(VERSION)); assertEq(factory.governance(), config.governance); assertEq(factory.hyperdriveGovernance(), config.hyperdriveGovernance); assertEq(factory.linkerFactory(), config.linkerFactory); @@ -2464,6 +2486,8 @@ contract HyperdriveFactoryTest is HyperdriveTest { contract HyperdriveFactoryBaseTest is HyperdriveTest { using FixedPointMath for *; + string internal constant NAME = "HyperdriveFactory"; + HyperdriveFactory factory; address deployerCoordinator; @@ -2529,7 +2553,8 @@ contract HyperdriveFactoryBaseTest is HyperdriveTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + NAME ); coreDeployer = address(new ERC4626HyperdriveCoreDeployer()); target0Deployer = address(new ERC4626Target0Deployer()); @@ -3127,6 +3152,8 @@ contract ERC4626InstanceGetterTest is HyperdriveFactoryBaseTest { } contract DeployerCoordinatorGetterTest is HyperdriveTest { + string internal constant NAME = "HyperdriveFactory"; + HyperdriveFactory factory; function setUp() public override { @@ -3166,7 +3193,8 @@ contract DeployerCoordinatorGetterTest is HyperdriveTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + NAME ); } @@ -3319,6 +3347,8 @@ contract DeployerCoordinatorGetterTest is HyperdriveTest { } contract HyperdriveFactoryAddHyperdriveFactoryTest is HyperdriveTest { + string internal constant NAME = "HyperdriveFactory"; + HyperdriveFactory factory; address deployerCoordinator0 = makeAddr("deployerCoordinator0"); @@ -3361,7 +3391,8 @@ contract HyperdriveFactoryAddHyperdriveFactoryTest is HyperdriveTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + NAME ); } @@ -3425,6 +3456,8 @@ contract HyperdriveFactoryAddHyperdriveFactoryTest is HyperdriveTest { } contract HyperdriveFactoryRemoveInstanceTest is HyperdriveTest { + string internal constant NAME = "HyperdriveFactory"; + HyperdriveFactory factory; address deployerCoordinator0 = makeAddr("deployerCoordinator0"); @@ -3466,7 +3499,8 @@ contract HyperdriveFactoryRemoveInstanceTest is HyperdriveTest { }), linkerFactory: address(0xdeadbeef), linkerCodeHash: bytes32(uint256(0xdeadbabe)) - }) + }), + NAME ); vm.startPrank(alice); diff --git a/test/units/HyperdriveRegistry.t.sol b/test/units/HyperdriveRegistry.t.sol index 1969fca7f..5e8fe86eb 100644 --- a/test/units/HyperdriveRegistry.t.sol +++ b/test/units/HyperdriveRegistry.t.sol @@ -1,17 +1,29 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.18; +pragma solidity 0.8.20; import "forge-std/Test.sol"; - -import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; - import { HyperdriveRegistry } from "contracts/src/factory/HyperdriveRegistry.sol"; +import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; +import { VERSION } from "contracts/src/libraries/Constants.sol"; +import { Lib } from "test/utils/Lib.sol"; contract HyperdriveRegistryTests is Test { + using Lib for *; + + string internal constant NAME = "HyperdriveRegistry"; + HyperdriveRegistry registry; function setUp() external { - registry = new HyperdriveRegistry(); + registry = new HyperdriveRegistry(NAME); + } + + function test_name() public view { + assert(registry.name().eq(NAME)); + } + + function test_version() public view { + assert(registry.version().eq(VERSION)); } function test_updateGovernance_noAuth() public { diff --git a/test/utils/InstanceTest.sol b/test/utils/InstanceTest.sol index 2f3995820..7d41fd24d 100644 --- a/test/utils/InstanceTest.sol +++ b/test/utils/InstanceTest.sol @@ -5,9 +5,10 @@ import { ERC20ForwarderFactory } from "contracts/src/token/ERC20ForwarderFactory import { HyperdriveFactory } from "contracts/src/factory/HyperdriveFactory.sol"; import { IERC20 } from "contracts/src/interfaces/IERC20.sol"; import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; +import { IHyperdriveDeployerCoordinator } from "contracts/src/interfaces/IHyperdriveDeployerCoordinator.sol"; import { IHyperdriveFactory } from "contracts/src/interfaces/IHyperdriveFactory.sol"; import { AssetId } from "contracts/src/libraries/AssetId.sol"; -import { ETH } from "contracts/src/libraries/Constants.sol"; +import { ETH, VERSION } from "contracts/src/libraries/Constants.sol"; import { FixedPointMath, ONE } from "contracts/src/libraries/FixedPointMath.sol"; import { ERC20Mintable } from "contracts/test/ERC20Mintable.sol"; import { HyperdriveTest } from "test/utils/HyperdriveTest.sol"; @@ -28,6 +29,7 @@ abstract contract InstanceTest is HyperdriveTest { /// @dev Configuration for the Instance testing suite. struct InstanceTestConfig { + string name; address[] whaleAccounts; IERC20 baseToken; IERC20 vaultSharesToken; @@ -247,7 +249,8 @@ abstract contract InstanceTest is HyperdriveTest { }), linkerFactory: address(forwarderFactory), linkerCodeHash: forwarderFactory.ERC20LINK_HASH() - }) + }), + "HyperdriveFactory" ); // Set the pool configuration that will be used for instance deployments. @@ -335,6 +338,28 @@ abstract contract InstanceTest is HyperdriveTest { /// Tests /// + /// @dev Tests that the names of the Hyperdrive instance and deployer + /// coordinator are correct. + function test__name() external view { + assert(hyperdrive.name().eq(config.name)); + assert( + IHyperdriveDeployerCoordinator(deployerCoordinator).name().eq( + string.concat(config.name, "DeployerCoordinator") + ) + ); + } + + /// @dev Tests that the versions of the Hyperdrive instance and deployer + /// coordinator are correct. + function test__version() external view { + assert(hyperdrive.version().eq(VERSION)); + assert( + IHyperdriveDeployerCoordinator(deployerCoordinator).version().eq( + VERSION + ) + ); + } + /// @dev Test to verify a market can be deployed and initialized funded by the /// base token. Is expected to revert when base deposits are not supported. function test__deployAndInitialize__asBase() external virtual { diff --git a/test/utils/Lib.sol b/test/utils/Lib.sol index d8e252560..757716d3c 100644 --- a/test/utils/Lib.sol +++ b/test/utils/Lib.sol @@ -211,11 +211,19 @@ library Lib { function eq(bytes memory b1, bytes memory b2) public pure returns (bool) { return + b1.length == b2.length && keccak256(abi.encodePacked(b1)) == keccak256(abi.encodePacked(b2)); } function neq(bytes memory b1, bytes memory b2) public pure returns (bool) { return + b1.length != b2.length || keccak256(abi.encodePacked(b1)) != keccak256(abi.encodePacked(b2)); } + + function eq(string memory b1, string memory b2) public pure returns (bool) { + return + bytes(b1).length == bytes(b2).length && + keccak256(abi.encodePacked(b1)) == keccak256(abi.encodePacked(b2)); + } }