contract TokenMintERC20Token is ERC20 {

    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 public priceInWei;
    address payable _tokenOwnerAddress;
   
    /**
     * @dev Constructor.
     * @param name name of the token
     * @param symbol symbol of the token, 3-4 chars is recommended
     * @param decimals number of decimal places of one token unit, 18 is widely used
     * @param initialSupply the owner address gets 100% of token supply
     * @param _priceInWei the initial price of token, in wei
     */
    constructor(string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, uint256 _priceInWei) public  {
      _name = name;
      _symbol = symbol;
      _decimals = decimals;
      _tokenOwnerAddress = msg.sender;
      _mint(msg.sender, initialSupply);
      priceInWei = _priceInWei ;
    }

    /**
     * @dev Burns a specific amount of tokens.
     * @param value The amount of lowest token units to be burned.
     */
    function burn(uint256 value) public {
      _burn(msg.sender, value);
    }

    // optional functions from ERC20 stardard

    /**
     * @return the name of the token.
     */
    function name() public view returns (string memory) {
      return _name;
    }

    /**
     * @return the symbol of the token.
     */
    function symbol() public view returns (string memory) {
      return _symbol;
    }

    /**
     * @return the number of decimals of the token.
     */
    function decimals() public view returns (uint8) {
      return _decimals;
    }
    
    /**
     * @return the owner of the token.
     */
    function getOwner() public view returns (address payable) {
      return _tokenOwnerAddress;
    }
    
 
    
    function mint() public payable returns (bool) {
    uint256 amountToMint = (msg.value / priceInWei) * (10**18);
    _mint(msg.sender, amountToMint);
    return true;
    }
    
   function withdraw() public  {
    require(msg.sender==_tokenOwnerAddress, "Only owner can call this");
    _tokenOwnerAddress.transfer(address(this).balance);
   }   
    
   function changeTokenprice(uint256 _newPriceInWei) public returns (bool) {
     require(msg.sender==_tokenOwnerAddress, "Only owner can call this");   
     priceInWei = _newPriceInWei;
     return true;
   }    
    
}
/**
 * @title TokenMintERC20Token
 * @author TokenMint (visit https://tokenmint.io
 )
 *
 * @dev Standard ERC20 token with burning and optional functions implemented.
 * For full specification of ERC-20 standard see:
 * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
 
 */
function symbol() public view returns (string memory) {
  return _symbol;
}

/**
 * @return the symbol of the token.
 */