diff --git a/docs/proto-docs.md b/docs/proto-docs.md index 1769c35b1e..587f6077d1 100644 --- a/docs/proto-docs.md +++ b/docs/proto-docs.md @@ -1529,6 +1529,7 @@ EventOrderCancelled is an event emitted when an order is cancelled. | ----- | ---- | ----- | ----------- | | `order_id` | [uint64](#uint64) | | order_id is the numerical identifier of the order cancelled. | | `cancelled_by` | [string](#string) | | cancelled_by is the account that triggered the cancellation of the order. | +| `market_id` | [uint32](#uint32) | | market_id is the numerical identifier of the market. | | `external_id` | [string](#string) | | external_id is the order's external id. | @@ -1546,6 +1547,7 @@ EventOrderCreated is an event emitted when an order is created. | ----- | ---- | ----- | ----------- | | `order_id` | [uint64](#uint64) | | order_id is the numerical identifier of the order created. | | `order_type` | [string](#string) | | order_type is the type of order, e.g. "ask" or "bid". | +| `market_id` | [uint32](#uint32) | | market_id is the numerical identifier of the market. | | `external_id` | [string](#string) | | external_id is the order's external id. | @@ -1562,6 +1564,7 @@ EventOrderExternalIDUpdated is an event emitted when an order's external id is u | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `order_id` | [uint64](#uint64) | | order_id is the numerical identifier of the order partially filled. | +| `market_id` | [uint32](#uint32) | | market_id is the numerical identifier of the market. | | `external_id` | [string](#string) | | external_id is the order's new external id. | @@ -1582,6 +1585,7 @@ This event is also used for orders that were previously partially filled, but ha | `assets` | [string](#string) | | assets is the coins amount string of assets bought/sold for this order. | | `price` | [string](#string) | | price is the coins amount string of the price payed/received for this order. | | `fees` | [string](#string) | | fees is the coins amount string of settlement fees paid with this order. | +| `market_id` | [uint32](#uint32) | | market_id is the numerical identifier of the market. | | `external_id` | [string](#string) | | external_id is the order's external id. | @@ -1601,6 +1605,7 @@ EventOrderPartiallyFilled is an event emitted when an order filled in part and s | `assets` | [string](#string) | | assets is the coins amount string of assets that were filled and removed from the order. | | `price` | [string](#string) | | price is the coins amount string of the price payed/received for this order. For ask orders, this might be more than the amount that was removed from the order's price. | | `fees` | [string](#string) | | fees is the coins amount string of settlement fees paid with this partial order. For ask orders, this might be more than the amount that was removed from the order's settlement fees. | +| `market_id` | [uint32](#uint32) | | market_id is the numerical identifier of the market. | | `external_id` | [string](#string) | | external_id is the order's external id. | diff --git a/proto/provenance/exchange/v1/events.proto b/proto/provenance/exchange/v1/events.proto index 07a55a63d8..3839b76b6b 100644 --- a/proto/provenance/exchange/v1/events.proto +++ b/proto/provenance/exchange/v1/events.proto @@ -14,8 +14,10 @@ message EventOrderCreated { uint64 order_id = 1; // order_type is the type of order, e.g. "ask" or "bid". string order_type = 2; + // market_id is the numerical identifier of the market. + uint32 market_id = 3; // external_id is the order's external id. - string external_id = 3; + string external_id = 4; } // EventOrderCancelled is an event emitted when an order is cancelled. @@ -24,8 +26,10 @@ message EventOrderCancelled { uint64 order_id = 1; // cancelled_by is the account that triggered the cancellation of the order. string cancelled_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market. + uint32 market_id = 3; // external_id is the order's external id. - string external_id = 3; + string external_id = 4; } // EventOrderFilled is an event emitted when an order has been filled in full. @@ -39,8 +43,10 @@ message EventOrderFilled { string price = 3; // fees is the coins amount string of settlement fees paid with this order. string fees = 4; + // market_id is the numerical identifier of the market. + uint32 market_id = 5; // external_id is the order's external id. - string external_id = 5; + string external_id = 6; } // EventOrderPartiallyFilled is an event emitted when an order filled in part and still has more left to fill. @@ -55,14 +61,18 @@ message EventOrderPartiallyFilled { // fees is the coins amount string of settlement fees paid with this partial order. // For ask orders, this might be more than the amount that was removed from the order's settlement fees. string fees = 4; + // market_id is the numerical identifier of the market. + uint32 market_id = 5; // external_id is the order's external id. - string external_id = 5; + string external_id = 6; } // EventOrderExternalIDUpdated is an event emitted when an order's external id is updated. message EventOrderExternalIDUpdated { // order_id is the numerical identifier of the order partially filled. uint64 order_id = 1; + // market_id is the numerical identifier of the market. + uint32 market_id = 2; // external_id is the order's new external id. string external_id = 3; } diff --git a/x/exchange/events.go b/x/exchange/events.go index b73b9367f9..2667ce70a4 100644 --- a/x/exchange/events.go +++ b/x/exchange/events.go @@ -10,6 +10,7 @@ func NewEventOrderCreated(order OrderI) *EventOrderCreated { return &EventOrderCreated{ OrderId: order.GetOrderID(), OrderType: order.GetOrderType(), + MarketId: order.GetMarketID(), ExternalId: order.GetExternalID(), } } @@ -18,6 +19,7 @@ func NewEventOrderCancelled(order OrderI, cancelledBy sdk.AccAddress) *EventOrde return &EventOrderCancelled{ OrderId: order.GetOrderID(), CancelledBy: cancelledBy.String(), + MarketId: order.GetMarketID(), ExternalId: order.GetExternalID(), } } @@ -28,6 +30,7 @@ func NewEventOrderFilled(order OrderI) *EventOrderFilled { Assets: order.GetAssets().String(), Price: order.GetPrice().String(), Fees: order.GetSettlementFees().String(), + MarketId: order.GetMarketID(), ExternalId: order.GetExternalID(), } } @@ -38,6 +41,7 @@ func NewEventOrderPartiallyFilled(order OrderI) *EventOrderPartiallyFilled { Assets: order.GetAssets().String(), Price: order.GetPrice().String(), Fees: order.GetSettlementFees().String(), + MarketId: order.GetMarketID(), ExternalId: order.GetExternalID(), } } @@ -45,6 +49,7 @@ func NewEventOrderPartiallyFilled(order OrderI) *EventOrderPartiallyFilled { func NewEventOrderExternalIDUpdated(order OrderI) *EventOrderExternalIDUpdated { return &EventOrderExternalIDUpdated{ OrderId: order.GetOrderID(), + MarketId: order.GetMarketID(), ExternalId: order.GetExternalID(), } } diff --git a/x/exchange/events.pb.go b/x/exchange/events.pb.go index 0fd503f3d4..afe695a1be 100644 --- a/x/exchange/events.pb.go +++ b/x/exchange/events.pb.go @@ -29,8 +29,10 @@ type EventOrderCreated struct { OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` // order_type is the type of order, e.g. "ask" or "bid". OrderType string `protobuf:"bytes,2,opt,name=order_type,json=orderType,proto3" json:"order_type,omitempty"` + // market_id is the numerical identifier of the market. + MarketId uint32 `protobuf:"varint,3,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` // external_id is the order's external id. - ExternalId string `protobuf:"bytes,3,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + ExternalId string `protobuf:"bytes,4,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` } func (m *EventOrderCreated) Reset() { *m = EventOrderCreated{} } @@ -80,6 +82,13 @@ func (m *EventOrderCreated) GetOrderType() string { return "" } +func (m *EventOrderCreated) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + func (m *EventOrderCreated) GetExternalId() string { if m != nil { return m.ExternalId @@ -93,8 +102,10 @@ type EventOrderCancelled struct { OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` // cancelled_by is the account that triggered the cancellation of the order. CancelledBy string `protobuf:"bytes,2,opt,name=cancelled_by,json=cancelledBy,proto3" json:"cancelled_by,omitempty"` + // market_id is the numerical identifier of the market. + MarketId uint32 `protobuf:"varint,3,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` // external_id is the order's external id. - ExternalId string `protobuf:"bytes,3,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + ExternalId string `protobuf:"bytes,4,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` } func (m *EventOrderCancelled) Reset() { *m = EventOrderCancelled{} } @@ -144,6 +155,13 @@ func (m *EventOrderCancelled) GetCancelledBy() string { return "" } +func (m *EventOrderCancelled) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + func (m *EventOrderCancelled) GetExternalId() string { if m != nil { return m.ExternalId @@ -162,8 +180,10 @@ type EventOrderFilled struct { Price string `protobuf:"bytes,3,opt,name=price,proto3" json:"price,omitempty"` // fees is the coins amount string of settlement fees paid with this order. Fees string `protobuf:"bytes,4,opt,name=fees,proto3" json:"fees,omitempty"` + // market_id is the numerical identifier of the market. + MarketId uint32 `protobuf:"varint,5,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` // external_id is the order's external id. - ExternalId string `protobuf:"bytes,5,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + ExternalId string `protobuf:"bytes,6,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` } func (m *EventOrderFilled) Reset() { *m = EventOrderFilled{} } @@ -227,6 +247,13 @@ func (m *EventOrderFilled) GetFees() string { return "" } +func (m *EventOrderFilled) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + func (m *EventOrderFilled) GetExternalId() string { if m != nil { return m.ExternalId @@ -246,8 +273,10 @@ type EventOrderPartiallyFilled struct { // fees is the coins amount string of settlement fees paid with this partial order. // For ask orders, this might be more than the amount that was removed from the order's settlement fees. Fees string `protobuf:"bytes,4,opt,name=fees,proto3" json:"fees,omitempty"` + // market_id is the numerical identifier of the market. + MarketId uint32 `protobuf:"varint,5,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` // external_id is the order's external id. - ExternalId string `protobuf:"bytes,5,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + ExternalId string `protobuf:"bytes,6,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` } func (m *EventOrderPartiallyFilled) Reset() { *m = EventOrderPartiallyFilled{} } @@ -311,6 +340,13 @@ func (m *EventOrderPartiallyFilled) GetFees() string { return "" } +func (m *EventOrderPartiallyFilled) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + func (m *EventOrderPartiallyFilled) GetExternalId() string { if m != nil { return m.ExternalId @@ -322,6 +358,8 @@ func (m *EventOrderPartiallyFilled) GetExternalId() string { type EventOrderExternalIDUpdated struct { // order_id is the numerical identifier of the order partially filled. OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + // market_id is the numerical identifier of the market. + MarketId uint32 `protobuf:"varint,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` // external_id is the order's new external id. ExternalId string `protobuf:"bytes,3,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` } @@ -366,6 +404,13 @@ func (m *EventOrderExternalIDUpdated) GetOrderId() uint64 { return 0 } +func (m *EventOrderExternalIDUpdated) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + func (m *EventOrderExternalIDUpdated) GetExternalId() string { if m != nil { return m.ExternalId @@ -984,43 +1029,45 @@ func init() { } var fileDescriptor_c1b69385a348cffa = []byte{ - // 574 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xad, 0x21, 0x2d, 0xcd, 0x14, 0x24, 0x30, 0x55, 0x94, 0x50, 0x6a, 0x2a, 0x73, 0xe9, 0xa5, - 0xb6, 0x22, 0x84, 0x90, 0xe0, 0xd4, 0x90, 0x54, 0xea, 0x01, 0x11, 0xa5, 0x54, 0x08, 0x2e, 0xd1, - 0xc6, 0x1e, 0x92, 0xa5, 0xf6, 0xae, 0xbb, 0xbb, 0x49, 0xe3, 0x3f, 0x81, 0x7a, 0xe5, 0x7f, 0xf0, - 0x0f, 0xb8, 0x70, 0xac, 0x38, 0x71, 0x44, 0xc9, 0x1f, 0x41, 0xfe, 0x4a, 0x1c, 0xa8, 0x92, 0x5e, - 0x2c, 0x71, 0xf3, 0x8c, 0xdf, 0xec, 0x7b, 0x6f, 0xf7, 0x49, 0x03, 0x4f, 0x03, 0xc1, 0x47, 0xc8, - 0x08, 0x73, 0xd0, 0xc6, 0xb1, 0x33, 0x20, 0xac, 0x8f, 0xf6, 0xa8, 0x6e, 0xe3, 0x08, 0x99, 0x92, - 0x56, 0x20, 0xb8, 0xe2, 0x7a, 0x65, 0x0e, 0xb2, 0x32, 0x90, 0x35, 0xaa, 0x3f, 0xaa, 0x39, 0x5c, - 0xfa, 0x5c, 0x76, 0x63, 0x94, 0x9d, 0x14, 0xc9, 0x88, 0xc9, 0xe0, 0x41, 0x2b, 0x3a, 0xe2, 0xad, - 0x70, 0x51, 0xbc, 0x16,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c, - 0xed, 0xf7, 0xc4, 0xd0, 0x2e, 0xa7, 0xc6, 0xda, 0xd5, 0xd4, 0x58, 0xfb, 0x35, 0x35, 0xd6, 0xa0, - 0x46, 0xb9, 0x75, 0xfd, 0x0e, 0x6d, 0x6b, 0x1f, 0xad, 0x3e, 0x55, 0x83, 0x61, 0xcf, 0x72, 0xb8, - 0x6f, 0xcf, 0x41, 0x07, 0x94, 0xe7, 0x2a, 0x7b, 0x3c, 0xdb, 0xce, 0xbd, 0x8d, 0x78, 0xc3, 0x3e, - 0xfb, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xcb, 0x11, 0xaf, 0xbb, 0x07, 0x00, 0x00, + // 601 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcf, 0x4f, 0xd4, 0x40, + 0x14, 0xc7, 0x19, 0x58, 0x90, 0x7d, 0x68, 0xa2, 0x95, 0x10, 0x56, 0xa4, 0x92, 0x7a, 0xe1, 0x42, + 0x1b, 0x62, 0x8c, 0x89, 0x9e, 0x58, 0x81, 0x84, 0x83, 0x71, 0x53, 0x24, 0x26, 0x5e, 0xc8, 0x6c, + 0xfb, 0x84, 0x91, 0x76, 0xa6, 0xcc, 0xcc, 0x2e, 0xf4, 0x6f, 0xf0, 0xe2, 0xff, 0x61, 0xbc, 0x19, + 0xff, 0x01, 0x2f, 0x1e, 0x89, 0x27, 0x8f, 0x06, 0xfe, 0x11, 0xd3, 0x5f, 0xbb, 0xad, 0x90, 0x42, + 0x62, 0x9a, 0x78, 0xdb, 0xf7, 0xfa, 0x7d, 0xf3, 0xf9, 0xbe, 0xd7, 0xb7, 0x99, 0xc2, 0xe3, 0x48, + 0x8a, 0x21, 0x72, 0xca, 0x3d, 0x74, 0xf0, 0xd4, 0x3b, 0xa4, 0xfc, 0x00, 0x9d, 0xe1, 0xba, 0x83, + 0x43, 0xe4, 0x5a, 0xd9, 0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5, 0x2b, 0xa9, + 0x0d, 0x37, 0x5b, 0xc5, 0xf6, 0x50, 0x86, 0x4c, 0x29, 0x26, 0x78, 0xc3, 0xcb, 0x53, 0xdd, 0x57, + 0x17, 0x8f, 0x37, 0xb4, 0x96, 0xcd, 0x22, 0xd7, 0x2b, 0xfb, 0x5a, 0xdc, 0x82, 0x75, 0x2c, 0xeb, + 0x29, 0x2c, 0x94, 0x4a, 0xb6, 0x11, 0x6f, 0x34, 0x15, 0x6b, 0x3e, 0x27, 0xf5, 0xa8, 0xa4, 0x61, + 0x51, 0xd2, 0xc5, 0x1f, 0xe7, 0x26, 0x39, 0x3b, 0x37, 0xc9, 0xef, 0x73, 0x93, 0x7c, 0xba, 0x30, + 0x27, 0xce, 0x2e, 0xcc, 0x89, 0x5f, 0x17, 0xe6, 0x04, 0x74, 0x98, 0xb0, 0xaf, 0xbe, 0xd5, 0x7b, + 0xe4, 0x9d, 0x7d, 0xc0, 0xf4, 0xe1, 0xa0, 0x6f, 0x7b, 0x22, 0x74, 0xc6, 0xa2, 0x35, 0x26, 0x4a, + 0x91, 0x73, 0x3a, 0xfa, 0x5e, 0xe8, 0xcf, 0xa4, 0x77, 0xfe, 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x63, 0xb9, 0x7f, 0xd7, 0x4d, 0x08, 0x00, 0x00, } func (m *EventOrderCreated) Marshal() (dAtA []byte, err error) { @@ -1048,7 +1095,12 @@ func (m *EventOrderCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ExternalId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ExternalId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x18 } if len(m.OrderType) > 0 { i -= len(m.OrderType) @@ -1090,7 +1142,12 @@ func (m *EventOrderCancelled) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ExternalId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ExternalId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x18 } if len(m.CancelledBy) > 0 { i -= len(m.CancelledBy) @@ -1132,7 +1189,12 @@ func (m *EventOrderFilled) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ExternalId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ExternalId))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x28 } if len(m.Fees) > 0 { i -= len(m.Fees) @@ -1188,7 +1250,12 @@ func (m *EventOrderPartiallyFilled) MarshalToSizedBuffer(dAtA []byte) (int, erro copy(dAtA[i:], m.ExternalId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ExternalId))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x28 } if len(m.Fees) > 0 { i -= len(m.Fees) @@ -1246,6 +1313,11 @@ func (m *EventOrderExternalIDUpdated) MarshalToSizedBuffer(dAtA []byte) (int, er i-- dAtA[i] = 0x1a } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x10 + } if m.OrderId != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.OrderId)) i-- @@ -1651,6 +1723,9 @@ func (m *EventOrderCreated) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } l = len(m.ExternalId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1671,6 +1746,9 @@ func (m *EventOrderCancelled) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } l = len(m.ExternalId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1699,6 +1777,9 @@ func (m *EventOrderFilled) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } l = len(m.ExternalId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1727,6 +1808,9 @@ func (m *EventOrderPartiallyFilled) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } l = len(m.ExternalId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1743,6 +1827,9 @@ func (m *EventOrderExternalIDUpdated) Size() (n int) { if m.OrderId != 0 { n += 1 + sovEvents(uint64(m.OrderId)) } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } l = len(m.ExternalId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -2006,6 +2093,25 @@ func (m *EventOrderCreated) Unmarshal(dAtA []byte) error { m.OrderType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType) } @@ -2139,6 +2245,25 @@ func (m *EventOrderCancelled) Unmarshal(dAtA []byte) error { m.CancelledBy = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType) } @@ -2336,6 +2461,25 @@ func (m *EventOrderFilled) Unmarshal(dAtA []byte) error { m.Fees = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType) } @@ -2533,6 +2677,25 @@ func (m *EventOrderPartiallyFilled) Unmarshal(dAtA []byte) error { m.Fees = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType) } @@ -2633,6 +2796,25 @@ func (m *EventOrderExternalIDUpdated) Unmarshal(dAtA []byte) error { break } } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType) diff --git a/x/exchange/events_test.go b/x/exchange/events_test.go index cdd4ca14d2..43a19626b4 100644 --- a/x/exchange/events_test.go +++ b/x/exchange/events_test.go @@ -29,8 +29,12 @@ func assertEverythingSet(t *testing.T, tev proto.Message, typeString string) boo for i, attr := range event.Attributes { rv = assert.NotEmpty(t, attr.Key, "%T event.attributes[%d].Key", tev, i) && rv rv = assert.NotEqual(t, `""`, string(attr.Key), "%T event.attributes[%d].Key", tev, i) && rv + rv = assert.NotEqual(t, `0`, string(attr.Key), "%T event.attributes[%d].Key", tev, i) && rv + rv = assert.NotEqual(t, `"0"`, string(attr.Key), "%T event.attributes[%d].Key", tev, i) && rv rv = assert.NotEmpty(t, attr.Value, "%T event.attributes[%d].Value", tev, i) && rv rv = assert.NotEqual(t, `""`, string(attr.Value), "%T event.attributes[%d].Value", tev, i) && rv + rv = assert.NotEqual(t, `0`, string(attr.Value), "%T event.attributes[%d].Value", tev, i) && rv + rv = assert.NotEqual(t, `"0"`, string(attr.Value), "%T event.attributes[%d].Value", tev, i) && rv } return rv } @@ -49,19 +53,21 @@ func TestNewEventOrderCreated(t *testing.T) { }, { name: "order with ask", - order: NewOrder(1).WithAsk(&AskOrder{ExternalId: "oneoneone"}), + order: NewOrder(1).WithAsk(&AskOrder{MarketId: 97, ExternalId: "oneoneone"}), expected: &EventOrderCreated{ OrderId: 1, OrderType: "ask", + MarketId: 97, ExternalId: "oneoneone", }, }, { name: "order with bid", - order: NewOrder(2).WithBid(&BidOrder{ExternalId: "twotwotwo"}), + order: NewOrder(2).WithBid(&BidOrder{MarketId: 33, ExternalId: "twotwotwo"}), expected: &EventOrderCreated{ OrderId: 2, OrderType: "bid", + MarketId: 33, ExternalId: "twotwotwo", }, }, @@ -92,21 +98,23 @@ func TestNewEventOrderCancelled(t *testing.T) { }{ { name: "ask order", - order: NewOrder(11).WithAsk(&AskOrder{ExternalId: "an external identifier"}), + order: NewOrder(11).WithAsk(&AskOrder{MarketId: 71, ExternalId: "an external identifier"}), cancelledBy: sdk.AccAddress("CancelledBy_________"), expected: &EventOrderCancelled{ OrderId: 11, CancelledBy: sdk.AccAddress("CancelledBy_________").String(), + MarketId: 71, ExternalId: "an external identifier", }, }, { name: "bid order", - order: NewOrder(55).WithAsk(&AskOrder{ExternalId: "another external identifier"}), + order: NewOrder(55).WithAsk(&AskOrder{MarketId: 88, ExternalId: "another external identifier"}), cancelledBy: sdk.AccAddress("cancelled_by________"), expected: &EventOrderCancelled{ OrderId: 55, CancelledBy: sdk.AccAddress("cancelled_by________").String(), + MarketId: 88, ExternalId: "another external identifier", }, }, @@ -139,6 +147,7 @@ func TestNewEventOrderFilled(t *testing.T) { { name: "ask", order: NewOrder(4).WithAsk(&AskOrder{ + MarketId: 57, Assets: sdk.NewInt64Coin("apple", 22), Price: sdk.NewInt64Coin("plum", 18), SellerSettlementFlatFee: coinP("fig", 57), @@ -149,12 +158,14 @@ func TestNewEventOrderFilled(t *testing.T) { Assets: "22apple", Price: "18plum", Fees: "57fig", + MarketId: 57, ExternalId: "one", }, }, { name: "filled ask", order: NewFilledOrder(NewOrder(4).WithAsk(&AskOrder{ + MarketId: 1234, Assets: sdk.NewInt64Coin("apple", 22), Price: sdk.NewInt64Coin("plum", 18), SellerSettlementFlatFee: coinP("fig", 57), @@ -165,12 +176,14 @@ func TestNewEventOrderFilled(t *testing.T) { Assets: "22apple", Price: "88plum", Fees: "61fig,12grape", + MarketId: 1234, ExternalId: "two", }, }, { name: "bid", order: NewOrder(104).WithBid(&BidOrder{ + MarketId: 87878, Assets: sdk.NewInt64Coin("apple", 23), Price: sdk.NewInt64Coin("plum", 19), BuyerSettlementFees: sdk.NewCoins(sdk.NewInt64Coin("fig", 58)), @@ -181,12 +194,14 @@ func TestNewEventOrderFilled(t *testing.T) { Assets: "23apple", Price: "19plum", Fees: "58fig", + MarketId: 87878, ExternalId: "three", }, }, { name: "filled bid", order: NewFilledOrder(NewOrder(105).WithBid(&BidOrder{ + MarketId: 9119, Assets: sdk.NewInt64Coin("apple", 24), Price: sdk.NewInt64Coin("plum", 20), BuyerSettlementFees: sdk.NewCoins(sdk.NewInt64Coin("fig", 59)), @@ -197,6 +212,7 @@ func TestNewEventOrderFilled(t *testing.T) { Assets: "24apple", Price: "89plum", Fees: "62fig,13grape", + MarketId: 9119, ExternalId: "four", }, }, @@ -229,6 +245,7 @@ func TestNewEventOrderPartiallyFilled(t *testing.T) { { name: "ask", order: NewOrder(4).WithAsk(&AskOrder{ + MarketId: 432, Assets: sdk.NewInt64Coin("apple", 22), Price: sdk.NewInt64Coin("plum", 18), SellerSettlementFlatFee: coinP("fig", 57), @@ -239,12 +256,14 @@ func TestNewEventOrderPartiallyFilled(t *testing.T) { Assets: "22apple", Price: "18plum", Fees: "57fig", + MarketId: 432, ExternalId: "five", }, }, { name: "filled ask", order: NewFilledOrder(NewOrder(4).WithAsk(&AskOrder{ + MarketId: 456, Assets: sdk.NewInt64Coin("apple", 22), Price: sdk.NewInt64Coin("plum", 18), SellerSettlementFlatFee: coinP("fig", 57), @@ -255,12 +274,14 @@ func TestNewEventOrderPartiallyFilled(t *testing.T) { Assets: "22apple", Price: "88plum", Fees: "61fig,12grape", + MarketId: 456, ExternalId: "six", }, }, { name: "bid", order: NewOrder(104).WithBid(&BidOrder{ + MarketId: 765, Assets: sdk.NewInt64Coin("apple", 23), Price: sdk.NewInt64Coin("plum", 19), BuyerSettlementFees: sdk.NewCoins(sdk.NewInt64Coin("fig", 58)), @@ -271,12 +292,14 @@ func TestNewEventOrderPartiallyFilled(t *testing.T) { Assets: "23apple", Price: "19plum", Fees: "58fig", + MarketId: 765, ExternalId: "seven", }, }, { name: "filled bid", order: NewFilledOrder(NewOrder(104).WithBid(&BidOrder{ + MarketId: 818, Assets: sdk.NewInt64Coin("apple", 23), Price: sdk.NewInt64Coin("plum", 19), BuyerSettlementFees: sdk.NewCoins(sdk.NewInt64Coin("fig", 58)), @@ -287,6 +310,7 @@ func TestNewEventOrderPartiallyFilled(t *testing.T) { Assets: "23apple", Price: "89plum", Fees: "62fig,13grape", + MarketId: 818, ExternalId: "eight", }, }, @@ -313,17 +337,19 @@ func TestNewEventOrderExternalIDUpdated(t *testing.T) { }{ { name: "ask", - order: NewOrder(51).WithAsk(&AskOrder{ExternalId: "orange-red"}), + order: NewOrder(51).WithAsk(&AskOrder{MarketId: 9, ExternalId: "orange-red"}), expected: &EventOrderExternalIDUpdated{ OrderId: 51, + MarketId: 9, ExternalId: "orange-red", }, }, { name: "bid", - order: NewOrder(777).WithAsk(&AskOrder{ExternalId: "purple-purple"}), + order: NewOrder(777).WithAsk(&AskOrder{MarketId: 53, ExternalId: "purple-purple"}), expected: &EventOrderExternalIDUpdated{ OrderId: 777, + MarketId: 53, ExternalId: "purple-purple", }, }, @@ -600,11 +626,12 @@ func TestTypedEventToEvent(t *testing.T) { }{ { name: "EventOrderCreated ask", - tev: NewEventOrderCreated(NewOrder(1).WithAsk(&AskOrder{ExternalId: "stuff"})), + tev: NewEventOrderCreated(NewOrder(1).WithAsk(&AskOrder{MarketId: 88, ExternalId: "stuff"})), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderCreated", Attributes: []abci.EventAttribute{ {Key: []byte("external_id"), Value: quoteBz("stuff")}, + {Key: []byte("market_id"), Value: []byte("88")}, {Key: []byte("order_id"), Value: quoteBz("1")}, {Key: []byte("order_type"), Value: quoteBz("ask")}, }, @@ -612,11 +639,12 @@ func TestTypedEventToEvent(t *testing.T) { }, { name: "EventOrderCreated bid", - tev: NewEventOrderCreated(NewOrder(2).WithBid(&BidOrder{ExternalId: "something else"})), + tev: NewEventOrderCreated(NewOrder(2).WithBid(&BidOrder{MarketId: 77, ExternalId: "something else"})), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderCreated", Attributes: []abci.EventAttribute{ {Key: []byte("external_id"), Value: quoteBz("something else")}, + {Key: []byte("market_id"), Value: []byte("77")}, {Key: []byte("order_id"), Value: quoteBz("2")}, {Key: []byte("order_type"), Value: quoteBz("bid")}, }, @@ -624,24 +652,26 @@ func TestTypedEventToEvent(t *testing.T) { }, { name: "EventOrderCancelled ask", - tev: NewEventOrderCancelled(NewOrder(3).WithAsk(&AskOrder{ExternalId: "outside 8"}), cancelledBy), + tev: NewEventOrderCancelled(NewOrder(3).WithAsk(&AskOrder{MarketId: 66, ExternalId: "outside 8"}), cancelledBy), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderCancelled", Attributes: []abci.EventAttribute{ {Key: []byte("cancelled_by"), Value: cancelledByQ}, {Key: []byte("external_id"), Value: quoteBz("outside 8")}, + {Key: []byte("market_id"), Value: []byte("66")}, {Key: []byte("order_id"), Value: quoteBz("3")}, }, }, }, { name: "EventOrderCancelled bid", - tev: NewEventOrderCancelled(NewOrder(3).WithBid(&BidOrder{ExternalId: "outside 8"}), cancelledBy), + tev: NewEventOrderCancelled(NewOrder(3).WithBid(&BidOrder{MarketId: 55, ExternalId: "outside 8"}), cancelledBy), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderCancelled", Attributes: []abci.EventAttribute{ {Key: []byte("cancelled_by"), Value: cancelledByQ}, {Key: []byte("external_id"), Value: quoteBz("outside 8")}, + {Key: []byte("market_id"), Value: []byte("55")}, {Key: []byte("order_id"), Value: quoteBz("3")}, }, }, @@ -649,6 +679,7 @@ func TestTypedEventToEvent(t *testing.T) { { name: "EventOrderFilled ask", tev: NewEventOrderFilled(NewOrder(4).WithAsk(&AskOrder{ + MarketId: 33, Assets: acoin, Price: pcoin, SellerSettlementFlatFee: &fcoin, @@ -660,6 +691,7 @@ func TestTypedEventToEvent(t *testing.T) { {Key: []byte("assets"), Value: acoinQ}, {Key: []byte("external_id"), Value: quoteBz("eeeeiiiiiddddd")}, {Key: []byte("fees"), Value: fcoinQ}, + {Key: []byte("market_id"), Value: []byte("33")}, {Key: []byte("order_id"), Value: quoteBz("4")}, {Key: []byte("price"), Value: pcoinQ}, }, @@ -668,6 +700,7 @@ func TestTypedEventToEvent(t *testing.T) { { name: "EventOrderFilled bid", tev: NewEventOrderFilled(NewOrder(104).WithBid(&BidOrder{ + MarketId: 44, Assets: acoin, Price: pcoin, BuyerSettlementFees: sdk.Coins{fcoin}, @@ -679,6 +712,7 @@ func TestTypedEventToEvent(t *testing.T) { {Key: []byte("assets"), Value: acoinQ}, {Key: []byte("external_id"), Value: quoteBz("that one thing")}, {Key: []byte("fees"), Value: fcoinQ}, + {Key: []byte("market_id"), Value: []byte("44")}, {Key: []byte("order_id"), Value: quoteBz("104")}, {Key: []byte("price"), Value: pcoinQ}, }, @@ -687,6 +721,7 @@ func TestTypedEventToEvent(t *testing.T) { { name: "EventOrderPartiallyFilled ask", tev: NewEventOrderPartiallyFilled(NewOrder(5).WithAsk(&AskOrder{ + MarketId: 22, Assets: acoin, Price: pcoin, SellerSettlementFlatFee: &fcoin, @@ -698,6 +733,7 @@ func TestTypedEventToEvent(t *testing.T) { {Key: []byte("assets"), Value: acoinQ}, {Key: []byte("external_id"), Value: quoteBz("12345")}, {Key: []byte("fees"), Value: fcoinQ}, + {Key: []byte("market_id"), Value: []byte("22")}, {Key: []byte("order_id"), Value: quoteBz("5")}, {Key: []byte("price"), Value: pcoinQ}, }, @@ -706,6 +742,7 @@ func TestTypedEventToEvent(t *testing.T) { { name: "EventOrderPartiallyFilled bid", tev: NewEventOrderPartiallyFilled(NewOrder(5).WithBid(&BidOrder{ + MarketId: 11, Assets: acoin, Price: pcoin, BuyerSettlementFees: sdk.Coins{fcoin}, @@ -717,6 +754,7 @@ func TestTypedEventToEvent(t *testing.T) { {Key: []byte("assets"), Value: acoinQ}, {Key: []byte("external_id"), Value: quoteBz("67890")}, {Key: []byte("fees"), Value: fcoinQ}, + {Key: []byte("market_id"), Value: []byte("11")}, {Key: []byte("order_id"), Value: quoteBz("5")}, {Key: []byte("price"), Value: pcoinQ}, }, @@ -724,22 +762,24 @@ func TestTypedEventToEvent(t *testing.T) { }, { name: "EventOrderExternalIDUpdated ask", - tev: NewEventOrderExternalIDUpdated(NewOrder(8).WithAsk(&AskOrder{ExternalId: "yellow"})), + tev: NewEventOrderExternalIDUpdated(NewOrder(8).WithAsk(&AskOrder{MarketId: 99, ExternalId: "yellow"})), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderExternalIDUpdated", Attributes: []abci.EventAttribute{ {Key: []byte("external_id"), Value: quoteBz("yellow")}, + {Key: []byte("market_id"), Value: []byte("99")}, {Key: []byte("order_id"), Value: quoteBz("8")}, }, }, }, { name: "EventOrderExternalIDUpdated bid", - tev: NewEventOrderExternalIDUpdated(NewOrder(8).WithBid(&BidOrder{ExternalId: "yellow"})), + tev: NewEventOrderExternalIDUpdated(NewOrder(8).WithBid(&BidOrder{MarketId: 111, ExternalId: "yellow"})), expEvent: sdk.Event{ Type: "provenance.exchange.v1.EventOrderExternalIDUpdated", Attributes: []abci.EventAttribute{ {Key: []byte("external_id"), Value: quoteBz("yellow")}, + {Key: []byte("market_id"), Value: []byte("111")}, {Key: []byte("order_id"), Value: quoteBz("8")}, }, },