Create2ImplUpgradeable.sol 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/Create2Upgradeable.sol";
  4. import "../utils/introspection/ERC1820ImplementerUpgradeable.sol";
  5. import "../proxy/utils/Initializable.sol";
  6. contract Create2ImplUpgradeable is Initializable {
  7. function __Create2Impl_init() internal onlyInitializing {
  8. __Create2Impl_init_unchained();
  9. }
  10. function __Create2Impl_init_unchained() internal onlyInitializing {
  11. }
  12. function deploy(
  13. uint256 value,
  14. bytes32 salt,
  15. bytes memory code
  16. ) public {
  17. Create2Upgradeable.deploy(value, salt, code);
  18. }
  19. function deployERC1820Implementer(uint256 value, bytes32 salt) public {
  20. Create2Upgradeable.deploy(value, salt, type(ERC1820ImplementerUpgradeable).creationCode);
  21. }
  22. function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
  23. return Create2Upgradeable.computeAddress(salt, codeHash);
  24. }
  25. function computeAddressWithDeployer(
  26. bytes32 salt,
  27. bytes32 codeHash,
  28. address deployer
  29. ) public pure returns (address) {
  30. return Create2Upgradeable.computeAddress(salt, codeHash, deployer);
  31. }
  32. receive() external payable {}
  33. uint256[50] private __gap;
  34. }