Create2ImplUpgradeable.sol 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. }
  9. function __Create2Impl_init_unchained() internal onlyInitializing {
  10. }
  11. function deploy(
  12. uint256 value,
  13. bytes32 salt,
  14. bytes memory code
  15. ) public {
  16. Create2Upgradeable.deploy(value, salt, code);
  17. }
  18. function deployERC1820Implementer(uint256 value, bytes32 salt) public {
  19. Create2Upgradeable.deploy(value, salt, type(ERC1820ImplementerUpgradeable).creationCode);
  20. }
  21. function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
  22. return Create2Upgradeable.computeAddress(salt, codeHash);
  23. }
  24. function computeAddressWithDeployer(
  25. bytes32 salt,
  26. bytes32 codeHash,
  27. address deployer
  28. ) public pure returns (address) {
  29. return Create2Upgradeable.computeAddress(salt, codeHash, deployer);
  30. }
  31. receive() external payable {}
  32. /**
  33. * This empty reserved space is put in place to allow future versions to add new
  34. * variables without shifting down storage in the inheritance chain.
  35. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  36. */
  37. uint256[50] private __gap;
  38. }