Skip to content

Instantly share code, notes, and snippets.

@MrChico
Created May 12, 2020 10:37
Show Gist options
  • Save MrChico/73bfb879a231a406bf2d8fd5f6df3d97 to your computer and use it in GitHub Desktop.
Save MrChico/73bfb879a231a406bf2d8fd5f6df3d97 to your computer and use it in GitHub Desktop.
pragma solidity ^0.6.0;
import "../deposit_contract.sol";
contract DepositContractFactory {
bool public deployed;
uint public deploymentTime;
DepositContract depositContract;
constructor(uint _deploymentTime) public {
deploymentTime = _deploymentTime;
}
function deploy() external {
require(block.timestamp >= deploymentTime, "not yet!");
require(!deployed, "already deployed");
depositContract = new DepositContract();
deployed = true;
}
}
@axic
Copy link

axic commented May 12, 2020

I reckon actually CREATE2 would be a bad idea if the salt exists in the factory because the contract could be deployed outside the factory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment