diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 1b0c5ef0..ae08da19 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,6 +1,6 @@ -* [About Sge Network](README.md) +* [About Sge Network](../README.md) * [Modules](specs/README.md) * [Bet](specs/Bet/01_Overview.md) * [OVM](specs/OVM/01_Overview.md) diff --git a/docs/specs/Bet/_sidebar.md b/docs/specs/Bet/_sidebar.md index ed370861..f6d46db5 100644 --- a/docs/specs/Bet/_sidebar.md +++ b/docs/specs/Bet/_sidebar.md @@ -1,6 +1,7 @@ -* [About SGE Network](../../README.md) +* [Home](/) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [Overview](../Bet/01_Overview.md) diff --git a/docs/specs/House/_sidebar.md b/docs/specs/House/_sidebar.md index dc8571c3..7389d733 100644 --- a/docs/specs/House/_sidebar.md +++ b/docs/specs/House/_sidebar.md @@ -1,7 +1,7 @@ * [Home](/) -* [About SGE Network](../README.md) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [OVM](../OVM/01_Overview.md) diff --git a/docs/specs/Market/_sidebar.md b/docs/specs/Market/_sidebar.md index 9cfa2b47..3e9f4566 100644 --- a/docs/specs/Market/_sidebar.md +++ b/docs/specs/Market/_sidebar.md @@ -1,7 +1,7 @@ * [Home](/) -* [About SGE Network](../README.md) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [OVM](../OVM/01_Overview.md) diff --git a/docs/specs/Mint/_sidebar.md b/docs/specs/Mint/_sidebar.md index f24225cf..726087fd 100644 --- a/docs/specs/Mint/_sidebar.md +++ b/docs/specs/Mint/_sidebar.md @@ -1,6 +1,7 @@ -* [About SGE Network](../../README.md) +* [Home](/) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [OVM](../OVM/01_Overview.md) diff --git a/docs/specs/OVM/_sidebar.md b/docs/specs/OVM/_sidebar.md index ea4474d0..2170f2b0 100644 --- a/docs/specs/OVM/_sidebar.md +++ b/docs/specs/OVM/_sidebar.md @@ -1,6 +1,7 @@ -* [About SGE Network](../../README.md) +* [Home](/) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [OVM](../OVM/01_Overview.md) diff --git a/docs/specs/OrderBook/_sidebar.md b/docs/specs/OrderBook/_sidebar.md index ebe159ca..bbb614b5 100644 --- a/docs/specs/OrderBook/_sidebar.md +++ b/docs/specs/OrderBook/_sidebar.md @@ -1,7 +1,7 @@ * [Home](/) -* [About SGE Network](../README.md) +* [About SGE Network](../../../README.md) * [Modules](../README.md) * [Bet](../Bet/01_Overview.md) * [OVM](../OVM/01_Overview.md) diff --git a/docs/specs/_sidebar.md b/docs/specs/_sidebar.md index d9b08da5..b9881af5 100644 --- a/docs/specs/_sidebar.md +++ b/docs/specs/_sidebar.md @@ -1,6 +1,6 @@ -* [About SGE Network](../README.md) +* [About Sge Network](../../README.md) * [Modules](README.md) * [Bet](Bet/01_Overview.md) * [OVM](OVM/01_Overview.md) diff --git a/proto/sge/orderbook/orderbookevent.proto b/proto/sge/orderbook/orderbookevent.proto deleted file mode 100644 index 555d3ac9..00000000 --- a/proto/sge/orderbook/orderbookevent.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package sgenetwork.sge.orderbook; - -import "sge/orderbook/exposure.proto"; - -option go_package = "github.com/sge-network/sge/x/orderbook/types"; - -// OrderBookEvent to publish the order book event -message OrderBookEvent { - - // ParticipationExposure to publish the order book event, participation - // exposure - repeated ParticipationExposure participation_exposure = 1; - - // OrderBookOddsExposure to publish the order book event, order book odds - // exposure - repeated OrderBookOddsExposure order_book_odds_exposure = 2; -} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 20cf6de7..4bb1d5d4 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -3,7 +3,7 @@ set -eo pipefail # get protoc executions -go get github.com/cosmos/gogoproto@v1.4.10 2>/dev/null +go get github.com/cosmos/gogoproto@v1.4.11 2>/dev/null # get cosmos sdk from github go get github.com/cosmos/cosmos-sdk@v0.46.14 2>/dev/null diff --git a/x/bet/types/expected_keepers.go b/x/bet/types/expected_keepers.go index 0a4514f5..d4296dac 100644 --- a/x/bet/types/expected_keepers.go +++ b/x/bet/types/expected_keepers.go @@ -73,5 +73,4 @@ type OrderbookKeeper interface { ) error SetOrderBookAsUnsettledResolved(ctx sdk.Context, orderBookUID string) error WithdrawBetFee(ctx sdk.Context, marketCreator sdk.AccAddress, betFee sdkmath.Int) error - PublishOrderBookEvent(ctx sdk.Context, orderBookUID string) } diff --git a/x/house/keeper/deposit.go b/x/house/keeper/deposit.go index 2661b6d9..17e192eb 100644 --- a/x/house/keeper/deposit.go +++ b/x/house/keeper/deposit.go @@ -79,7 +79,5 @@ func (k Keeper) Deposit(ctx sdk.Context, creator, depositor string, k.SetDeposit(ctx, deposit) - k.orderbookKeeper.PublishOrderBookEvent(ctx, marketUID) - return participationIndex, err } diff --git a/x/house/keeper/withdrawal.go b/x/house/keeper/withdrawal.go index bafdad0e..5223e7f5 100644 --- a/x/house/keeper/withdrawal.go +++ b/x/house/keeper/withdrawal.go @@ -95,7 +95,5 @@ func (k Keeper) Withdraw( deposit.TotalWithdrawalAmount = deposit.TotalWithdrawalAmount.Add(withdrawableAmount) k.SetDeposit(ctx, deposit) - k.orderbookKeeper.PublishOrderBookEvent(ctx, marketUID) - return withdrawalID, nil } diff --git a/x/house/types/expected_keepers.go b/x/house/types/expected_keepers.go index 08da49b0..84f8db57 100644 --- a/x/house/types/expected_keepers.go +++ b/x/house/types/expected_keepers.go @@ -20,7 +20,6 @@ type OrderbookKeeper interface { WithdrawOrderBookParticipation(ctx sdk.Context, marketUID string, participationIndex uint64, amount sdkmath.Int, ) error - PublishOrderBookEvent(ctx sdk.Context, orderBookUID string) } // OVMKeeper defines the expected interface needed to verify ticket and unmarshal it diff --git a/x/orderbook/keeper/bet_wager.go b/x/orderbook/keeper/bet_wager.go index a78b5dac..33818a01 100644 --- a/x/orderbook/keeper/bet_wager.go +++ b/x/orderbook/keeper/bet_wager.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -71,31 +69,8 @@ func (k Keeper) ProcessWager( if err := k.fund(types.OrderBookLiquidityFunder{}, ctx, bettorAddress, fInfo.fulfilledBetAmount); err != nil { return nil, err } - k.PublishOrderBookEvent(ctx, bookUID) - return fInfo.fulfillments, nil -} - -func (k Keeper) PublishOrderBookEvent(ctx sdk.Context, orderBookUID string) { - event := types.NewOrderBookEvent() - boes, err := k.GetOddsExposuresByOrderBook(ctx, orderBookUID) - if err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Error in publishing order book event error: %s", err)) - return - } - for _, boe := range boes { - event.AddOrderBookOddsExposure(boe) - pes, err := k.GetExposureByOrderBookAndOdds(ctx, orderBookUID, boe.OddsUID) - if err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Error in publishing order book event error: %s", err)) - return - } - for _, pe := range pes { - event.AddParticipationExposure(pe) - } - } - - event.Emit(ctx) + return fInfo.fulfillments, nil } // fulfillBetByParticipationQueue fulfills the bet wagering payout using the participations diff --git a/x/orderbook/keeper/exposure_odds.go b/x/orderbook/keeper/exposure_odds.go index efd3bc64..9feff83f 100644 --- a/x/orderbook/keeper/exposure_odds.go +++ b/x/orderbook/keeper/exposure_odds.go @@ -82,14 +82,12 @@ func (k Keeper) initParticipationExposures( ) error { // Update book odds exposures and add participant exposures boes, err := k.GetOddsExposuresByOrderBook(ctx, orderBookUID) - bookEvent := types.NewOrderBookEvent() if err != nil { return err } for _, boe := range boes { boe.FulfillmentQueue = append(boe.FulfillmentQueue, participationIndex) k.SetOrderBookOddsExposure(ctx, boe) - bookEvent.AddOrderBookOddsExposure(boe) pe := types.NewParticipationExposure( orderBookUID, @@ -101,9 +99,7 @@ func (k Keeper) initParticipationExposures( false, ) k.SetParticipationExposure(ctx, pe) - bookEvent.AddParticipationExposure(pe) } - bookEvent.Emit(ctx) return nil } diff --git a/x/orderbook/keeper/orderbook_settle.go b/x/orderbook/keeper/orderbook_settle.go index 6e384c84..5cc348cd 100644 --- a/x/orderbook/keeper/orderbook_settle.go +++ b/x/orderbook/keeper/orderbook_settle.go @@ -47,6 +47,9 @@ func (k Keeper) BatchOrderBookSettlements(ctx sdk.Context) error { // we need to remove its uid from the list of unsettled resolved orderbooks. if allSettled { k.RemoveUnsettledResolvedOrderBook(ctx, orderBookUID) + + book.Status = types.OrderBookStatus_ORDER_BOOK_STATUS_STATUS_SETTLED + k.SetOrderBook(ctx, book) } return nil diff --git a/x/orderbook/types/events.go b/x/orderbook/types/events.go deleted file mode 100644 index f4f828d5..00000000 --- a/x/orderbook/types/events.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -const ( - AttributeKeyFeeGrantCreator = "feegrant_creator" - AttributeKeyGrantee = "grantee" - AttributeKeyCategoryOrderBookEvent = "order_book" - EventTypeOrderbook = "order_book_event" - AttributeOrderBookEvent = "order_book_event" -) diff --git a/x/orderbook/types/order_book_event.go b/x/orderbook/types/order_book_event.go deleted file mode 100644 index bf121c92..00000000 --- a/x/orderbook/types/order_book_event.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sge-network/sge/utils" -) - -func NewOrderBookEvent() OrderBookEvent { - return OrderBookEvent{ - ParticipationExposure: []*ParticipationExposure{}, - OrderBookOddsExposure: []*OrderBookOddsExposure{}, - } -} - -func (obe *OrderBookEvent) AddParticipationExposure(pe ParticipationExposure) { - obe.ParticipationExposure = append(obe.ParticipationExposure, &pe) -} - -func (obe *OrderBookEvent) AddOrderBookOddsExposure(boe OrderBookOddsExposure) { - obe.OrderBookOddsExposure = append(obe.OrderBookOddsExposure, &boe) -} - -func (obe *OrderBookEvent) Emit(ctx sdk.Context) { - emitter := utils.NewEventEmitter(&ctx, AttributeKeyCategoryOrderBookEvent) - emitter.AddEvent(EventTypeOrderbook, - sdk.NewAttribute(AttributeOrderBookEvent, obe.String()), - ) - emitter.Emit() -} diff --git a/x/orderbook/types/orderbookevent.pb.go b/x/orderbook/types/orderbookevent.pb.go deleted file mode 100644 index 2e568798..00000000 --- a/x/orderbook/types/orderbookevent.pb.go +++ /dev/null @@ -1,399 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: sge/orderbook/orderbookevent.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// OrderBookEvent to publish the order book event -type OrderBookEvent struct { - // ParticipationExposure to publish the order book event, participation - // exposure - ParticipationExposure []*ParticipationExposure `protobuf:"bytes,1,rep,name=participation_exposure,json=participationExposure,proto3" json:"participation_exposure,omitempty"` - // OrderBookOddsExposure to publish the order book event, order book odds - // exposure - OrderBookOddsExposure []*OrderBookOddsExposure `protobuf:"bytes,2,rep,name=order_book_odds_exposure,json=orderBookOddsExposure,proto3" json:"order_book_odds_exposure,omitempty"` -} - -func (m *OrderBookEvent) Reset() { *m = OrderBookEvent{} } -func (m *OrderBookEvent) String() string { return proto.CompactTextString(m) } -func (*OrderBookEvent) ProtoMessage() {} -func (*OrderBookEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_c2964b6b825b1bad, []int{0} -} -func (m *OrderBookEvent) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OrderBookEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OrderBookEvent.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *OrderBookEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderBookEvent.Merge(m, src) -} -func (m *OrderBookEvent) XXX_Size() int { - return m.Size() -} -func (m *OrderBookEvent) XXX_DiscardUnknown() { - xxx_messageInfo_OrderBookEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderBookEvent proto.InternalMessageInfo - -func (m *OrderBookEvent) GetParticipationExposure() []*ParticipationExposure { - if m != nil { - return m.ParticipationExposure - } - return nil -} - -func (m *OrderBookEvent) GetOrderBookOddsExposure() []*OrderBookOddsExposure { - if m != nil { - return m.OrderBookOddsExposure - } - return nil -} - -func init() { - proto.RegisterType((*OrderBookEvent)(nil), "sgenetwork.sge.orderbook.OrderBookEvent") -} - -func init() { - proto.RegisterFile("sge/orderbook/orderbookevent.proto", fileDescriptor_c2964b6b825b1bad) -} - -var fileDescriptor_c2964b6b825b1bad = []byte{ - // 238 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x4e, 0x4f, 0xd5, - 0xcf, 0x2f, 0x4a, 0x49, 0x2d, 0x4a, 0xca, 0xcf, 0xcf, 0x46, 0xb0, 0x52, 0xcb, 0x52, 0xf3, 0x4a, - 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x24, 0x8a, 0xd3, 0x53, 0xf3, 0x52, 0x4b, 0xca, 0xf3, - 0x8b, 0xb2, 0xf5, 0x8a, 0xd3, 0x53, 0xf5, 0xe0, 0x8a, 0xa4, 0x64, 0x50, 0x75, 0xa7, 0x56, 0x14, - 0xe4, 0x17, 0x97, 0x16, 0xa5, 0x42, 0xf4, 0x29, 0x3d, 0x62, 0xe4, 0xe2, 0xf3, 0x07, 0x49, 0x3a, - 0xe5, 0xe7, 0x67, 0xbb, 0x82, 0x0c, 0x14, 0x4a, 0xe3, 0x12, 0x2b, 0x48, 0x2c, 0x2a, 0xc9, 0x4c, - 0xce, 0x2c, 0x48, 0x2c, 0xc9, 0xcc, 0xcf, 0x8b, 0x87, 0x69, 0x91, 0x60, 0x54, 0x60, 0xd6, 0xe0, - 0x36, 0xd2, 0xd7, 0xc3, 0x65, 0x97, 0x5e, 0x00, 0xb2, 0x3e, 0x57, 0xa8, 0xb6, 0x20, 0xd1, 0x02, - 0x6c, 0xc2, 0x42, 0x19, 0x5c, 0x12, 0x60, 0x9d, 0xf1, 0x20, 0xad, 0xf1, 0xf9, 0x29, 0x29, 0xc5, - 0x08, 0x9b, 0x98, 0x08, 0xd9, 0x04, 0x77, 0xb3, 0x7f, 0x4a, 0x4a, 0x31, 0xc2, 0xa6, 0x7c, 0x6c, - 0xc2, 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, - 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x93, 0x9e, - 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x5f, 0x9c, 0x9e, 0xaa, 0x0b, 0xb5, 0x0c, - 0xc4, 0xd6, 0xaf, 0x40, 0x0a, 0xb5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x98, 0x19, - 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x64, 0x80, 0x35, 0x91, 0x01, 0x00, 0x00, -} - -func (m *OrderBookEvent) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OrderBookEvent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OrderBookEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OrderBookOddsExposure) > 0 { - for iNdEx := len(m.OrderBookOddsExposure) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OrderBookOddsExposure[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintOrderbookevent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.ParticipationExposure) > 0 { - for iNdEx := len(m.ParticipationExposure) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ParticipationExposure[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintOrderbookevent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintOrderbookevent(dAtA []byte, offset int, v uint64) int { - offset -= sovOrderbookevent(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *OrderBookEvent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ParticipationExposure) > 0 { - for _, e := range m.ParticipationExposure { - l = e.Size() - n += 1 + l + sovOrderbookevent(uint64(l)) - } - } - if len(m.OrderBookOddsExposure) > 0 { - for _, e := range m.OrderBookOddsExposure { - l = e.Size() - n += 1 + l + sovOrderbookevent(uint64(l)) - } - } - return n -} - -func sovOrderbookevent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozOrderbookevent(x uint64) (n int) { - return sovOrderbookevent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *OrderBookEvent) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OrderBookEvent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OrderBookEvent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParticipationExposure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOrderbookevent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOrderbookevent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParticipationExposure = append(m.ParticipationExposure, &ParticipationExposure{}) - if err := m.ParticipationExposure[len(m.ParticipationExposure)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderBookOddsExposure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOrderbookevent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOrderbookevent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderBookOddsExposure = append(m.OrderBookOddsExposure, &OrderBookOddsExposure{}) - if err := m.OrderBookOddsExposure[len(m.OrderBookOddsExposure)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipOrderbookevent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthOrderbookevent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipOrderbookevent(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOrderbookevent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthOrderbookevent - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupOrderbookevent - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthOrderbookevent - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthOrderbookevent = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOrderbookevent = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupOrderbookevent = fmt.Errorf("proto: unexpected end of group") -)