From e7497aaffab2e95e3920423374fce968f4bbbadd Mon Sep 17 00:00:00 2001 From: Dzung Do Date: Thu, 26 Sep 2024 00:55:38 +0700 Subject: [PATCH] declare proposal types --- proto/realionetwork/asset/v1/proposal.proto | 31 + x/asset/keeper/proposal.go | 1 + x/asset/types/keys.go | 2 + x/asset/types/proposal.go | 106 ++++ x/asset/types/proposal.pb.go | 657 ++++++++++++++++++++ 5 files changed, 797 insertions(+) create mode 100644 proto/realionetwork/asset/v1/proposal.proto create mode 100644 x/asset/keeper/proposal.go create mode 100644 x/asset/types/proposal.go create mode 100644 x/asset/types/proposal.pb.go diff --git a/proto/realionetwork/asset/v1/proposal.proto b/proto/realionetwork/asset/v1/proposal.proto new file mode 100644 index 00000000..c84b9294 --- /dev/null +++ b/proto/realionetwork/asset/v1/proposal.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package realionetwork.asset.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/realiotech/realio-network/x/asset/types"; + +message AddTokenManager { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + + string title = 1; + string description = 2; + string manager_address = 3; +} + +message RemoveTokenManager { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + + string title = 1; + string description = 2; + string manager_address = 3; +} + diff --git a/x/asset/keeper/proposal.go b/x/asset/keeper/proposal.go new file mode 100644 index 00000000..d810a5e6 --- /dev/null +++ b/x/asset/keeper/proposal.go @@ -0,0 +1 @@ +package keeper \ No newline at end of file diff --git a/x/asset/types/keys.go b/x/asset/types/keys.go index 587c1096..980e0180 100644 --- a/x/asset/types/keys.go +++ b/x/asset/types/keys.go @@ -35,4 +35,6 @@ var ( PrivilegedAccountsKey = []byte{0x02} // PrivilegeStoreKey PrivilegeStoreKey = []byte{0x03} + // PrivilegeStoreKey + ManagerStoreKey = []byte{0x04} ) diff --git a/x/asset/types/proposal.go b/x/asset/types/proposal.go new file mode 100644 index 00000000..6da958f9 --- /dev/null +++ b/x/asset/types/proposal.go @@ -0,0 +1,106 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// Proposal types +const ( + ProposalTypeAddTokenManager string = "AddTokenManager" + ProposalTypeRemoveTokenManager string = "RemoveTokenManager" +) + +var ( + _ govv1beta1.Content = &AddTokenManager{} + _ govv1beta1.Content = &RemoveTokenManager{} +) + +func init() { + govv1beta1.RegisterProposalType(ProposalTypeAddTokenManager) + govv1beta1.RegisterProposalType(ProposalTypeRemoveTokenManager) +} + +// NewAddAddTokenManager returns new instance of AddTokenManager proposal +func NewAddTokenManager(title, description, manager string) govv1beta1.Content { + return &AddTokenManager{ + Title: title, + Description: description, + ManagerAddress: manager, + } +} + +// GetTitle returns the title of a AddTokenManager +func (atmp *AddTokenManager) GetTitle() string { return atmp.Title } + +// GetDescription returns the description of a AddTokenManager +func (atmp *AddTokenManager) GetDescription() string { return atmp.Description } + +// ProposalRoute returns router key for a AddTokenManager +func (*AddTokenManager) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type for a AddTokenManager +func (*AddTokenManager) ProposalType() string { + return ProposalTypeAddTokenManager +} + +// ValidateBasic runs basic stateless validity checks +func (atmp *AddTokenManager) ValidateBasic() error { + err := govv1beta1.ValidateAbstract(atmp) + if err != nil { + return err + } + if _, err = sdk.AccAddressFromBech32(atmp.ManagerAddress); err != nil { + return err + } + + return nil +} + +// String implements the Stringer interface. +func (atmp AddTokenManager) String() string { + return fmt.Sprintf("AddTokenManager: Title: %s Description: %s Manager: %s", atmp.Title, atmp.Description, atmp.ManagerAddress) +} + +// NewRemoveTokenManager returns new instance of RemoveTokenManager +func NewRemoveTokenManager(title, description, manager string) govv1beta1.Content { + return &RemoveTokenManager{ + Title: title, + Description: description, + ManagerAddress: manager, + } +} + +// GetTitle returns the title of a RemoveTokenManager +func (rtmp *RemoveTokenManager) GetTitle() string { return rtmp.Title } + +// GetDescription returns the description of a RemoveTokenManager +func (rtmp *RemoveTokenManager) GetDescription() string { return rtmp.Description } + +// ProposalRoute returns router key for a RemoveTokenManager +func (*RemoveTokenManager) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type for a RemoveTokenManager +func (*RemoveTokenManager) ProposalType() string { + return ProposalTypeRemoveTokenManager +} + +// String implements the Stringer interface. +func (rtmp RemoveTokenManager) String() string { + return fmt.Sprintf("UpdateBondWeightProposal: Title: %s Description: %s Manager: %s", rtmp.Title, rtmp.Description, rtmp.ManagerAddress) +} + +// ValidateBasic runs basic stateless validity checks +func (rtmp *RemoveTokenManager) ValidateBasic() error { + err := govv1beta1.ValidateAbstract(rtmp) + if err != nil { + return err + } + if _, err = sdk.AccAddressFromBech32(rtmp.ManagerAddress); err != nil { + return err + } + + return nil +} diff --git a/x/asset/types/proposal.pb.go b/x/asset/types/proposal.pb.go new file mode 100644 index 00000000..76eab296 --- /dev/null +++ b/x/asset/types/proposal.pb.go @@ -0,0 +1,657 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: realionetwork/asset/v1/proposal.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + 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 + +type AddTokenManager struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ManagerAddress string `protobuf:"bytes,3,opt,name=manager_address,json=managerAddress,proto3" json:"manager_address,omitempty"` +} + +func (m *AddTokenManager) Reset() { *m = AddTokenManager{} } +func (*AddTokenManager) ProtoMessage() {} +func (*AddTokenManager) Descriptor() ([]byte, []int) { + return fileDescriptor_85071b1a069c5974, []int{0} +} +func (m *AddTokenManager) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddTokenManager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddTokenManager.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 *AddTokenManager) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddTokenManager.Merge(m, src) +} +func (m *AddTokenManager) XXX_Size() int { + return m.Size() +} +func (m *AddTokenManager) XXX_DiscardUnknown() { + xxx_messageInfo_AddTokenManager.DiscardUnknown(m) +} + +var xxx_messageInfo_AddTokenManager proto.InternalMessageInfo + +type RemoveTokenManager struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ManagerAddress string `protobuf:"bytes,3,opt,name=manager_address,json=managerAddress,proto3" json:"manager_address,omitempty"` +} + +func (m *RemoveTokenManager) Reset() { *m = RemoveTokenManager{} } +func (*RemoveTokenManager) ProtoMessage() {} +func (*RemoveTokenManager) Descriptor() ([]byte, []int) { + return fileDescriptor_85071b1a069c5974, []int{1} +} +func (m *RemoveTokenManager) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RemoveTokenManager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RemoveTokenManager.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 *RemoveTokenManager) XXX_Merge(src proto.Message) { + xxx_messageInfo_RemoveTokenManager.Merge(m, src) +} +func (m *RemoveTokenManager) XXX_Size() int { + return m.Size() +} +func (m *RemoveTokenManager) XXX_DiscardUnknown() { + xxx_messageInfo_RemoveTokenManager.DiscardUnknown(m) +} + +var xxx_messageInfo_RemoveTokenManager proto.InternalMessageInfo + +func init() { + proto.RegisterType((*AddTokenManager)(nil), "realionetwork.asset.v1.AddTokenManager") + proto.RegisterType((*RemoveTokenManager)(nil), "realionetwork.asset.v1.RemoveTokenManager") +} + +func init() { + proto.RegisterFile("realionetwork/asset/v1/proposal.proto", fileDescriptor_85071b1a069c5974) +} + +var fileDescriptor_85071b1a069c5974 = []byte{ + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2d, 0x4a, 0x4d, 0xcc, + 0xc9, 0xcc, 0xcf, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0xd1, + 0x2f, 0x33, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc8, 0x2f, 0x4e, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x12, 0x43, 0x51, 0xa6, 0x07, 0x56, 0xa6, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, + 0x9e, 0x0f, 0x56, 0xa2, 0x0f, 0x62, 0x41, 0x54, 0x4b, 0x49, 0x26, 0xe7, 0x17, 0xe7, 0xe6, 0x17, + 0xc7, 0x43, 0x24, 0x20, 0x1c, 0x88, 0x94, 0xd2, 0x3c, 0x46, 0x2e, 0x7e, 0xc7, 0x94, 0x94, 0x90, + 0xfc, 0xec, 0xd4, 0x3c, 0xdf, 0xc4, 0xbc, 0xc4, 0xf4, 0xd4, 0x22, 0x21, 0x11, 0x2e, 0xd6, 0x92, + 0xcc, 0x92, 0x9c, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x47, 0x48, 0x81, 0x8b, + 0x3b, 0x25, 0xb5, 0x38, 0xb9, 0x28, 0xb3, 0xa0, 0x24, 0x33, 0x3f, 0x4f, 0x82, 0x09, 0x2c, 0x87, + 0x2c, 0x24, 0xa4, 0xce, 0xc5, 0x9f, 0x0b, 0x31, 0x22, 0x3e, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, + 0x58, 0x82, 0x19, 0xac, 0x8a, 0x0f, 0x2a, 0xec, 0x08, 0x11, 0xb5, 0xd2, 0xea, 0x58, 0x20, 0xcf, + 0x30, 0x63, 0x81, 0x3c, 0xc3, 0x8b, 0x05, 0xf2, 0x0c, 0xa7, 0xb6, 0xe8, 0x4a, 0x41, 0x9d, 0x94, + 0x9e, 0x5f, 0xa6, 0x57, 0x66, 0x98, 0x94, 0x5a, 0x92, 0x68, 0xa8, 0xe7, 0x9c, 0x9f, 0x57, 0x92, + 0x9a, 0x57, 0xa2, 0xb4, 0x90, 0x91, 0x4b, 0x28, 0x28, 0x35, 0x37, 0xbf, 0x2c, 0x75, 0xd0, 0xba, + 0xd1, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, + 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, + 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x21, 0x51, 0x56, 0x92, 0x9a, 0x9c, 0x01, + 0x65, 0xea, 0xc2, 0x62, 0xb9, 0x02, 0x1a, 0xcf, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, + 0x98, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x22, 0xbb, 0xbe, 0x35, 0x0b, 0x02, 0x00, 0x00, +} + +func (m *AddTokenManager) 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 *AddTokenManager) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddTokenManager) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ManagerAddress) > 0 { + i -= len(m.ManagerAddress) + copy(dAtA[i:], m.ManagerAddress) + i = encodeVarintProposal(dAtA, i, uint64(len(m.ManagerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RemoveTokenManager) 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 *RemoveTokenManager) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RemoveTokenManager) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ManagerAddress) > 0 { + i -= len(m.ManagerAddress) + copy(dAtA[i:], m.ManagerAddress) + i = encodeVarintProposal(dAtA, i, uint64(len(m.ManagerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { + offset -= sovProposal(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AddTokenManager) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.ManagerAddress) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + return n +} + +func (m *RemoveTokenManager) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.ManagerAddress) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + return n +} + +func sovProposal(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProposal(x uint64) (n int) { + return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AddTokenManager) 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 ErrIntOverflowProposal + } + 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: AddTokenManager: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddTokenManager: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ManagerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ManagerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProposal(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RemoveTokenManager) 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 ErrIntOverflowProposal + } + 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: RemoveTokenManager: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoveTokenManager: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ManagerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ManagerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProposal(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProposal(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, ErrIntOverflowProposal + } + 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, ErrIntOverflowProposal + } + 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, ErrIntOverflowProposal + } + 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, ErrInvalidLengthProposal + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProposal + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthProposal + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") +)