contract BCBToken is ERC20Token, Ownable {
  uint256 constant public BCB_UNIT = 10 ** 18;

  string public constant name = "BCBToken";
  string public constant symbol = "BCB";
  uint32 public constant decimals = 18;

  uint256 public totalSupply = 120000000 * BCB_UNIT;
  uint256 public lockedAllocation = 53500000 * BCB_UNIT;
  uint256 public totalAllocated = 0;
  address public allocationAddress;

  uint256 public lockEndTime;

  constructor(address _allocationAddress) public {
    // Transfer the rest of the tokens to the owner
    balanceOf[owner] = totalSupply - lockedAllocation;
    allocationAddress = _allocationAddress;

    // Lock for 12 months
    lockEndTime = now + 12 * 30 days;
  }

  /**
   * @dev Release all locked tokens
   * throws if called not by the owner or called before timelock (12 months)
   * or if tokens were already allocated
   */
  function releaseLockedTokens() public onlyOwner {
    require(now > lockEndTime);
    require(totalAllocated < lockedAllocation);

    totalAllocated = lockedAllocation;
    balanceOf[allocationAddress] = balanceOf[allocationAddress].add(lockedAllocation);

    emit Transfer(0x0, allocationAddress, lockedAllocation);
  }

  /**
   * @dev Allow other contract to spend tokens and notify the contract about it a in single transaction
   * @param _spender    address   The contract address authorized to spend
   * @param _value      uint256   The amount of tokens can be spend
   * @param _extraData  bytes     Some extra information to send to the approved contract
   */
  function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool) {
    if (approve(_spender, _value)) {
      ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
      return true;
    }
  }
}
function releaseLockedTokens() public onlyOwner {
  require(now > lockEndTime);
  require(totalAllocated < lockedAllocation);

  totalAllocated = lockedAllocation;
  balanceOf[allocationAddress] = balanceOf[allocationAddress].add(lockedAllocation);

  emit Transfer(0x0, allocationAddress, lockedAllocation);
}

/**
 * @dev Release all locked tokens
 * throws if called not by the owner or called before timelock (12 months)
 * or if tokens were already allocated
 */