• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

delvtech / hyperdrive / 10604539031

28 Aug 2024 09:16PM UTC coverage: 89.961% (-0.07%) from 90.031%
10604539031

push

github

mcclurejt
switch to create2

0 of 6 new or added lines in 1 file covered. (0.0%)

2312 of 2570 relevant lines covered (89.96%)

346479.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/contracts/src/factory/HyperdriveCreate2Factory.sol
1
// SPDX-License-Identifier: Apache-2.0
2
pragma solidity 0.8.22;
3

4
import { Create2 } from "openzeppelin/utils/Create2.sol";
5

6
/// @author DELV
7
/// @title HyperdriveCreate2Factory
8
/// @notice Uses Create2 to deploy a contract to a precomputable address that
9
///         is only dependent on the contract's bytecode and the provided salt.
10
/// @custom:disclaimer The language used in this code is for coding convenience
11
///                    only, and is not intended to, and does not, have any
12
///                    particular legal or regulatory significance.
13
contract HyperdriveCreate2Factory {
14
    /// @notice Deploy the contract with the provided creation code to a
15
    ///         precomputable address determined by only the salt and bytecode.
16
    /// @param _salt Salt to use for the deployment.
17
    /// @param _creationCode Creation code of the contract to deploy.
18
    /// @return deployed Address of the deployed contract.
19
    function deploy(
20
        bytes32 _salt,
21
        bytes memory _creationCode
22
    ) external payable returns (address deployed) {
NEW
23
        return Create2.deploy(msg.value, _salt, _creationCode);
×
24
    }
25

26
    /// @notice Deploy the contract with the provided creation code to a
27
    ///         precomputable address determined by only the deployer address
28
    ///         and salt.
29
    /// @param _salt Salt to use for the deployment.
30
    /// @param _creationCode Creation code of the contract to deploy.
31
    /// @param _initializationCode Encoded function data to be called on the
32
    ///        newly deployed contract.
33
    /// @return deployed Address of the deployed contract.
34
    function deploy(
35
        bytes32 _salt,
36
        bytes memory _creationCode,
37
        bytes memory _initializationCode
38
    ) external payable returns (address deployed) {
NEW
39
        deployed = Create2.deploy(msg.value, _salt, _creationCode);
×
NEW
40
        (bool success, ) = deployed.call(_initializationCode);
×
NEW
41
        require(success, "FAILED_INITIALIZATION");
×
NEW
42
        return deployed;
×
43
    }
44

45
    /// @notice Use the deployer address and salt to compute the address of a
46
    ///         contract deployed via Create2.
47
    /// @param _salt Salt of the deployed contract.
48
    /// @param _bytecodeHash Hash of the contract bytecode.
49
    /// @return Address of the Create2 deployed contract.
50
    function getDeployed(
51
        bytes32 _salt,
52
        bytes32 _bytecodeHash
53
    ) external view returns (address) {
NEW
54
        return Create2.computeAddress(_salt, _bytecodeHash);
×
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc