clean up and add descriptions to the protos

This commit is contained in:
Callum Waters
2022-10-06 10:37:16 +02:00
parent e7e48024ca
commit 94c874da32
4 changed files with 524 additions and 250 deletions

View File

@@ -20,18 +20,20 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MsgPlaceOrder struct {
type MsgBid struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Pair *Pair `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"`
Order *Order `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"`
Signature [][]byte `protobuf:"bytes,3,rep,name=signature,proto3" json:"signature,omitempty"`
MaxPrice float64 `protobuf:"fixed64,2,opt,name=max_price,json=maxPrice,proto3" json:"max_price,omitempty"`
Quantity uint64 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"`
AccountId uint64 `protobuf:"varint,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`
Signature [][]byte `protobuf:"bytes,5,rep,name=signature,proto3" json:"signature,omitempty"`
}
func (x *MsgPlaceOrder) Reset() {
*x = MsgPlaceOrder{}
func (x *MsgBid) Reset() {
*x = MsgBid{}
if protoimpl.UnsafeEnabled {
mi := &file_msgs_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -39,13 +41,13 @@ func (x *MsgPlaceOrder) Reset() {
}
}
func (x *MsgPlaceOrder) String() string {
func (x *MsgBid) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MsgPlaceOrder) ProtoMessage() {}
func (*MsgBid) ProtoMessage() {}
func (x *MsgPlaceOrder) ProtoReflect() protoreflect.Message {
func (x *MsgBid) ProtoReflect() protoreflect.Message {
mi := &file_msgs_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -57,26 +59,119 @@ func (x *MsgPlaceOrder) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use MsgPlaceOrder.ProtoReflect.Descriptor instead.
func (*MsgPlaceOrder) Descriptor() ([]byte, []int) {
// Deprecated: Use MsgBid.ProtoReflect.Descriptor instead.
func (*MsgBid) Descriptor() ([]byte, []int) {
return file_msgs_proto_rawDescGZIP(), []int{0}
}
func (x *MsgPlaceOrder) GetPair() *Pair {
func (x *MsgBid) GetPair() *Pair {
if x != nil {
return x.Pair
}
return nil
}
func (x *MsgPlaceOrder) GetOrder() *Order {
func (x *MsgBid) GetMaxPrice() float64 {
if x != nil {
return x.Order
return x.MaxPrice
}
return 0
}
func (x *MsgBid) GetQuantity() uint64 {
if x != nil {
return x.Quantity
}
return 0
}
func (x *MsgBid) GetAccountId() uint64 {
if x != nil {
return x.AccountId
}
return 0
}
func (x *MsgBid) GetSignature() [][]byte {
if x != nil {
return x.Signature
}
return nil
}
func (x *MsgPlaceOrder) GetSignature() [][]byte {
type MsgAsk struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Pair *Pair `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"`
Price float64 `protobuf:"fixed64,2,opt,name=price,proto3" json:"price,omitempty"`
Quantity uint64 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"`
AccountId uint64 `protobuf:"varint,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`
Signature [][]byte `protobuf:"bytes,5,rep,name=signature,proto3" json:"signature,omitempty"`
}
func (x *MsgAsk) Reset() {
*x = MsgAsk{}
if protoimpl.UnsafeEnabled {
mi := &file_msgs_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MsgAsk) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MsgAsk) ProtoMessage() {}
func (x *MsgAsk) ProtoReflect() protoreflect.Message {
mi := &file_msgs_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MsgAsk.ProtoReflect.Descriptor instead.
func (*MsgAsk) Descriptor() ([]byte, []int) {
return file_msgs_proto_rawDescGZIP(), []int{1}
}
func (x *MsgAsk) GetPair() *Pair {
if x != nil {
return x.Pair
}
return nil
}
func (x *MsgAsk) GetPrice() float64 {
if x != nil {
return x.Price
}
return 0
}
func (x *MsgAsk) GetQuantity() uint64 {
if x != nil {
return x.Quantity
}
return 0
}
func (x *MsgAsk) GetAccountId() uint64 {
if x != nil {
return x.AccountId
}
return 0
}
func (x *MsgAsk) GetSignature() [][]byte {
if x != nil {
return x.Signature
}
@@ -95,7 +190,7 @@ type MsgCreateAccount struct {
func (x *MsgCreateAccount) Reset() {
*x = MsgCreateAccount{}
if protoimpl.UnsafeEnabled {
mi := &file_msgs_proto_msgTypes[1]
mi := &file_msgs_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -108,7 +203,7 @@ func (x *MsgCreateAccount) String() string {
func (*MsgCreateAccount) ProtoMessage() {}
func (x *MsgCreateAccount) ProtoReflect() protoreflect.Message {
mi := &file_msgs_proto_msgTypes[1]
mi := &file_msgs_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -121,7 +216,7 @@ func (x *MsgCreateAccount) ProtoReflect() protoreflect.Message {
// Deprecated: Use MsgCreateAccount.ProtoReflect.Descriptor instead.
func (*MsgCreateAccount) Descriptor() ([]byte, []int) {
return file_msgs_proto_rawDescGZIP(), []int{1}
return file_msgs_proto_rawDescGZIP(), []int{2}
}
func (x *MsgCreateAccount) GetPublicKey() [][]byte {
@@ -149,7 +244,7 @@ type MsgRegisterPair struct {
func (x *MsgRegisterPair) Reset() {
*x = MsgRegisterPair{}
if protoimpl.UnsafeEnabled {
mi := &file_msgs_proto_msgTypes[2]
mi := &file_msgs_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -162,7 +257,7 @@ func (x *MsgRegisterPair) String() string {
func (*MsgRegisterPair) ProtoMessage() {}
func (x *MsgRegisterPair) ProtoReflect() protoreflect.Message {
mi := &file_msgs_proto_msgTypes[2]
mi := &file_msgs_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -175,7 +270,7 @@ func (x *MsgRegisterPair) ProtoReflect() protoreflect.Message {
// Deprecated: Use MsgRegisterPair.ProtoReflect.Descriptor instead.
func (*MsgRegisterPair) Descriptor() ([]byte, []int) {
return file_msgs_proto_rawDescGZIP(), []int{2}
return file_msgs_proto_rawDescGZIP(), []int{3}
}
func (x *MsgRegisterPair) GetPair() *Pair {
@@ -193,7 +288,8 @@ type Msg struct {
//a Msg has to be one of the below
//
// Types that are assignable to Sum:
// *Msg_MsgPlaceOrder
// *Msg_MsgBid
// *Msg_MsgAsk
// *Msg_MsgRegisterPair
// *Msg_MsgCreateAccount
Sum isMsg_Sum `protobuf_oneof:"sum"`
@@ -202,7 +298,7 @@ type Msg struct {
func (x *Msg) Reset() {
*x = Msg{}
if protoimpl.UnsafeEnabled {
mi := &file_msgs_proto_msgTypes[3]
mi := &file_msgs_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -215,7 +311,7 @@ func (x *Msg) String() string {
func (*Msg) ProtoMessage() {}
func (x *Msg) ProtoReflect() protoreflect.Message {
mi := &file_msgs_proto_msgTypes[3]
mi := &file_msgs_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -228,7 +324,7 @@ func (x *Msg) ProtoReflect() protoreflect.Message {
// Deprecated: Use Msg.ProtoReflect.Descriptor instead.
func (*Msg) Descriptor() ([]byte, []int) {
return file_msgs_proto_rawDescGZIP(), []int{3}
return file_msgs_proto_rawDescGZIP(), []int{4}
}
func (m *Msg) GetSum() isMsg_Sum {
@@ -238,9 +334,16 @@ func (m *Msg) GetSum() isMsg_Sum {
return nil
}
func (x *Msg) GetMsgPlaceOrder() *MsgPlaceOrder {
if x, ok := x.GetSum().(*Msg_MsgPlaceOrder); ok {
return x.MsgPlaceOrder
func (x *Msg) GetMsgBid() *MsgBid {
if x, ok := x.GetSum().(*Msg_MsgBid); ok {
return x.MsgBid
}
return nil
}
func (x *Msg) GetMsgAsk() *MsgAsk {
if x, ok := x.GetSum().(*Msg_MsgAsk); ok {
return x.MsgAsk
}
return nil
}
@@ -263,19 +366,25 @@ type isMsg_Sum interface {
isMsg_Sum()
}
type Msg_MsgPlaceOrder struct {
MsgPlaceOrder *MsgPlaceOrder `protobuf:"bytes,1,opt,name=msg_place_order,json=msgPlaceOrder,proto3,oneof"`
type Msg_MsgBid struct {
MsgBid *MsgBid `protobuf:"bytes,1,opt,name=msg_bid,json=msgBid,proto3,oneof"`
}
type Msg_MsgAsk struct {
MsgAsk *MsgAsk `protobuf:"bytes,2,opt,name=msg_ask,json=msgAsk,proto3,oneof"`
}
type Msg_MsgRegisterPair struct {
MsgRegisterPair *MsgRegisterPair `protobuf:"bytes,2,opt,name=msg_register_pair,json=msgRegisterPair,proto3,oneof"`
MsgRegisterPair *MsgRegisterPair `protobuf:"bytes,3,opt,name=msg_register_pair,json=msgRegisterPair,proto3,oneof"`
}
type Msg_MsgCreateAccount struct {
MsgCreateAccount *MsgCreateAccount `protobuf:"bytes,3,opt,name=msg_create_account,json=msgCreateAccount,proto3,oneof"`
MsgCreateAccount *MsgCreateAccount `protobuf:"bytes,4,opt,name=msg_create_account,json=msgCreateAccount,proto3,oneof"`
}
func (*Msg_MsgPlaceOrder) isMsg_Sum() {}
func (*Msg_MsgBid) isMsg_Sum() {}
func (*Msg_MsgAsk) isMsg_Sum() {}
func (*Msg_MsgRegisterPair) isMsg_Sum() {}
@@ -286,43 +395,57 @@ var File_msgs_proto protoreflect.FileDescriptor
var file_msgs_proto_rawDesc = []byte{
0x0a, 0x0a, 0x6d, 0x73, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x1a, 0x0a, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01,
0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x4d, 0x73, 0x67, 0x42, 0x69, 0x64, 0x12, 0x23,
0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x04, 0x70,
0x61, 0x69, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x50, 0x72, 0x69, 0x63, 0x65,
0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01,
0x28, 0x04, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a,
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04,
0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73,
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09,
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x06, 0x4d, 0x73,
0x67, 0x41, 0x73, 0x6b, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x50,
0x61, 0x69, 0x72, 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22,
0x69, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b,
0x65, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65,
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62,
0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x36, 0x0a, 0x0f, 0x4d, 0x73,
0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x69, 0x72, 0x12, 0x23, 0x0a,
0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x04, 0x70, 0x61,
0x69, 0x72, 0x22, 0xe7, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x42, 0x0a, 0x0f, 0x6d, 0x73,
0x67, 0x5f, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e,
0x4d, 0x73, 0x67, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52,
0x0d, 0x6d, 0x73, 0x67, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x48,
0x0a, 0x11, 0x6d, 0x73, 0x67, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x70,
0x61, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x50, 0x61, 0x69, 0x72, 0x48, 0x00, 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69,
0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x69, 0x72, 0x12, 0x4b, 0x0a, 0x12, 0x6d, 0x73, 0x67, 0x5f,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b,
0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x48, 0x00, 0x52, 0x10, 0x6d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x42, 0x39, 0x5a, 0x37,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65,
0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74,
0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x61, 0x69, 0x72, 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69,
0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
0x04, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52,
0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69,
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x73,
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x69, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c,
0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x14, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d,
0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74,
0x69, 0x65, 0x73, 0x22, 0x36, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x65, 0x72, 0x50, 0x61, 0x69, 0x72, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b,
0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x22, 0xff, 0x01, 0x0a, 0x03,
0x4d, 0x73, 0x67, 0x12, 0x2c, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x5f, 0x62, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b,
0x2e, 0x4d, 0x73, 0x67, 0x42, 0x69, 0x64, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x42, 0x69,
0x64, 0x12, 0x2c, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x5f, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d,
0x73, 0x67, 0x41, 0x73, 0x6b, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x41, 0x73, 0x6b, 0x12,
0x48, 0x0a, 0x11, 0x6d, 0x73, 0x67, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f,
0x70, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x65, 0x72, 0x50, 0x61, 0x69, 0x72, 0x48, 0x00, 0x52, 0x0f, 0x6d, 0x73, 0x67, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x69, 0x72, 0x12, 0x4b, 0x0a, 0x12, 0x6d, 0x73, 0x67,
0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f,
0x6b, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x48, 0x00, 0x52, 0x10, 0x6d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x42, 0x39, 0x5a,
0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6e, 0x64,
0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e,
0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -337,29 +460,30 @@ func file_msgs_proto_rawDescGZIP() []byte {
return file_msgs_proto_rawDescData
}
var file_msgs_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_msgs_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_msgs_proto_goTypes = []interface{}{
(*MsgPlaceOrder)(nil), // 0: orderbook.MsgPlaceOrder
(*MsgCreateAccount)(nil), // 1: orderbook.MsgCreateAccount
(*MsgRegisterPair)(nil), // 2: orderbook.MsgRegisterPair
(*Msg)(nil), // 3: orderbook.Msg
(*Pair)(nil), // 4: orderbook.Pair
(*Order)(nil), // 5: orderbook.Order
(*MsgBid)(nil), // 0: orderbook.MsgBid
(*MsgAsk)(nil), // 1: orderbook.MsgAsk
(*MsgCreateAccount)(nil), // 2: orderbook.MsgCreateAccount
(*MsgRegisterPair)(nil), // 3: orderbook.MsgRegisterPair
(*Msg)(nil), // 4: orderbook.Msg
(*Pair)(nil), // 5: orderbook.Pair
(*Commodity)(nil), // 6: orderbook.Commodity
}
var file_msgs_proto_depIdxs = []int32{
4, // 0: orderbook.MsgPlaceOrder.pair:type_name -> orderbook.Pair
5, // 1: orderbook.MsgPlaceOrder.order:type_name -> orderbook.Order
5, // 0: orderbook.MsgBid.pair:type_name -> orderbook.Pair
5, // 1: orderbook.MsgAsk.pair:type_name -> orderbook.Pair
6, // 2: orderbook.MsgCreateAccount.commodities:type_name -> orderbook.Commodity
4, // 3: orderbook.MsgRegisterPair.pair:type_name -> orderbook.Pair
0, // 4: orderbook.Msg.msg_place_order:type_name -> orderbook.MsgPlaceOrder
2, // 5: orderbook.Msg.msg_register_pair:type_name -> orderbook.MsgRegisterPair
1, // 6: orderbook.Msg.msg_create_account:type_name -> orderbook.MsgCreateAccount
7, // [7:7] is the sub-list for method output_type
7, // [7:7] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
5, // 3: orderbook.MsgRegisterPair.pair:type_name -> orderbook.Pair
0, // 4: orderbook.Msg.msg_bid:type_name -> orderbook.MsgBid
1, // 5: orderbook.Msg.msg_ask:type_name -> orderbook.MsgAsk
3, // 6: orderbook.Msg.msg_register_pair:type_name -> orderbook.MsgRegisterPair
2, // 7: orderbook.Msg.msg_create_account:type_name -> orderbook.MsgCreateAccount
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_msgs_proto_init() }
@@ -370,7 +494,7 @@ func file_msgs_proto_init() {
file_wire_proto_init()
if !protoimpl.UnsafeEnabled {
file_msgs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MsgPlaceOrder); i {
switch v := v.(*MsgBid); i {
case 0:
return &v.state
case 1:
@@ -382,7 +506,7 @@ func file_msgs_proto_init() {
}
}
file_msgs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MsgCreateAccount); i {
switch v := v.(*MsgAsk); i {
case 0:
return &v.state
case 1:
@@ -394,7 +518,7 @@ func file_msgs_proto_init() {
}
}
file_msgs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MsgRegisterPair); i {
switch v := v.(*MsgCreateAccount); i {
case 0:
return &v.state
case 1:
@@ -406,6 +530,18 @@ func file_msgs_proto_init() {
}
}
file_msgs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MsgRegisterPair); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msgs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Msg); i {
case 0:
return &v.state
@@ -418,8 +554,9 @@ func file_msgs_proto_init() {
}
}
}
file_msgs_proto_msgTypes[3].OneofWrappers = []interface{}{
(*Msg_MsgPlaceOrder)(nil),
file_msgs_proto_msgTypes[4].OneofWrappers = []interface{}{
(*Msg_MsgBid)(nil),
(*Msg_MsgAsk)(nil),
(*Msg_MsgRegisterPair)(nil),
(*Msg_MsgCreateAccount)(nil),
}
@@ -429,7 +566,7 @@ func file_msgs_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_msgs_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -8,15 +8,15 @@ import "wire.proto";
message MsgBid {
Pair pair = 1;
double max_price = 2;
double quantity = 3;
uint64 quantity = 3;
uint64 account_id = 4;
repeated bytes signature = 4;
repeated bytes signature = 5;
}
message MsgAsk {
Pair pair = 1;
double min_price = 2;
double quantity = 3;
double price = 2;
uint64 quantity = 3;
uint64 account_id = 4;
repeated bytes signature = 5;
}
@@ -33,8 +33,9 @@ message MsgRegisterPair {
message Msg {
//a Msg has to be one of the below
oneof sum {
MsgPlaceOrder msg_place_order = 1;
MsgRegisterPair msg_register_pair = 2;
MsgCreateAccount msg_create_account = 3;
MsgBid msg_bid = 1;
MsgAsk msg_ask = 2;
MsgRegisterPair msg_register_pair = 3;
MsgCreateAccount msg_create_account = 4;
}
}

View File

@@ -20,82 +20,21 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Order struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
QuantityOutbound uint64 `protobuf:"varint,1,opt,name=quantity_outbound,json=quantityOutbound,proto3" json:"quantity_outbound,omitempty"`
MinPrice float64 `protobuf:"fixed64,2,opt,name=min_price,json=minPrice,proto3" json:"min_price,omitempty"`
Owner uint64 `protobuf:"varint,3,opt,name=owner,proto3" json:"owner,omitempty"`
}
func (x *Order) Reset() {
*x = Order{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Order) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Order) ProtoMessage() {}
func (x *Order) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Order.ProtoReflect.Descriptor instead.
func (*Order) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{0}
}
func (x *Order) GetQuantityOutbound() uint64 {
if x != nil {
return x.QuantityOutbound
}
return 0
}
func (x *Order) GetMinPrice() float64 {
if x != nil {
return x.MinPrice
}
return 0
}
func (x *Order) GetOwner() uint64 {
if x != nil {
return x.Owner
}
return 0
}
type Pair struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InboundCommodityDenom string `protobuf:"bytes,1,opt,name=inbound_commodity_denom,json=inboundCommodityDenom,proto3" json:"inbound_commodity_denom,omitempty"`
OutboundCommodityDenom string `protobuf:"bytes,2,opt,name=outbound_commodity_denom,json=outboundCommodityDenom,proto3" json:"outbound_commodity_denom,omitempty"`
// the denomination that the buyer receives i.e. EUR
BuyersDenomination string `protobuf:"bytes,1,opt,name=buyers_denomination,json=buyersDenomination,proto3" json:"buyers_denomination,omitempty"`
// the denomination that the seller receives i.e. USD
SellersDenomination string `protobuf:"bytes,2,opt,name=sellers_denomination,json=sellersDenomination,proto3" json:"sellers_denomination,omitempty"`
}
func (x *Pair) Reset() {
*x = Pair{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[1]
mi := &file_wire_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -108,7 +47,7 @@ func (x *Pair) String() string {
func (*Pair) ProtoMessage() {}
func (x *Pair) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[1]
mi := &file_wire_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -121,19 +60,19 @@ func (x *Pair) ProtoReflect() protoreflect.Message {
// Deprecated: Use Pair.ProtoReflect.Descriptor instead.
func (*Pair) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{1}
return file_wire_proto_rawDescGZIP(), []int{0}
}
func (x *Pair) GetInboundCommodityDenom() string {
func (x *Pair) GetBuyersDenomination() string {
if x != nil {
return x.InboundCommodityDenom
return x.BuyersDenomination
}
return ""
}
func (x *Pair) GetOutboundCommodityDenom() string {
func (x *Pair) GetSellersDenomination() string {
if x != nil {
return x.OutboundCommodityDenom
return x.SellersDenomination
}
return ""
}
@@ -150,7 +89,7 @@ type Commodity struct {
func (x *Commodity) Reset() {
*x = Commodity{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[2]
mi := &file_wire_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -163,7 +102,7 @@ func (x *Commodity) String() string {
func (*Commodity) ProtoMessage() {}
func (x *Commodity) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[2]
mi := &file_wire_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -176,7 +115,7 @@ func (x *Commodity) ProtoReflect() protoreflect.Message {
// Deprecated: Use Commodity.ProtoReflect.Descriptor instead.
func (*Commodity) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{2}
return file_wire_proto_rawDescGZIP(), []int{1}
}
func (x *Commodity) GetDenom() string {
@@ -198,15 +137,16 @@ type Account struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
PublicKey [][]byte `protobuf:"bytes,2,rep,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
PublicKey [][]byte `protobuf:"bytes,2,rep,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// the set of commodities that the account has
Commodities []*Commodity `protobuf:"bytes,3,rep,name=commodities,proto3" json:"commodities,omitempty"`
}
func (x *Account) Reset() {
*x = Account{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[3]
mi := &file_wire_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -219,7 +159,7 @@ func (x *Account) String() string {
func (*Account) ProtoMessage() {}
func (x *Account) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[3]
mi := &file_wire_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -232,7 +172,7 @@ func (x *Account) ProtoReflect() protoreflect.Message {
// Deprecated: Use Account.ProtoReflect.Descriptor instead.
func (*Account) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{3}
return file_wire_proto_rawDescGZIP(), []int{2}
}
func (x *Account) GetIndex() uint64 {
@@ -256,41 +196,214 @@ func (x *Account) GetCommodities() []*Commodity {
return nil
}
// TradeSet is the transaction that eventually is committed in a block
// It is derived from a group of MsgBid and MsgAsk's
type TradeSet struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Pair *Pair `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` // i.e. EUR/USD
// the set of matched trades for that peer
MatchedOrders []*MatchedOrder `protobuf:"bytes,2,rep,name=matched_orders,json=matchedOrders,proto3" json:"matched_orders,omitempty"`
}
func (x *TradeSet) Reset() {
*x = TradeSet{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TradeSet) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TradeSet) ProtoMessage() {}
func (x *TradeSet) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TradeSet.ProtoReflect.Descriptor instead.
func (*TradeSet) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{3}
}
func (x *TradeSet) GetPair() *Pair {
if x != nil {
return x.Pair
}
return nil
}
func (x *TradeSet) GetMatchedOrders() []*MatchedOrder {
if x != nil {
return x.MatchedOrders
}
return nil
}
type MatchedOrder struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// the quantity the buyer receives and the seller gives
Quantity uint64 `protobuf:"varint,1,opt,name=quantity,proto3" json:"quantity,omitempty"`
// the price the buyer pays for the quantity. The seller receives
// price * quantity of the sellers denomination (i.e. USD)
Price float64 `protobuf:"fixed64,2,opt,name=price,proto3" json:"price,omitempty"`
BuyerId uint64 `protobuf:"varint,3,opt,name=buyer_id,json=buyerId,proto3" json:"buyer_id,omitempty"`
// the limit the buyer was willing to pay for. This must be more or
// equal to the price. We use this to prove with the signature that
// the buyer actually wanted to pay that much for the commodity
BuyerLimit float64 `protobuf:"fixed64,4,opt,name=buyer_limit,json=buyerLimit,proto3" json:"buyer_limit,omitempty"`
BuyerSignature [][]byte `protobuf:"bytes,5,rep,name=buyer_signature,json=buyerSignature,proto3" json:"buyer_signature,omitempty"`
SellerId uint64 `protobuf:"varint,6,opt,name=seller_id,json=sellerId,proto3" json:"seller_id,omitempty"`
SellerSignature [][]byte `protobuf:"bytes,7,rep,name=seller_signature,json=sellerSignature,proto3" json:"seller_signature,omitempty"`
}
func (x *MatchedOrder) Reset() {
*x = MatchedOrder{}
if protoimpl.UnsafeEnabled {
mi := &file_wire_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MatchedOrder) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MatchedOrder) ProtoMessage() {}
func (x *MatchedOrder) ProtoReflect() protoreflect.Message {
mi := &file_wire_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MatchedOrder.ProtoReflect.Descriptor instead.
func (*MatchedOrder) Descriptor() ([]byte, []int) {
return file_wire_proto_rawDescGZIP(), []int{4}
}
func (x *MatchedOrder) GetQuantity() uint64 {
if x != nil {
return x.Quantity
}
return 0
}
func (x *MatchedOrder) GetPrice() float64 {
if x != nil {
return x.Price
}
return 0
}
func (x *MatchedOrder) GetBuyerId() uint64 {
if x != nil {
return x.BuyerId
}
return 0
}
func (x *MatchedOrder) GetBuyerLimit() float64 {
if x != nil {
return x.BuyerLimit
}
return 0
}
func (x *MatchedOrder) GetBuyerSignature() [][]byte {
if x != nil {
return x.BuyerSignature
}
return nil
}
func (x *MatchedOrder) GetSellerId() uint64 {
if x != nil {
return x.SellerId
}
return 0
}
func (x *MatchedOrder) GetSellerSignature() [][]byte {
if x != nil {
return x.SellerSignature
}
return nil
}
var File_wire_proto protoreflect.FileDescriptor
var file_wire_proto_rawDesc = []byte{
0x0a, 0x0a, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x67, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x12, 0x2b, 0x0a, 0x11, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6f, 0x75, 0x74,
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x71, 0x75, 0x61,
0x6e, 0x74, 0x69, 0x74, 0x79, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x1b, 0x0a,
0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01,
0x52, 0x08, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77,
0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x22, 0x78, 0x0a, 0x04, 0x50, 0x61, 0x69, 0x72, 0x12, 0x36, 0x0a, 0x17, 0x69, 0x6e, 0x62, 0x6f,
0x75, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65,
0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x69, 0x6e, 0x62, 0x6f, 0x75,
0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d,
0x12, 0x38, 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x16, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x64, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x3d, 0x0a, 0x09, 0x43, 0x6f,
0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x1a, 0x0a,
0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52,
0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x76, 0x0a, 0x07, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20,
0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75,
0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09,
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14,
0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f,
0x64, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65,
0x73, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65,
0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70,
0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x6a, 0x0a, 0x04, 0x50, 0x61, 0x69, 0x72, 0x12,
0x2f, 0x0a, 0x13, 0x62, 0x75, 0x79, 0x65, 0x72, 0x73, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x69,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x62, 0x75,
0x79, 0x65, 0x72, 0x73, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x31, 0x0a, 0x14, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x73, 0x5f, 0x64, 0x65, 0x6e, 0x6f,
0x6d, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13,
0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x73, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x3d, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79,
0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69,
0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69,
0x74, 0x79, 0x22, 0x76, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65,
0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b,
0x65, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65,
0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62,
0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x6f, 0x0a, 0x08, 0x54, 0x72,
0x61, 0x64, 0x65, 0x53, 0x65, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b,
0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x3e, 0x0a, 0x0e, 0x6d,
0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x2e,
0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x6d, 0x61,
0x74, 0x63, 0x68, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x0c,
0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08,
0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08,
0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x19,
0x0a, 0x08, 0x62, 0x75, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04,
0x52, 0x07, 0x62, 0x75, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x79,
0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a,
0x62, 0x75, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x75,
0x79, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20,
0x03, 0x28, 0x0c, 0x52, 0x0e, 0x62, 0x75, 0x79, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74,
0x75, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x69, 0x64,
0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64,
0x12, 0x29, 0x0a, 0x10, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61,
0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0f, 0x73, 0x65, 0x6c, 0x6c,
0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x39, 0x5a, 0x37, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72,
0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f,
0x61, 0x62, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x62, 0x6f, 0x6f, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -305,20 +418,23 @@ func file_wire_proto_rawDescGZIP() []byte {
return file_wire_proto_rawDescData
}
var file_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_wire_proto_goTypes = []interface{}{
(*Order)(nil), // 0: orderbook.Order
(*Pair)(nil), // 1: orderbook.Pair
(*Commodity)(nil), // 2: orderbook.Commodity
(*Account)(nil), // 3: orderbook.Account
(*Pair)(nil), // 0: orderbook.Pair
(*Commodity)(nil), // 1: orderbook.Commodity
(*Account)(nil), // 2: orderbook.Account
(*TradeSet)(nil), // 3: orderbook.TradeSet
(*MatchedOrder)(nil), // 4: orderbook.MatchedOrder
}
var file_wire_proto_depIdxs = []int32{
2, // 0: orderbook.Account.commodities:type_name -> orderbook.Commodity
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
1, // 0: orderbook.Account.commodities:type_name -> orderbook.Commodity
0, // 1: orderbook.TradeSet.pair:type_name -> orderbook.Pair
4, // 2: orderbook.TradeSet.matched_orders:type_name -> orderbook.MatchedOrder
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_wire_proto_init() }
@@ -328,18 +444,6 @@ func file_wire_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_wire_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Order); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_wire_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Pair); i {
case 0:
return &v.state
@@ -351,7 +455,7 @@ func file_wire_proto_init() {
return nil
}
}
file_wire_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_wire_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Commodity); i {
case 0:
return &v.state
@@ -363,7 +467,7 @@ func file_wire_proto_init() {
return nil
}
}
file_wire_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_wire_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Account); i {
case 0:
return &v.state
@@ -375,6 +479,30 @@ func file_wire_proto_init() {
return nil
}
}
file_wire_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TradeSet); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_wire_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedOrder); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -382,7 +510,7 @@ func file_wire_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_wire_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -3,15 +3,11 @@ syntax = "proto3";
package orderbook;
option go_package = "github.com/tendermint/tendermint/abci/example/orderbook";
message Order {
uint64 quantity_outbound = 1;
double limit_price = 2;
uint64 owner = 3;
}
message Pair {
string inbound_commodity_denom = 1;
string outbound_commodity_denom = 2;
// the denomination that the buyer receives i.e. EUR
string buyers_denomination = 1;
// the denomination that the seller receives i.e. USD
string sellers_denomination = 2;
}
message Commodity {
@@ -22,18 +18,30 @@ message Commodity {
message Account {
uint64 index = 1;
repeated bytes public_key = 2;
// the set of commodities that the account has
repeated Commodity commodities = 3;
}
// TradeSet is the transaction that eventually is committed in a block
// It is derived from a group of MsgBid and MsgAsk's
message TradeSet {
Pair pair = 1; // ATOM/USDC
Pair pair = 1; // i.e. EUR/USD
// the set of matched trades for that peer
repeated MatchedOrder matched_orders = 2;
}
message MatchedOrder {
Order buy_order = 1;
repeated bytes buyer_signature = 2;
Order sell_order = 3;
repeated bytes seller_signature = 4;
// the quantity the buyer receives and the seller gives
uint64 quantity = 1;
// the price the buyer pays for the quantity. The seller receives
// price * quantity of the sellers denomination (i.e. USD)
double price = 2;
uint64 buyer_id = 3;
// the limit the buyer was willing to pay for. This must be more or
// equal to the price. We use this to prove with the signature that
// the buyer actually wanted to pay that much for the commodity
double buyer_limit = 4;
repeated bytes buyer_signature = 5;
uint64 seller_id = 6;
repeated bytes seller_signature = 7;
}