Files
openzeppelin-contracts/contracts/mocks/Create2Impl.sol
corydickson feb7ead005 Add revert if the bytecode length is zero (#2117)
* Add revert if the bytecode length is not greater than zero

* Add value parameter to create2 deploy function

Add tests for contract balance revert and depositing funds

* Change parameter name to amount for clarity

* Fix test for value sending

* Fix linter error

* Change revert reason

* Improve Create2.deploy documentation

* Slight test improvement

* Add changelog entry

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
2020-03-28 12:55:13 -03:00

26 lines
803 B
Solidity

pragma solidity ^0.6.0;
import "../utils/Create2.sol";
import "../token/ERC20/ERC20.sol";
contract Create2Impl {
function deploy(uint256 value, bytes32 salt, bytes memory code) public {
Create2.deploy(value, salt, code);
}
function deployERC20(uint256 value, bytes32 salt) public {
// solhint-disable-next-line indent
Create2.deploy(value, salt, type(ERC20).creationCode);
}
function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
return Create2.computeAddress(salt, codeHash);
}
function computeAddressWithDeployer(bytes32 salt, bytes32 codeHash, address deployer) public pure returns (address) {
return Create2.computeAddress(salt, codeHash, deployer);
}
receive() payable external {}
}