|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | +pragma solidity 0.8.22; |
| 3 | + |
| 4 | +import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; |
| 5 | +import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; |
| 6 | +import { IHyperdriveCoreDeployer } from "../../interfaces/IHyperdriveCoreDeployer.sol"; |
| 7 | +import { IXRenzoDeposit } from "../../interfaces/IXRenzoDeposit.sol"; |
| 8 | +import { EzETHLineaHyperdrive } from "../../instances/ezeth-linea/EzETHLineaHyperdrive.sol"; |
| 9 | + |
| 10 | +/// @author DELV |
| 11 | +/// @title EzETHLineaHyperdriveCoreDeployer |
| 12 | +/// @notice The core deployer for the EzETHLineaHyperdrive implementation. |
| 13 | +/// @custom:disclaimer The language used in this code is for coding convenience |
| 14 | +/// only, and is not intended to, and does not, have any |
| 15 | +/// particular legal or regulatory significance. |
| 16 | +contract EzETHLineaHyperdriveCoreDeployer is IHyperdriveCoreDeployer { |
| 17 | + /// @notice The Renzo deposit contract on Linea. The latest mint rate is |
| 18 | + /// used as the vault share price. |
| 19 | + IXRenzoDeposit public immutable xRenzoDeposit; |
| 20 | + |
| 21 | + /// @notice Instantiates the ezETH Linea Hyperdrive base contract. |
| 22 | + /// @param _xRenzoDeposit The xRenzoDeposit contract that provides the |
| 23 | + /// vault share price. |
| 24 | + constructor(IXRenzoDeposit _xRenzoDeposit) { |
| 25 | + xRenzoDeposit = _xRenzoDeposit; |
| 26 | + } |
| 27 | + |
| 28 | + /// @notice Deploys a Hyperdrive instance with the given parameters. |
| 29 | + /// @param __name The name of the Hyperdrive pool. |
| 30 | + /// @param _config The configuration of the Hyperdrive pool. |
| 31 | + /// @param _adminController The admin controller that will specify the |
| 32 | + /// admin parameters for this instance. |
| 33 | + /// @param _target0 The target0 address. |
| 34 | + /// @param _target1 The target1 address. |
| 35 | + /// @param _target2 The target2 address. |
| 36 | + /// @param _target3 The target3 address. |
| 37 | + /// @param _target4 The target4 address. |
| 38 | + /// @param _salt The create2 salt used in the deployment. |
| 39 | + /// @return The address of the newly deployed EzETHLineaHyperdrive instance. |
| 40 | + function deployHyperdrive( |
| 41 | + string memory __name, |
| 42 | + IHyperdrive.PoolConfig memory _config, |
| 43 | + IHyperdriveAdminController _adminController, |
| 44 | + bytes memory, // unused _extraData, |
| 45 | + address _target0, |
| 46 | + address _target1, |
| 47 | + address _target2, |
| 48 | + address _target3, |
| 49 | + address _target4, |
| 50 | + bytes32 _salt |
| 51 | + ) external returns (address) { |
| 52 | + return ( |
| 53 | + address( |
| 54 | + // NOTE: We hash the sender with the salt to prevent the |
| 55 | + // front-running of deployments. |
| 56 | + new EzETHLineaHyperdrive{ |
| 57 | + salt: keccak256(abi.encode(msg.sender, _salt)) |
| 58 | + }( |
| 59 | + __name, |
| 60 | + _config, |
| 61 | + _adminController, |
| 62 | + _target0, |
| 63 | + _target1, |
| 64 | + _target2, |
| 65 | + _target3, |
| 66 | + _target4, |
| 67 | + xRenzoDeposit |
| 68 | + ) |
| 69 | + ) |
| 70 | + ); |
| 71 | + } |
| 72 | +} |
0 commit comments