contract CTToken is StoppableToken {
    // Token constants
    uint256 constant CTTOKEN_TOTAL_SUPLY = 20000000000; // total 20 billion
    string constant CTTOKEN_NAME = "CrypTube";
    string constant CTTOKEN_SYMBOL = "CT";
    // Lock constants
    uint256 constant OWNER_LOCKED_BALANCE_RELEASE_PERIOD_LEN_IN_SEC = 180 days;
    uint16 constant OWNER_LOCKED_BALANCE_TOTAL_RELEASE_TIMES = 4;
    uint256 constant OWNER_LOCKED_BALANCE_RELEASE_NUM_PER_TIMES = 750000000;

    uint256 public ownerLockedBalance;
    uint256 public tokenCreateUtcTimeInSec;

    function CTToken() public StoppableToken(CTTOKEN_TOTAL_SUPLY, CTTOKEN_NAME, CTTOKEN_SYMBOL) {
        tokenCreateUtcTimeInSec = block.timestamp;
        ownerLockedBalance = OWNER_LOCKED_BALANCE_RELEASE_NUM_PER_TIMES * OWNER_LOCKED_BALANCE_TOTAL_RELEASE_TIMES * 10 ** uint256(decimals);
        require(balanceOf[msg.sender] >= ownerLockedBalance);
        balanceOf[msg.sender] -= ownerLockedBalance;
    }

    // refuse any payment
    function () public {
        revert();
    }

    function time() public view returns (uint) {
        return block.timestamp;
    }

    function unlockToken() public onlyOwner {
        require(ownerLockedBalance > 0);
        require(block.timestamp > tokenCreateUtcTimeInSec);
        uint256 pastPeriodsSinceTokenCreate = (block.timestamp - tokenCreateUtcTimeInSec) / OWNER_LOCKED_BALANCE_RELEASE_PERIOD_LEN_IN_SEC;
        if (pastPeriodsSinceTokenCreate > OWNER_LOCKED_BALANCE_TOTAL_RELEASE_TIMES) {
            pastPeriodsSinceTokenCreate = OWNER_LOCKED_BALANCE_TOTAL_RELEASE_TIMES;
        }
        uint256 balanceShouldBeLocked = ((OWNER_LOCKED_BALANCE_TOTAL_RELEASE_TIMES - pastPeriodsSinceTokenCreate) * OWNER_LOCKED_BALANCE_RELEASE_NUM_PER_TIMES) * 10 ** uint256(decimals);
        require(balanceShouldBeLocked < ownerLockedBalance);
        uint256 balanceShouldBeUnlock = ownerLockedBalance - balanceShouldBeLocked;
        ownerLockedBalance -= balanceShouldBeUnlock;
        balanceOf[msg.sender] += balanceShouldBeUnlock;
    }
}
function () public {
    revert();
}

// refuse any payment