mirror of
https://github.com/tornadocash/deployer.git
synced 2025-01-15 23:37:53 +01:00
24 lines
779 B
Solidity
24 lines
779 B
Solidity
|
// SPDX-License-Identifier: MIT
|
||
|
pragma solidity ^0.6.0;
|
||
|
|
||
|
interface IDeployer {
|
||
|
function deploy(bytes memory _initCode, bytes32 _salt) external returns (address payable createdContract);
|
||
|
}
|
||
|
|
||
|
contract Deployer {
|
||
|
IDeployer immutable deployer;
|
||
|
|
||
|
constructor(IDeployer _deployer) public {
|
||
|
// Use EIP-2470 SingletonFactory address by default
|
||
|
deployer = address(_deployer) == address(0) ? IDeployer(0xce0042B868300000d44A59004Da54A005ffdcf9f) : _deployer;
|
||
|
}
|
||
|
|
||
|
event Deployed(address indexed sender, address indexed addr);
|
||
|
|
||
|
function deploy(bytes memory _initCode, bytes32 _salt) external {
|
||
|
address createdContract = deployer.deploy(_initCode, _salt);
|
||
|
require(createdContract != address(0), "Deploy failed");
|
||
|
emit Deployed(msg.sender, createdContract);
|
||
|
}
|
||
|
}
|