function buyOffer(uint256 amount, uint256 price, address race, bytes32 horse) external payable
    _validRace(race) 
    _validHorse(horse)
    returns (bytes32) {
        require(amount > 0);
        require(price > 0);
        require(msg.value == price * amount);
        bytes32 id = keccak256(abi.encodePacked(amount,price,race,horse,false,block.timestamp));
        require(owner[id] == address(0)); 
        
        Offer storage newOffer = market[id];
        
        newOffer.Amount = amount;
        newOffer.Horse = horse;
        newOffer.Price = price;
        newOffer.Race = race;
        newOffer.BuyType = true;
        owner[id] = msg.sender;
        
        emit Buying(id,amount,price,race,horse,msg.sender);
        
        return id;
    }