contract KopexExchange is TokenHolder{

    uint256 public price = 1;
    StandardToken public tokenContract;

    constructor(uint256 _price, StandardToken _tokenContract) public {
        price = _price;
        tokenContract = _tokenContract;

    }

    function setPrice(uint256 newPrice) public onlyOwner {
        require(newPrice > 0, 'inv1id price');
        price = newPrice;
    }

    function() public payable {
        require(msg.value > 0, 'no eth received');
        exchangeToken(msg.sender);
    }

    // from safemath
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function exchangeToken(address _buyer) public payable {
        uint256 amount = mul(msg.value, price);
        tokenContract.transfer(_buyer, amount);
    }

}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
}

// from safemath