contract BasicToken is ERC20Basic {
  using SafeMath for uint256;

  //balance in each address account
  mapping(address => uint256) balances;
  address ownerWallet;
  bool released = false;

  enum LockupType {NOLOCK, FOUNDATION, TEAM, CONSORTIUM, PARTNER, BLACK}

  struct Lockup
  {
      uint256 lockupTime;
      uint256 lockupAmount;
      LockupType lockType;
  }
  Lockup lockup;
  mapping(address=>Lockup) lockupParticipants;  
  
  
  uint256 startTime;
  function release() public {
      require(ownerWallet == msg.sender);
      require(!released);
      released = true;
  }

  function lock() public {
      require(ownerWallet == msg.sender);
      require(released);
      released = false;
  }

  function get_Release() view public returns (bool) {
      return released;
  }

  /**
  * @dev transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _amount The amount to be transferred.
  */
  function transfer(address _to, uint256 _amount) public returns (bool success) {
    require(_to != address(0));
    require(balances[msg.sender] >= _amount && _amount > 0
        && balances[_to].add(_amount) > balances[_to]);


    if (!released) { // before exchanged
      if ( (lockupParticipants[msg.sender].lockType == LockupType.PARTNER) || (msg.sender == ownerWallet) ) {
        // do something to the partner or ownerthing
        // SafeMath.sub will throw if there is not enough balance.
        balances[msg.sender] = balances[msg.sender].sub(_amount);
        balances[_to] = balances[_to].add(_amount);
        emit Transfer(msg.sender, _to, _amount);
        return true;
      //} else if (lockupParticipants[msg.sender].lockType == LockupType.BLACK ) {
      } else {
        // do something to the banned
        return false;
      } 
    } else { // after changed
      if (lockupParticipants[msg.sender].lockType == LockupType.BLACK ) {
        // do something to the banned
        return false;
      } else if (lockupParticipants[msg.sender].lockupAmount>0) {
            uint timePassed = now - startTime;
            if (timePassed < lockupParticipants[msg.sender].lockupTime)
            {
                require(balances[msg.sender].sub(_amount) >= lockupParticipants[msg.sender].lockupAmount);
            }
            // do transfer
            // SafeMath.sub will throw if there is not enough balance.
            balances[msg.sender] = balances[msg.sender].sub(_amount);
            balances[_to] = balances[_to].add(_amount);
            emit Transfer(msg.sender, _to, _amount);
            return true;
      }
    }
    return false;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256 balance) {
    return balances[_owner];
  }

}
/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances.
 */
function transfer(address _to, uint256 _amount) public returns (bool success) {
  require(_to != address(0));
  require(balances[msg.sender] >= _amount && _amount > 0
      && balances[_to].add(_amount) > balances[_to]);


  if (!released) { // before exchanged
    if ( (lockupParticipants[msg.sender].lockType == LockupType.PARTNER) || (msg.sender == ownerWallet) ) {
      // do something to the partner or ownerthing
      // SafeMath.sub will throw if there is not enough balance.
      balances[msg.sender] = balances[msg.sender].sub(_amount);
      balances[_to] = balances[_to].add(_amount);
      emit Transfer(msg.sender, _to, _amount);
      return true;
    //} else if (lockupParticipants[msg.sender].lockType == LockupType.BLACK ) {
    } else {
      // do something to the banned
      return false;
    } 
  } else { // after changed
    if (lockupParticipants[msg.sender].lockType == LockupType.BLACK ) {
      // do something to the banned
      return false;
    } else if (lockupParticipants[msg.sender].lockupAmount>0) {
          uint timePassed = now - startTime;
          if (timePassed < lockupParticipants[msg.sender].lockupTime)
          {
              require(balances[msg.sender].sub(_amount) >= lockupParticipants[msg.sender].lockupAmount);
          }
          // do transfer
          // SafeMath.sub will throw if there is not enough balance.
          balances[msg.sender] = balances[msg.sender].sub(_amount);
          balances[_to] = balances[_to].add(_amount);
          emit Transfer(msg.sender, _to, _amount);
          return true;
    }
  }
  return false;
}

/**
 * @dev transfer token for a specified address
 * @param _to The address to transfer to.
 * @param _amount The amount to be transferred.
 */