You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
pragma solidity ^0.4.24;
|
|
|
|
import "./SafeERC20.sol";
|
|
|
|
|
|
/**
|
|
* @title TokenTimelock
|
|
* @dev TokenTimelock is a token holder contract that will allow a
|
|
* beneficiary to extract the tokens after a given release time
|
|
*/
|
|
contract TokenTimelock {
|
|
using SafeERC20 for ERC20Basic;
|
|
|
|
// ERC20 basic token contract being held
|
|
ERC20Basic public token;
|
|
|
|
// beneficiary of tokens after they are released
|
|
address public beneficiary;
|
|
|
|
// timestamp when token release is enabled
|
|
uint256 public releaseTime;
|
|
|
|
constructor(
|
|
ERC20Basic _token,
|
|
address _beneficiary,
|
|
uint256 _releaseTime
|
|
)
|
|
public
|
|
{
|
|
// solium-disable-next-line security/no-block-members
|
|
require(_releaseTime > block.timestamp);
|
|
token = _token;
|
|
beneficiary = _beneficiary;
|
|
releaseTime = _releaseTime;
|
|
}
|
|
|
|
/**
|
|
* @notice Transfers tokens held by timelock to beneficiary.
|
|
*/
|
|
function release() public {
|
|
// solium-disable-next-line security/no-block-members
|
|
require(block.timestamp >= releaseTime);
|
|
|
|
uint256 amount = token.balanceOf(this);
|
|
require(amount > 0);
|
|
|
|
token.safeTransfer(beneficiary, amount);
|
|
}
|
|
}
|
|
|