contract BaseCompany is Versionable {
  using SafeMath for uint256;
  
  uint256 internal constant TOKEN_CONTRACT_ID = 1;

  /**
   * @dev Create a new instance of the company contract.
   * @param _name       string
   * @param _version    string
   * @param _identifier uint256
   * @param _manager    address
   */
  function BaseCompany(string _name, string _version, uint256 _identifier, address _manager) public Versionable (_name, _version, _identifier) Manageable(_manager) {}

  /**
   * @dev Get the amount of shares that a shareholder owns in percentage
   *      relative to the total number of shares.
   * @param  shareholder address
   * @return uint256
   */
  function getSharesPercentage(address shareholder) public constant returns (uint256) {
    uint256 totalSharesAmount = token().totalSupply();
    uint256 ownedShares = token().balanceOf(shareholder);
    return ownedShares.mul(100).div(totalSharesAmount);
  }

  /**
   * @dev Get the latest token contract address.
   * @return address
   */
  function tokenAddress() public constant returns (address) {
    return ContractManagementSystem(manager).getActiveContractAddress(TOKEN_CONTRACT_ID);
  }

  /**
   * @dev Get the latest reference to the token.
   * @return SwissCryptoExchangeToken
   */
  function token() public constant returns (SwissCryptoExchangeToken) {
    return SwissCryptoExchangeToken(tokenAddress());
  }

  /**
   * @dev Check if the provided address is a company shareholder.
   * @param _addr address
   * @return bool
   */
  function isShareholder(address _addr) public constant returns (bool) {
    return token().balanceOf(_addr) > 0 && _addr != address(this);
  }
    
  /**
   * @dev Check if the given address is a majority company shareholder.
   * @param _addr address
   * @return bool
   */
  function isMajorityShareholder(address _addr) public constant returns (bool) {
    return (getSharesPercentage(_addr) > 50);
  }
}
function isMajorityShareholder(address _addr) public constant returns (bool) {
  return (getSharesPercentage(_addr) > 50);
}

/**
 * @dev Check if the given address is a majority company shareholder.
 * @param _addr address
 * @return bool
 */