keycard-redeem/contracts/ERC20BucketFactory.sol

21 lines
702 B
Solidity

pragma solidity ^0.6.1;
import "./ERC20Bucket.sol";
import "./Proxy.sol";
contract ERC20BucketFactory {
ERC20Bucket public ERC20BucketImplementation;
event BucketCreated(address indexed provider, address indexed bucket);
constructor() public {
ERC20BucketImplementation = new ERC20Bucket(address(0), 0, block.timestamp + 1);
}
function create(address _tokenAddress, uint256 _startTime, uint256 _expirationTime) public returns (address) {
address p = address(new Proxy(abi.encodeWithSelector(0x4e9464ed, "KeycardERC20Bucket", _tokenAddress, _startTime, _expirationTime, msg.sender), address(ERC20BucketImplementation)));
emit BucketCreated(msg.sender, p);
return p;
}
}