Create2 feature pending tasks (#2013)
* Add Create2 library (#1744) * feat(contracts): Add Create2 library to use create2 evm opcode * Upgrade sol-coverage * Add changelog entry * Update comments and code style * Remove create2 helper * Fix linter error * Fix truffle dependency * Fix linter error * refactor(Create2): Remove _deploy internal function * test(Create2): test Create2 with inline assembly code * fix(Create2): Check address returned form create2 instead of codesize of created contract * refactor(Create2):Add revert reason when Create2 deploy fails (#2062) * fix merge with master * fix test Co-authored-by: Augusto Lemble <me@augustol.com>
This commit is contained in:
committed by
Nicolás Venturo
parent
d6698c3bfb
commit
8c40a5b275
23
contracts/mocks/Create2Impl.sol
Normal file
23
contracts/mocks/Create2Impl.sol
Normal file
@ -0,0 +1,23 @@
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../utils/Create2.sol";
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
|
||||
contract Create2Impl {
|
||||
function deploy(bytes32 salt, bytes memory code) public {
|
||||
Create2.deploy(salt, code);
|
||||
}
|
||||
|
||||
function deployERC20(bytes32 salt) public {
|
||||
// solhint-disable-next-line indent
|
||||
Create2.deploy(salt, type(ERC20).creationCode);
|
||||
}
|
||||
|
||||
function computeAddress(bytes32 salt, bytes memory code) public view returns (address) {
|
||||
return Create2.computeAddress(salt, code);
|
||||
}
|
||||
|
||||
function computeAddress(bytes32 salt, bytes memory code, address deployer) public pure returns (address) {
|
||||
return Create2.computeAddress(salt, code, deployer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user