func (a *AuctionOrder) Deserialize(data []byte) (err error) {
	// 33 for pubkey, 26 for the rest, 8 for len side, 4 for min side ("sell" is 4 bytes), 32 for auctionID, 2 for nonce, 8 for siglen
	// bucket is where we put all of the non byte stuff so we can get their length

	// TODO: remove all of this serialization code entirely and use protobufs or something else
	minimumDataLength := len(a.Nonce) +
		len(a.AuctionID) +
		binary.Size(a.OrderbookPrice) +
		binary.Size(a.AmountWant) +
		binary.Size(a.AmountHave) +
		a.TradingPair.Size() +
		len(a.Pubkey)
	if len(data) < minimumDataLength {
		err = fmt.Errorf("Auction order cannot be less than %d bytes: %s", len(data), err)
		return
	}

	copy(a.Pubkey[:], data[:33])
	data = data[33:]
	var tradingPairBytes [2]byte
	copy(tradingPairBytes[:], data[:2])
	if err = a.TradingPair.Deserialize(tradingPairBytes[:]); err != nil {
		err = fmt.Errorf("Could not deserialize trading pair while deserializing auction order: %s", err)
		return
	}
	data = data[2:]
	a.AmountHave = binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.AmountWant = binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	sideLen := binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.Side = string(data[:sideLen])
	data = data[sideLen:]
	copy(a.AuctionID[:], data[:32])
	data = data[32:]
	copy(a.Nonce[:], data[:2])
	data = data[2:]
	sigLen := binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.Signature = data[:sigLen]
	data = data[sigLen:]

	return
}
// Deserialize deserializes an order into the struct ptr it's being called on
Deserialize deserializes an order into the struct ptr it's being called on
// Deserialize deserializes an order into the struct ptr it ' s being called on
func (a *AuctionOrder) Deserialize(data []byte) (err error) {
	minimumDataLength := len(a.Nonce) +
		len(a.AuctionID) +
		binary.Size(a.OrderbookPrice) +
		binary.Size(a.AmountWant) +
		binary.Size(a.AmountHave) +
		a.TradingPair.Size() +
		len(a.Pubkey)
	if len(data) < minimumDataLength {
		err = fmt.Errorf("Auction order cannot be less than %d bytes: %s", len(data), err)
		return
	}
	copy(a.Pubkey[:], data[:33])
	data = data[33:]
	var tradingPairBytes [2]byte
	copy(tradingPairBytes[:], data[:2])
	if err = a.TradingPair.Deserialize(tradingPairBytes[:]); err != nil {
		err = fmt.Errorf("Could not deserialize trading pair while deserializing auction order: %s", err)
		return
	}
	data = data[2:]
	a.AmountHave = binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.AmountWant = binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	sideLen := binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.Side = string(data[:sideLen])
	data = data[sideLen:]
	copy(a.AuctionID[:], data[:32])
	data = data[32:]
	copy(a.Nonce[:], data[:2])
	data = data[2:]
	sigLen := binary.LittleEndian.Uint64(data[:8])
	data = data[8:]
	a.Signature = data[:sigLen]
	data = data[sigLen:]
	return
}
func ( a * AuctionOrder ) Deserialize ( data [ ] byte ) ( err error ) { minimumDataLength := len ( a . Nonce ) + len ( a . AuctionID ) + binary . Size ( a . OrderbookPrice ) + binary . Size ( a . AmountWant ) + binary . Size ( a . AmountHave ) + a . TradingPair . Size ( ) + len ( a . Pubkey ) if len ( data ) < minimumDataLength { err = fmt . Errorf ( " " , len ( data ) , err ) return } copy ( a . Pubkey [ : ] , data [ : 33 ] ) data = data [ 33 : ] var tradingPairBytes [ 2 ] byte copy ( tradingPairBytes [ : ] , data [ : 2 ] ) if err = a . TradingPair . Deserialize ( tradingPairBytes [ : ] ) ; err != nil { err = fmt . Errorf ( " " , err ) return } data = data [ 2 : ] a . AmountHave = binary . LittleEndian . Uint64 ( data [ : 8 ] ) data = data [ 8 : ] a . AmountWant = binary . LittleEndian . Uint64 ( data [ : 8 ] ) data = data [ 8 : ] sideLen := binary . LittleEndian . Uint64 ( data [ : 8 ] ) data = data [ 8 : ] a . Side = string ( data [ : sideLen ] ) data = data [ sideLen : ] copy ( a . AuctionID [ : ] , data [ : 32 ] ) data = data [ 32 : ] copy ( a . Nonce [ : ] , data [ : 2 ] ) data = data [ 2 : ] sigLen := binary . LittleEndian . Uint64 ( data [ : 8 ] ) data = data [ 8 : ] a . Signature = data [ : sigLen ] data = data [ sigLen : ] return }
Deserialize deserializes an order into the struct ptr it's being called on
Deserialize deserializes an order into the struct ptr it ' s being called on
// 33 for pubkey, 26 for the rest, 8 for len side, 4 for min side ("sell" is 4 bytes), 32 for auctionID, 2 for nonce, 8 for siglen // bucket is where we put all of the non byte stuff so we can get their length // TODO: remove all of this serialization code entirely and use protobufs or something else