diff --git a/proto/elys/amm/tx.proto b/proto/elys/amm/tx.proto index 878b1c6d9..f6e547df4 100644 --- a/proto/elys/amm/tx.proto +++ b/proto/elys/amm/tx.proto @@ -81,15 +81,22 @@ message MsgFeedMultipleExternalLiquidity { } message MsgFeedMultipleExternalLiquidityResponse {} -// ExternalLiquidity defines price, volume, and time information for an exchange rate. -message ExternalLiquidity { - uint64 poolId = 1; - repeated cosmos.base.v1beta1.DecCoin amounts = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" +message AssetAmountDepth { + string asset = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false ]; string depth = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; } + +// ExternalLiquidity defines price, volume, and time information for an exchange rate. +message ExternalLiquidity { + uint64 poolId = 1; + repeated AssetAmountDepth amountDepthInfo = 2 [ + (gogoproto.nullable) = false + ]; +} diff --git a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go index cdf8260c9..5f6193ec3 100644 --- a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go +++ b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go @@ -9,18 +9,20 @@ import ( oracletypes "github.com/elys-network/elys/x/oracle/types" ) -func AssetsValue(ctx sdk.Context, oracleKeeper types.OracleKeeper, elCoins sdk.DecCoins) (sdk.Dec, error) { +func AssetsValue(ctx sdk.Context, oracleKeeper types.OracleKeeper, amountDepthInfo []types.AssetAmountDepth) (sdk.Dec, sdk.Dec, error) { totalValue := sdk.ZeroDec() - for _, asset := range elCoins { - price, found := oracleKeeper.GetAssetPrice(ctx, asset.Denom) + totalDepth := sdk.ZeroDec() + for _, asset := range amountDepthInfo { + price, found := oracleKeeper.GetAssetPrice(ctx, asset.Asset) if !found { - return sdk.ZeroDec(), fmt.Errorf("asset price not set: %s", asset.Denom) + return sdk.ZeroDec(), sdk.ZeroDec(), fmt.Errorf("asset price not set: %s", asset.Asset) } else { v := price.Price.Mul(asset.Amount) totalValue = totalValue.Add(v) } + totalDepth = totalDepth.Add(asset.Depth) } - return totalValue, nil + return totalValue, totalDepth, nil } func LiquidityRatioFromPriceDepth(depth sdk.Dec) sdk.Dec { @@ -57,18 +59,13 @@ func (k msgServer) FeedMultipleExternalLiquidity(goCtx context.Context, msg *typ return nil, err } - elValue, err := AssetsValue(ctx, k.oracleKeeper, el.Amounts) + elValue, elDepth, err := AssetsValue(ctx, k.oracleKeeper, el.AmountDepthInfo) if err != nil { return nil, err } - fmt.Println("tvl", tvl.String()) - fmt.Println("elValue", elValue.String()) - elRatio := elValue.Quo(tvl) - fmt.Println("elRatio1", elRatio.String(), el.Depth) - elRatio = elRatio.Quo(LiquidityRatioFromPriceDepth(el.Depth)) - fmt.Println("elRatio2", elRatio.String()) + elRatio = elRatio.Quo(LiquidityRatioFromPriceDepth(elDepth)) if elRatio.LT(sdk.OneDec()) { elRatio = sdk.OneDec() } diff --git a/x/amm/types/tx.pb.go b/x/amm/types/tx.pb.go index 9de0ab532..4cc4a4ed2 100644 --- a/x/amm/types/tx.pb.go +++ b/x/amm/types/tx.pb.go @@ -639,18 +639,63 @@ func (m *MsgFeedMultipleExternalLiquidityResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFeedMultipleExternalLiquidityResponse proto.InternalMessageInfo +type AssetAmountDepth struct { + Asset string `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` + Depth github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=depth,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"depth"` +} + +func (m *AssetAmountDepth) Reset() { *m = AssetAmountDepth{} } +func (m *AssetAmountDepth) String() string { return proto.CompactTextString(m) } +func (*AssetAmountDepth) ProtoMessage() {} +func (*AssetAmountDepth) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7ddafd861f6b7f, []int{12} +} +func (m *AssetAmountDepth) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AssetAmountDepth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AssetAmountDepth.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 *AssetAmountDepth) XXX_Merge(src proto.Message) { + xxx_messageInfo_AssetAmountDepth.Merge(m, src) +} +func (m *AssetAmountDepth) XXX_Size() int { + return m.Size() +} +func (m *AssetAmountDepth) XXX_DiscardUnknown() { + xxx_messageInfo_AssetAmountDepth.DiscardUnknown(m) +} + +var xxx_messageInfo_AssetAmountDepth proto.InternalMessageInfo + +func (m *AssetAmountDepth) GetAsset() string { + if m != nil { + return m.Asset + } + return "" +} + // ExternalLiquidity defines price, volume, and time information for an exchange rate. type ExternalLiquidity struct { - PoolId uint64 `protobuf:"varint,1,opt,name=poolId,proto3" json:"poolId,omitempty"` - Amounts github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=amounts,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"amounts"` - Depth github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=depth,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"depth"` + PoolId uint64 `protobuf:"varint,1,opt,name=poolId,proto3" json:"poolId,omitempty"` + AmountDepthInfo []AssetAmountDepth `protobuf:"bytes,2,rep,name=amountDepthInfo,proto3" json:"amountDepthInfo"` } func (m *ExternalLiquidity) Reset() { *m = ExternalLiquidity{} } func (m *ExternalLiquidity) String() string { return proto.CompactTextString(m) } func (*ExternalLiquidity) ProtoMessage() {} func (*ExternalLiquidity) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7ddafd861f6b7f, []int{12} + return fileDescriptor_ed7ddafd861f6b7f, []int{13} } func (m *ExternalLiquidity) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -686,9 +731,9 @@ func (m *ExternalLiquidity) GetPoolId() uint64 { return 0 } -func (m *ExternalLiquidity) GetAmounts() github_com_cosmos_cosmos_sdk_types.DecCoins { +func (m *ExternalLiquidity) GetAmountDepthInfo() []AssetAmountDepth { if m != nil { - return m.Amounts + return m.AmountDepthInfo } return nil } @@ -706,70 +751,72 @@ func init() { proto.RegisterType((*MsgSwapExactAmountOutResponse)(nil), "elys.amm.MsgSwapExactAmountOutResponse") proto.RegisterType((*MsgFeedMultipleExternalLiquidity)(nil), "elys.amm.MsgFeedMultipleExternalLiquidity") proto.RegisterType((*MsgFeedMultipleExternalLiquidityResponse)(nil), "elys.amm.MsgFeedMultipleExternalLiquidityResponse") + proto.RegisterType((*AssetAmountDepth)(nil), "elys.amm.AssetAmountDepth") proto.RegisterType((*ExternalLiquidity)(nil), "elys.amm.ExternalLiquidity") } func init() { proto.RegisterFile("elys/amm/tx.proto", fileDescriptor_ed7ddafd861f6b7f) } var fileDescriptor_ed7ddafd861f6b7f = []byte{ - // 901 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0xdc, 0x44, - 0x14, 0x8e, 0x37, 0xdb, 0x4d, 0xfa, 0x42, 0x10, 0x71, 0xd3, 0xb2, 0x35, 0x8d, 0x37, 0x32, 0xa8, - 0xac, 0x8a, 0x6a, 0xab, 0x29, 0x97, 0x00, 0x12, 0x74, 0xb3, 0xa9, 0xb4, 0x08, 0x2b, 0x91, 0xa9, - 0x38, 0x14, 0x44, 0xe5, 0xec, 0x8e, 0x1c, 0x2b, 0xeb, 0x19, 0xe3, 0x19, 0x37, 0x1b, 0x71, 0x00, - 0x21, 0xee, 0x70, 0xe4, 0x27, 0x20, 0x7e, 0x49, 0x8f, 0x3d, 0xa2, 0x1e, 0x02, 0x4a, 0xfe, 0x08, - 0x9a, 0xf1, 0x8c, 0x63, 0xc7, 0xce, 0x76, 0x59, 0x38, 0xed, 0x7a, 0xde, 0xfb, 0xbe, 0x37, 0xef, - 0xfb, 0x66, 0x9e, 0x0d, 0x6b, 0x68, 0x7c, 0x42, 0x1d, 0x3f, 0x8a, 0x1c, 0x36, 0xb1, 0xe3, 0x84, - 0x30, 0xa2, 0x2f, 0xf3, 0x25, 0xdb, 0x8f, 0x22, 0x63, 0x3d, 0x20, 0x01, 0x11, 0x8b, 0x0e, 0xff, - 0x97, 0xc5, 0x0d, 0x73, 0x48, 0x68, 0x44, 0xa8, 0x73, 0xe0, 0x53, 0xe4, 0x3c, 0x7f, 0x70, 0x80, - 0x98, 0xff, 0xc0, 0x19, 0x92, 0x10, 0xcb, 0xf8, 0xed, 0x9c, 0x92, 0x1e, 0xfb, 0xf1, 0xb3, 0x84, - 0xa4, 0x0c, 0xc9, 0x90, 0x91, 0x87, 0x62, 0x42, 0xc6, 0xcf, 0x62, 0x3f, 0xf1, 0x23, 0x5a, 0x81, - 0x89, 0x98, 0x4f, 0x29, 0x62, 0x59, 0xc8, 0xfa, 0x4d, 0x83, 0x55, 0x97, 0x06, 0x3b, 0x09, 0xf2, - 0x19, 0xda, 0x27, 0x64, 0xac, 0xdf, 0x82, 0x16, 0x45, 0x78, 0x84, 0x92, 0xb6, 0xb6, 0xa9, 0x75, - 0xaf, 0x7b, 0xf2, 0x49, 0xff, 0x10, 0x80, 0xa3, 0xf7, 0x05, 0x71, 0xbb, 0xb1, 0xa9, 0x75, 0x57, - 0xb6, 0xd6, 0x6d, 0xd5, 0x90, 0xbd, 0x9f, 0xc7, 0xbc, 0x42, 0x9e, 0xbe, 0x9d, 0xa1, 0x1e, 0xf1, - 0x92, 0xb4, 0xbd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7f, 0x0d, 0x6b, 0xd5, 0xa1, 0x6a, 0x96, 0x30, 0x95, 0xb8, 0x71, 0x77, 0x7a, - 0x3c, 0x27, 0xff, 0x16, 0xf4, 0x9a, 0xa1, 0xd1, 0x99, 0x86, 0xde, 0x4b, 0x99, 0xf1, 0xfe, 0x6b, - 0x12, 0x72, 0xfe, 0x1f, 0x60, 0x63, 0xfa, 0xbd, 0xb8, 0x57, 0x62, 0x9a, 0x9a, 0x6b, 0x6c, 0xcd, - 0x9e, 0xab, 0x36, 0xd0, 0xeb, 0xbd, 0x38, 0x33, 0xb5, 0x97, 0x67, 0xa6, 0xf6, 0xf7, 0x99, 0xa9, - 0xfd, 0x7a, 0x6e, 0x2e, 0xbc, 0x3c, 0x37, 0x17, 0xfe, 0x3c, 0x37, 0x17, 0x9e, 0x76, 0x0b, 0x47, - 0x8b, 0xf3, 0xde, 0xc7, 0x88, 0x1d, 0x93, 0xe4, 0x48, 0x3c, 0x38, 0x93, 0xec, 0x3b, 0x99, 0x1f, - 0xb0, 0x83, 0x96, 0xf8, 0x32, 0x7d, 0xf8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xe7, 0xbc, - 0x16, 0x40, 0x0b, 0x00, 0x00, + // 924 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x3a, 0x8e, 0x9b, 0xbe, 0x10, 0x68, 0xa6, 0x69, 0x71, 0x97, 0xc6, 0x8e, 0x16, 0x54, + 0xac, 0x4a, 0xdd, 0x55, 0x03, 0x97, 0x00, 0x12, 0xd4, 0x71, 0x22, 0xb9, 0xc2, 0x4a, 0xb4, 0x54, + 0x1c, 0x0a, 0xa2, 0x9a, 0xd8, 0x83, 0xb3, 0x8a, 0x77, 0x66, 0xd9, 0x99, 0x6d, 0x1c, 0x71, 0x00, + 0x21, 0xee, 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0x96, 0xcd, 0xad, 0x89, 0xcb, 0x59, 0x86, 0xf4, + 0xea, 0xca, 0x33, 0x24, 0xcb, 0x63, 0x0c, 0x85, 0x31, 0xff, 0x0d, 0x6c, 0x14, 0xa7, 0x74, 0x2d, + 0x87, 0x29, 0xd8, 0xcd, 0x7b, 0xb3, 0xed, 0x29, 0xf9, 0x77, 0x80, 0x26, 0x4c, 0xa1, 0xfa, 0x2c, + 0xf4, 0x61, 0x24, 0xcc, 0x0f, 0x5f, 0xe3, 0x90, 0xf2, 0xff, 0x04, 0x5b, 0xb3, 0x0f, 0xda, 0xfd, + 0x1c, 0xd3, 0x4c, 0x5f, 0x73, 0x67, 0x7e, 0xdf, 0x24, 0x81, 0x66, 0xf3, 0xc5, 0x65, 0xcd, 0x78, + 0x79, 0x59, 0x33, 0xfe, 0xb9, 0xac, 0x19, 0xbf, 0x5f, 0xd5, 0x96, 0x5e, 0x5e, 0xd5, 0x96, 0xfe, + 0xbe, 0xaa, 0x2d, 0x3d, 0x6d, 0x64, 0xf6, 0xb4, 0xe4, 0x7d, 0x40, 0x89, 0x38, 0x63, 0xe1, 0xa9, + 0xfa, 0x70, 0x86, 0xf1, 0xc3, 0x5b, 0xee, 0xec, 0xe3, 0x8a, 0x7a, 0xea, 0x7e, 0xf4, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe9, 0x6b, 0x9f, 0x9d, 0x91, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1586,7 +1633,7 @@ func (m *MsgFeedMultipleExternalLiquidityResponse) MarshalToSizedBuffer(dAtA []b return len(dAtA) - i, nil } -func (m *ExternalLiquidity) Marshal() (dAtA []byte, err error) { +func (m *AssetAmountDepth) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1596,12 +1643,12 @@ func (m *ExternalLiquidity) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ExternalLiquidity) MarshalTo(dAtA []byte) (int, error) { +func (m *AssetAmountDepth) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ExternalLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AssetAmountDepth) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1616,10 +1663,50 @@ func (m *ExternalLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - if len(m.Amounts) > 0 { - for iNdEx := len(m.Amounts) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Asset) > 0 { + i -= len(m.Asset) + copy(dAtA[i:], m.Asset) + i = encodeVarintTx(dAtA, i, uint64(len(m.Asset))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExternalLiquidity) 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 *ExternalLiquidity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExternalLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AmountDepthInfo) > 0 { + for iNdEx := len(m.AmountDepthInfo) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Amounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.AmountDepthInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1864,6 +1951,23 @@ func (m *MsgFeedMultipleExternalLiquidityResponse) Size() (n int) { return n } +func (m *AssetAmountDepth) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Asset) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Depth.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + func (m *ExternalLiquidity) Size() (n int) { if m == nil { return 0 @@ -1873,14 +1977,12 @@ func (m *ExternalLiquidity) Size() (n int) { if m.PoolId != 0 { n += 1 + sovTx(uint64(m.PoolId)) } - if len(m.Amounts) > 0 { - for _, e := range m.Amounts { + if len(m.AmountDepthInfo) > 0 { + for _, e := range m.AmountDepthInfo { l = e.Size() n += 1 + l + sovTx(uint64(l)) } } - l = m.Depth.Size() - n += 1 + l + sovTx(uint64(l)) return n } @@ -3383,7 +3485,7 @@ func (m *MsgFeedMultipleExternalLiquidityResponse) Unmarshal(dAtA []byte) error } return nil } -func (m *ExternalLiquidity) Unmarshal(dAtA []byte) error { +func (m *AssetAmountDepth) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3406,17 +3508,17 @@ func (m *ExternalLiquidity) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExternalLiquidity: wiretype end group for non-group") + return fmt.Errorf("proto: AssetAmountDepth: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AssetAmountDepth: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType) } - m.PoolId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3426,16 +3528,29 @@ func (m *ExternalLiquidity) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Asset = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amounts", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3445,23 +3560,23 @@ func (m *ExternalLiquidity) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amounts = append(m.Amounts, types.DecCoin{}) - if err := m.Amounts[len(m.Amounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3520,6 +3635,109 @@ func (m *ExternalLiquidity) Unmarshal(dAtA []byte) error { } return nil } +func (m *ExternalLiquidity) 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 ErrIntOverflowTx + } + 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: ExternalLiquidity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExternalLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountDepthInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AmountDepthInfo = append(m.AmountDepthInfo, AssetAmountDepth{}) + if err := m.AmountDepthInfo[len(m.AmountDepthInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0