contract BasicToken is ERC20Basic {

  using SafeMath for uint256;
  uint balanceOfParticipant;
  uint lockedAmount;
  uint allowedAmount;
  bool lockupIsActive = false;
  uint256 lockupStartTime;

  // balances for each address
  mapping(address => uint256) balances;

  struct Lockup {
    uint256 lockupAmount;
  }
  Lockup lockup;
  mapping(address => Lockup) lockupParticipants;
  event LockupStarted(uint256 indexed lockupStartTime);

  function requireWithinLockupRange(address _spender, uint256 _amount) internal {
    if (lockupIsActive) {
      uint timePassed = now - lockupStartTime;
      balanceOfParticipant = balances[_spender];
      lockedAmount = lockupParticipants[_spender].lockupAmount;
      allowedAmount = lockedAmount;
      if (timePassed < 92 days) {
        allowedAmount = lockedAmount.mul(5).div(100);
      } else if (timePassed >= 92 days && timePassed < 183 days) {
        allowedAmount = lockedAmount.mul(30).div(100);
      } else if (timePassed >= 183 days && timePassed < 365 days) {
        allowedAmount = lockedAmount.mul(55).div(100);
      }
      require(
        balanceOfParticipant.sub(_amount) >= lockedAmount.sub(allowedAmount),
        "Must maintain correct % of PVC during lockup periods"
      );
    }
  }

  /**
  * @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 != msg.sender, "Cannot transfer to self");
    require(_to != address(this), "Cannot transfer to Contract");
    require(_to != address(0), "Cannot transfer to 0x0");
    require(
      balances[msg.sender] >= _amount && _amount > 0 && balances[_to].add(_amount) > balances[_to],
      "Cannot transfer (Not enough balance)"
    );

    requireWithinLockupRange(msg.sender, _amount);

    // 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;
  }

  /**
  * @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 balanceOf(address _owner) public view returns (uint256 balance) {
    return balances[_owner];
  }
/**
 * @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.
 */