diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..b82a78a3 Binary files /dev/null and b/.DS_Store differ diff --git a/api/reserve/auction/module/module.pulsar.go b/api/reserve/auction/module/module.pulsar.go new file mode 100644 index 00000000..e7988377 --- /dev/null +++ b/api/reserve/auction/module/module.pulsar.go @@ -0,0 +1,579 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_module_module_proto_init() + md_Module = File_reserve_auction_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.module.Module.authority": + panic(fmt.Errorf("field authority of message reserve.auction.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.module.Module")) + } + panic(fmt.Errorf("message reserve.auction.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/auction/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_reserve_auction_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_reserve_auction_module_module_proto protoreflect.FileDescriptor + +var file_reserve_auction_module_module_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2c, 0x0a, + 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x6f, 0x6d, + 0x79, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xcc, 0x01, 0x0a, 0x1a, + 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x52, 0x41, 0x4d, 0xaa, 0x02, 0x16, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0xca, 0x02, 0x16, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x22, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x18, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_reserve_auction_module_module_proto_rawDescOnce sync.Once + file_reserve_auction_module_module_proto_rawDescData = file_reserve_auction_module_module_proto_rawDesc +) + +func file_reserve_auction_module_module_proto_rawDescGZIP() []byte { + file_reserve_auction_module_module_proto_rawDescOnce.Do(func() { + file_reserve_auction_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_auction_module_module_proto_rawDescData) + }) + return file_reserve_auction_module_module_proto_rawDescData +} + +var file_reserve_auction_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_auction_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: reserve.auction.module.Module +} +var file_reserve_auction_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_reserve_auction_module_module_proto_init() } +func file_reserve_auction_module_module_proto_init() { + if File_reserve_auction_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_auction_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_auction_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_auction_module_module_proto_goTypes, + DependencyIndexes: file_reserve_auction_module_module_proto_depIdxs, + MessageInfos: file_reserve_auction_module_module_proto_msgTypes, + }.Build() + File_reserve_auction_module_module_proto = out.File + file_reserve_auction_module_module_proto_rawDesc = nil + file_reserve_auction_module_module_proto_goTypes = nil + file_reserve_auction_module_module_proto_depIdxs = nil +} diff --git a/api/reserve/auction/v1/auction.pulsar.go b/api/reserve/auction/v1/auction.pulsar.go new file mode 100644 index 00000000..34bf845e --- /dev/null +++ b/api/reserve/auction/v1/auction.pulsar.go @@ -0,0 +1,3509 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package auctionv1 + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Auction protoreflect.MessageDescriptor + fd_Auction_start_time protoreflect.FieldDescriptor + fd_Auction_end_time protoreflect.FieldDescriptor + fd_Auction_auction_id protoreflect.FieldDescriptor + fd_Auction_initial_price protoreflect.FieldDescriptor + fd_Auction_item protoreflect.FieldDescriptor + fd_Auction_current_rate protoreflect.FieldDescriptor + fd_Auction_last_discount_time protoreflect.FieldDescriptor + fd_Auction_token_raised protoreflect.FieldDescriptor + fd_Auction_status protoreflect.FieldDescriptor + fd_Auction_target_goal protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_auction_proto_init() + md_Auction = File_reserve_auction_v1_auction_proto.Messages().ByName("Auction") + fd_Auction_start_time = md_Auction.Fields().ByName("start_time") + fd_Auction_end_time = md_Auction.Fields().ByName("end_time") + fd_Auction_auction_id = md_Auction.Fields().ByName("auction_id") + fd_Auction_initial_price = md_Auction.Fields().ByName("initial_price") + fd_Auction_item = md_Auction.Fields().ByName("item") + fd_Auction_current_rate = md_Auction.Fields().ByName("current_rate") + fd_Auction_last_discount_time = md_Auction.Fields().ByName("last_discount_time") + fd_Auction_token_raised = md_Auction.Fields().ByName("token_raised") + fd_Auction_status = md_Auction.Fields().ByName("status") + fd_Auction_target_goal = md_Auction.Fields().ByName("target_goal") +} + +var _ protoreflect.Message = (*fastReflection_Auction)(nil) + +type fastReflection_Auction Auction + +func (x *Auction) ProtoReflect() protoreflect.Message { + return (*fastReflection_Auction)(x) +} + +func (x *Auction) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Auction_messageType fastReflection_Auction_messageType +var _ protoreflect.MessageType = fastReflection_Auction_messageType{} + +type fastReflection_Auction_messageType struct{} + +func (x fastReflection_Auction_messageType) Zero() protoreflect.Message { + return (*fastReflection_Auction)(nil) +} +func (x fastReflection_Auction_messageType) New() protoreflect.Message { + return new(fastReflection_Auction) +} +func (x fastReflection_Auction_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Auction +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Auction) Descriptor() protoreflect.MessageDescriptor { + return md_Auction +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Auction) Type() protoreflect.MessageType { + return _fastReflection_Auction_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Auction) New() protoreflect.Message { + return new(fastReflection_Auction) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Auction) Interface() protoreflect.ProtoMessage { + return (*Auction)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Auction) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.StartTime != nil { + value := protoreflect.ValueOfMessage(x.StartTime.ProtoReflect()) + if !f(fd_Auction_start_time, value) { + return + } + } + if x.EndTime != nil { + value := protoreflect.ValueOfMessage(x.EndTime.ProtoReflect()) + if !f(fd_Auction_end_time, value) { + return + } + } + if x.AuctionId != uint64(0) { + value := protoreflect.ValueOfUint64(x.AuctionId) + if !f(fd_Auction_auction_id, value) { + return + } + } + if x.InitialPrice != nil { + value := protoreflect.ValueOfMessage(x.InitialPrice.ProtoReflect()) + if !f(fd_Auction_initial_price, value) { + return + } + } + if x.Item != nil { + value := protoreflect.ValueOfMessage(x.Item.ProtoReflect()) + if !f(fd_Auction_item, value) { + return + } + } + if x.CurrentRate != "" { + value := protoreflect.ValueOfString(x.CurrentRate) + if !f(fd_Auction_current_rate, value) { + return + } + } + if x.LastDiscountTime != nil { + value := protoreflect.ValueOfMessage(x.LastDiscountTime.ProtoReflect()) + if !f(fd_Auction_last_discount_time, value) { + return + } + } + if x.TokenRaised != nil { + value := protoreflect.ValueOfMessage(x.TokenRaised.ProtoReflect()) + if !f(fd_Auction_token_raised, value) { + return + } + } + if x.Status != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) + if !f(fd_Auction_status, value) { + return + } + } + if x.TargetGoal != nil { + value := protoreflect.ValueOfMessage(x.TargetGoal.ProtoReflect()) + if !f(fd_Auction_target_goal, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Auction) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.Auction.start_time": + return x.StartTime != nil + case "reserve.auction.v1.Auction.end_time": + return x.EndTime != nil + case "reserve.auction.v1.Auction.auction_id": + return x.AuctionId != uint64(0) + case "reserve.auction.v1.Auction.initial_price": + return x.InitialPrice != nil + case "reserve.auction.v1.Auction.item": + return x.Item != nil + case "reserve.auction.v1.Auction.current_rate": + return x.CurrentRate != "" + case "reserve.auction.v1.Auction.last_discount_time": + return x.LastDiscountTime != nil + case "reserve.auction.v1.Auction.token_raised": + return x.TokenRaised != nil + case "reserve.auction.v1.Auction.status": + return x.Status != 0 + case "reserve.auction.v1.Auction.target_goal": + return x.TargetGoal != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Auction) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.Auction.start_time": + x.StartTime = nil + case "reserve.auction.v1.Auction.end_time": + x.EndTime = nil + case "reserve.auction.v1.Auction.auction_id": + x.AuctionId = uint64(0) + case "reserve.auction.v1.Auction.initial_price": + x.InitialPrice = nil + case "reserve.auction.v1.Auction.item": + x.Item = nil + case "reserve.auction.v1.Auction.current_rate": + x.CurrentRate = "" + case "reserve.auction.v1.Auction.last_discount_time": + x.LastDiscountTime = nil + case "reserve.auction.v1.Auction.token_raised": + x.TokenRaised = nil + case "reserve.auction.v1.Auction.status": + x.Status = 0 + case "reserve.auction.v1.Auction.target_goal": + x.TargetGoal = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Auction) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.Auction.start_time": + value := x.StartTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.end_time": + value := x.EndTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.auction_id": + value := x.AuctionId + return protoreflect.ValueOfUint64(value) + case "reserve.auction.v1.Auction.initial_price": + value := x.InitialPrice + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.item": + value := x.Item + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.current_rate": + value := x.CurrentRate + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.Auction.last_discount_time": + value := x.LastDiscountTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.token_raised": + value := x.TokenRaised + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Auction.status": + value := x.Status + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "reserve.auction.v1.Auction.target_goal": + value := x.TargetGoal + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Auction) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.Auction.start_time": + x.StartTime = value.Message().Interface().(*timestamppb.Timestamp) + case "reserve.auction.v1.Auction.end_time": + x.EndTime = value.Message().Interface().(*timestamppb.Timestamp) + case "reserve.auction.v1.Auction.auction_id": + x.AuctionId = value.Uint() + case "reserve.auction.v1.Auction.initial_price": + x.InitialPrice = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.Auction.item": + x.Item = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.Auction.current_rate": + x.CurrentRate = value.Interface().(string) + case "reserve.auction.v1.Auction.last_discount_time": + x.LastDiscountTime = value.Message().Interface().(*timestamppb.Timestamp) + case "reserve.auction.v1.Auction.token_raised": + x.TokenRaised = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.Auction.status": + x.Status = (AuctionStatus)(value.Enum()) + case "reserve.auction.v1.Auction.target_goal": + x.TargetGoal = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Auction) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Auction.start_time": + if x.StartTime == nil { + x.StartTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.StartTime.ProtoReflect()) + case "reserve.auction.v1.Auction.end_time": + if x.EndTime == nil { + x.EndTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.EndTime.ProtoReflect()) + case "reserve.auction.v1.Auction.initial_price": + if x.InitialPrice == nil { + x.InitialPrice = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.InitialPrice.ProtoReflect()) + case "reserve.auction.v1.Auction.item": + if x.Item == nil { + x.Item = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Item.ProtoReflect()) + case "reserve.auction.v1.Auction.last_discount_time": + if x.LastDiscountTime == nil { + x.LastDiscountTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.LastDiscountTime.ProtoReflect()) + case "reserve.auction.v1.Auction.token_raised": + if x.TokenRaised == nil { + x.TokenRaised = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.TokenRaised.ProtoReflect()) + case "reserve.auction.v1.Auction.target_goal": + if x.TargetGoal == nil { + x.TargetGoal = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.TargetGoal.ProtoReflect()) + case "reserve.auction.v1.Auction.auction_id": + panic(fmt.Errorf("field auction_id of message reserve.auction.v1.Auction is not mutable")) + case "reserve.auction.v1.Auction.current_rate": + panic(fmt.Errorf("field current_rate of message reserve.auction.v1.Auction is not mutable")) + case "reserve.auction.v1.Auction.status": + panic(fmt.Errorf("field status of message reserve.auction.v1.Auction is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Auction) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Auction.start_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.end_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.auction_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.auction.v1.Auction.initial_price": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.item": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.current_rate": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.Auction.last_discount_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.token_raised": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Auction.status": + return protoreflect.ValueOfEnum(0) + case "reserve.auction.v1.Auction.target_goal": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Auction")) + } + panic(fmt.Errorf("message reserve.auction.v1.Auction does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Auction) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.Auction", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Auction) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Auction) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Auction) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Auction) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Auction) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.StartTime != nil { + l = options.Size(x.StartTime) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.EndTime != nil { + l = options.Size(x.EndTime) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.AuctionId != 0 { + n += 1 + runtime.Sov(uint64(x.AuctionId)) + } + if x.InitialPrice != nil { + l = options.Size(x.InitialPrice) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Item != nil { + l = options.Size(x.Item) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.CurrentRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.LastDiscountTime != nil { + l = options.Size(x.LastDiscountTime) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.TokenRaised != nil { + l = options.Size(x.TokenRaised) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Status != 0 { + n += 1 + runtime.Sov(uint64(x.Status)) + } + if x.TargetGoal != nil { + l = options.Size(x.TargetGoal) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Auction) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.TargetGoal != nil { + encoded, err := options.Marshal(x.TargetGoal) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x52 + } + if x.Status != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) + i-- + dAtA[i] = 0x48 + } + if x.TokenRaised != nil { + encoded, err := options.Marshal(x.TokenRaised) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x42 + } + if x.LastDiscountTime != nil { + encoded, err := options.Marshal(x.LastDiscountTime) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x3a + } + if len(x.CurrentRate) > 0 { + i -= len(x.CurrentRate) + copy(dAtA[i:], x.CurrentRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CurrentRate))) + i-- + dAtA[i] = 0x32 + } + if x.Item != nil { + encoded, err := options.Marshal(x.Item) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + if x.InitialPrice != nil { + encoded, err := options.Marshal(x.InitialPrice) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x22 + } + if x.AuctionId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AuctionId)) + i-- + dAtA[i] = 0x18 + } + if x.EndTime != nil { + encoded, err := options.Marshal(x.EndTime) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.StartTime != nil { + encoded, err := options.Marshal(x.StartTime) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Auction) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.StartTime == nil { + x.StartTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.StartTime); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.EndTime == nil { + x.EndTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.EndTime); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + x.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InitialPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.InitialPrice == nil { + x.InitialPrice = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.InitialPrice); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Item", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Item == nil { + x.Item = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Item); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrentRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.CurrentRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastDiscountTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.LastDiscountTime == nil { + x.LastDiscountTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.LastDiscountTime); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TokenRaised", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.TokenRaised == nil { + x.TokenRaised = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TokenRaised); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + x.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Status |= AuctionStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TargetGoal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.TargetGoal == nil { + x.TargetGoal = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TargetGoal); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_Bid protoreflect.MessageDescriptor + fd_Bid_bid_id protoreflect.FieldDescriptor + fd_Bid_bidder protoreflect.FieldDescriptor + fd_Bid_amount protoreflect.FieldDescriptor + fd_Bid_recive_rate protoreflect.FieldDescriptor + fd_Bid_max_receive protoreflect.FieldDescriptor + fd_Bid_is_handle protoreflect.FieldDescriptor + fd_Bid_index protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_auction_proto_init() + md_Bid = File_reserve_auction_v1_auction_proto.Messages().ByName("Bid") + fd_Bid_bid_id = md_Bid.Fields().ByName("bid_id") + fd_Bid_bidder = md_Bid.Fields().ByName("bidder") + fd_Bid_amount = md_Bid.Fields().ByName("amount") + fd_Bid_recive_rate = md_Bid.Fields().ByName("recive_rate") + fd_Bid_max_receive = md_Bid.Fields().ByName("max_receive") + fd_Bid_is_handle = md_Bid.Fields().ByName("is_handle") + fd_Bid_index = md_Bid.Fields().ByName("index") +} + +var _ protoreflect.Message = (*fastReflection_Bid)(nil) + +type fastReflection_Bid Bid + +func (x *Bid) ProtoReflect() protoreflect.Message { + return (*fastReflection_Bid)(x) +} + +func (x *Bid) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Bid_messageType fastReflection_Bid_messageType +var _ protoreflect.MessageType = fastReflection_Bid_messageType{} + +type fastReflection_Bid_messageType struct{} + +func (x fastReflection_Bid_messageType) Zero() protoreflect.Message { + return (*fastReflection_Bid)(nil) +} +func (x fastReflection_Bid_messageType) New() protoreflect.Message { + return new(fastReflection_Bid) +} +func (x fastReflection_Bid_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Bid +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Bid) Descriptor() protoreflect.MessageDescriptor { + return md_Bid +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Bid) Type() protoreflect.MessageType { + return _fastReflection_Bid_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Bid) New() protoreflect.Message { + return new(fastReflection_Bid) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Bid) Interface() protoreflect.ProtoMessage { + return (*Bid)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Bid) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.BidId != uint64(0) { + value := protoreflect.ValueOfUint64(x.BidId) + if !f(fd_Bid_bid_id, value) { + return + } + } + if x.Bidder != "" { + value := protoreflect.ValueOfString(x.Bidder) + if !f(fd_Bid_bidder, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_Bid_amount, value) { + return + } + } + if x.ReciveRate != "" { + value := protoreflect.ValueOfString(x.ReciveRate) + if !f(fd_Bid_recive_rate, value) { + return + } + } + if x.MaxReceive != nil { + value := protoreflect.ValueOfMessage(x.MaxReceive.ProtoReflect()) + if !f(fd_Bid_max_receive, value) { + return + } + } + if x.IsHandle != false { + value := protoreflect.ValueOfBool(x.IsHandle) + if !f(fd_Bid_is_handle, value) { + return + } + } + if x.Index != uint64(0) { + value := protoreflect.ValueOfUint64(x.Index) + if !f(fd_Bid_index, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Bid) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.Bid.bid_id": + return x.BidId != uint64(0) + case "reserve.auction.v1.Bid.bidder": + return x.Bidder != "" + case "reserve.auction.v1.Bid.amount": + return x.Amount != nil + case "reserve.auction.v1.Bid.recive_rate": + return x.ReciveRate != "" + case "reserve.auction.v1.Bid.max_receive": + return x.MaxReceive != nil + case "reserve.auction.v1.Bid.is_handle": + return x.IsHandle != false + case "reserve.auction.v1.Bid.index": + return x.Index != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bid) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.Bid.bid_id": + x.BidId = uint64(0) + case "reserve.auction.v1.Bid.bidder": + x.Bidder = "" + case "reserve.auction.v1.Bid.amount": + x.Amount = nil + case "reserve.auction.v1.Bid.recive_rate": + x.ReciveRate = "" + case "reserve.auction.v1.Bid.max_receive": + x.MaxReceive = nil + case "reserve.auction.v1.Bid.is_handle": + x.IsHandle = false + case "reserve.auction.v1.Bid.index": + x.Index = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Bid) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.Bid.bid_id": + value := x.BidId + return protoreflect.ValueOfUint64(value) + case "reserve.auction.v1.Bid.bidder": + value := x.Bidder + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.Bid.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Bid.recive_rate": + value := x.ReciveRate + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.Bid.max_receive": + value := x.MaxReceive + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Bid.is_handle": + value := x.IsHandle + return protoreflect.ValueOfBool(value) + case "reserve.auction.v1.Bid.index": + value := x.Index + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bid) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.Bid.bid_id": + x.BidId = value.Uint() + case "reserve.auction.v1.Bid.bidder": + x.Bidder = value.Interface().(string) + case "reserve.auction.v1.Bid.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.Bid.recive_rate": + x.ReciveRate = value.Interface().(string) + case "reserve.auction.v1.Bid.max_receive": + x.MaxReceive = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.Bid.is_handle": + x.IsHandle = value.Bool() + case "reserve.auction.v1.Bid.index": + x.Index = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bid) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Bid.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.auction.v1.Bid.max_receive": + if x.MaxReceive == nil { + x.MaxReceive = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.MaxReceive.ProtoReflect()) + case "reserve.auction.v1.Bid.bid_id": + panic(fmt.Errorf("field bid_id of message reserve.auction.v1.Bid is not mutable")) + case "reserve.auction.v1.Bid.bidder": + panic(fmt.Errorf("field bidder of message reserve.auction.v1.Bid is not mutable")) + case "reserve.auction.v1.Bid.recive_rate": + panic(fmt.Errorf("field recive_rate of message reserve.auction.v1.Bid is not mutable")) + case "reserve.auction.v1.Bid.is_handle": + panic(fmt.Errorf("field is_handle of message reserve.auction.v1.Bid is not mutable")) + case "reserve.auction.v1.Bid.index": + panic(fmt.Errorf("field index of message reserve.auction.v1.Bid is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Bid) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Bid.bid_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.auction.v1.Bid.bidder": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.Bid.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Bid.recive_rate": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.Bid.max_receive": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Bid.is_handle": + return protoreflect.ValueOfBool(false) + case "reserve.auction.v1.Bid.index": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bid")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bid does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Bid) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.Bid", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Bid) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bid) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Bid) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Bid) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Bid) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.BidId != 0 { + n += 1 + runtime.Sov(uint64(x.BidId)) + } + l = len(x.Bidder) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ReciveRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.MaxReceive != nil { + l = options.Size(x.MaxReceive) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.IsHandle { + n += 2 + } + if x.Index != 0 { + n += 1 + runtime.Sov(uint64(x.Index)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Bid) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Index != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) + i-- + dAtA[i] = 0x38 + } + if x.IsHandle { + i-- + if x.IsHandle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if x.MaxReceive != nil { + encoded, err := options.Marshal(x.MaxReceive) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + if len(x.ReciveRate) > 0 { + i -= len(x.ReciveRate) + copy(dAtA[i:], x.ReciveRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReciveRate))) + i-- + dAtA[i] = 0x22 + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Bidder) > 0 { + i -= len(x.Bidder) + copy(dAtA[i:], x.Bidder) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Bidder))) + i-- + dAtA[i] = 0x12 + } + if x.BidId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BidId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Bid) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BidId", wireType) + } + x.BidId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BidId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReciveRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ReciveRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxReceive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.MaxReceive == nil { + x.MaxReceive = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MaxReceive); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IsHandle", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.IsHandle = bool(v != 0) + case 7: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + x.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_BidQueue_2_list)(nil) + +type _BidQueue_2_list struct { + list *[]*Bid +} + +func (x *_BidQueue_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_BidQueue_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_BidQueue_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + (*x.list)[i] = concreteValue +} + +func (x *_BidQueue_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + *x.list = append(*x.list, concreteValue) +} + +func (x *_BidQueue_2_list) AppendMutable() protoreflect.Value { + v := new(Bid) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_BidQueue_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_BidQueue_2_list) NewElement() protoreflect.Value { + v := new(Bid) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_BidQueue_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_BidQueue protoreflect.MessageDescriptor + fd_BidQueue_auction_id protoreflect.FieldDescriptor + fd_BidQueue_bids protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_auction_proto_init() + md_BidQueue = File_reserve_auction_v1_auction_proto.Messages().ByName("BidQueue") + fd_BidQueue_auction_id = md_BidQueue.Fields().ByName("auction_id") + fd_BidQueue_bids = md_BidQueue.Fields().ByName("bids") +} + +var _ protoreflect.Message = (*fastReflection_BidQueue)(nil) + +type fastReflection_BidQueue BidQueue + +func (x *BidQueue) ProtoReflect() protoreflect.Message { + return (*fastReflection_BidQueue)(x) +} + +func (x *BidQueue) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_BidQueue_messageType fastReflection_BidQueue_messageType +var _ protoreflect.MessageType = fastReflection_BidQueue_messageType{} + +type fastReflection_BidQueue_messageType struct{} + +func (x fastReflection_BidQueue_messageType) Zero() protoreflect.Message { + return (*fastReflection_BidQueue)(nil) +} +func (x fastReflection_BidQueue_messageType) New() protoreflect.Message { + return new(fastReflection_BidQueue) +} +func (x fastReflection_BidQueue_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_BidQueue +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_BidQueue) Descriptor() protoreflect.MessageDescriptor { + return md_BidQueue +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_BidQueue) Type() protoreflect.MessageType { + return _fastReflection_BidQueue_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_BidQueue) New() protoreflect.Message { + return new(fastReflection_BidQueue) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_BidQueue) Interface() protoreflect.ProtoMessage { + return (*BidQueue)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_BidQueue) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AuctionId != uint64(0) { + value := protoreflect.ValueOfUint64(x.AuctionId) + if !f(fd_BidQueue_auction_id, value) { + return + } + } + if len(x.Bids) != 0 { + value := protoreflect.ValueOfList(&_BidQueue_2_list{list: &x.Bids}) + if !f(fd_BidQueue_bids, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_BidQueue) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.BidQueue.auction_id": + return x.AuctionId != uint64(0) + case "reserve.auction.v1.BidQueue.bids": + return len(x.Bids) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BidQueue) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.BidQueue.auction_id": + x.AuctionId = uint64(0) + case "reserve.auction.v1.BidQueue.bids": + x.Bids = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_BidQueue) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.BidQueue.auction_id": + value := x.AuctionId + return protoreflect.ValueOfUint64(value) + case "reserve.auction.v1.BidQueue.bids": + if len(x.Bids) == 0 { + return protoreflect.ValueOfList(&_BidQueue_2_list{}) + } + listValue := &_BidQueue_2_list{list: &x.Bids} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BidQueue) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.BidQueue.auction_id": + x.AuctionId = value.Uint() + case "reserve.auction.v1.BidQueue.bids": + lv := value.List() + clv := lv.(*_BidQueue_2_list) + x.Bids = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BidQueue) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.BidQueue.bids": + if x.Bids == nil { + x.Bids = []*Bid{} + } + value := &_BidQueue_2_list{list: &x.Bids} + return protoreflect.ValueOfList(value) + case "reserve.auction.v1.BidQueue.auction_id": + panic(fmt.Errorf("field auction_id of message reserve.auction.v1.BidQueue is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_BidQueue) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.BidQueue.auction_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.auction.v1.BidQueue.bids": + list := []*Bid{} + return protoreflect.ValueOfList(&_BidQueue_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.BidQueue")) + } + panic(fmt.Errorf("message reserve.auction.v1.BidQueue does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_BidQueue) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.BidQueue", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_BidQueue) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BidQueue) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_BidQueue) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_BidQueue) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*BidQueue) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.AuctionId != 0 { + n += 1 + runtime.Sov(uint64(x.AuctionId)) + } + if len(x.Bids) > 0 { + for _, e := range x.Bids { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*BidQueue) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Bids) > 0 { + for iNdEx := len(x.Bids) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Bids[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.AuctionId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AuctionId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*BidQueue) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BidQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BidQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + x.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bids = append(x.Bids, &Bid{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Bids[len(x.Bids)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_Bids_1_list)(nil) + +type _Bids_1_list struct { + list *[]*Bid +} + +func (x *_Bids_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Bids_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Bids_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + (*x.list)[i] = concreteValue +} + +func (x *_Bids_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Bids_1_list) AppendMutable() protoreflect.Value { + v := new(Bid) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Bids_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Bids_1_list) NewElement() protoreflect.Value { + v := new(Bid) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Bids_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_Bids protoreflect.MessageDescriptor + fd_Bids_bids protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_auction_proto_init() + md_Bids = File_reserve_auction_v1_auction_proto.Messages().ByName("Bids") + fd_Bids_bids = md_Bids.Fields().ByName("bids") +} + +var _ protoreflect.Message = (*fastReflection_Bids)(nil) + +type fastReflection_Bids Bids + +func (x *Bids) ProtoReflect() protoreflect.Message { + return (*fastReflection_Bids)(x) +} + +func (x *Bids) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Bids_messageType fastReflection_Bids_messageType +var _ protoreflect.MessageType = fastReflection_Bids_messageType{} + +type fastReflection_Bids_messageType struct{} + +func (x fastReflection_Bids_messageType) Zero() protoreflect.Message { + return (*fastReflection_Bids)(nil) +} +func (x fastReflection_Bids_messageType) New() protoreflect.Message { + return new(fastReflection_Bids) +} +func (x fastReflection_Bids_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Bids +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Bids) Descriptor() protoreflect.MessageDescriptor { + return md_Bids +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Bids) Type() protoreflect.MessageType { + return _fastReflection_Bids_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Bids) New() protoreflect.Message { + return new(fastReflection_Bids) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Bids) Interface() protoreflect.ProtoMessage { + return (*Bids)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Bids) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Bids) != 0 { + value := protoreflect.ValueOfList(&_Bids_1_list{list: &x.Bids}) + if !f(fd_Bids_bids, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Bids) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.Bids.bids": + return len(x.Bids) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bids) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.Bids.bids": + x.Bids = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Bids) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.Bids.bids": + if len(x.Bids) == 0 { + return protoreflect.ValueOfList(&_Bids_1_list{}) + } + listValue := &_Bids_1_list{list: &x.Bids} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bids) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.Bids.bids": + lv := value.List() + clv := lv.(*_Bids_1_list) + x.Bids = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bids) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Bids.bids": + if x.Bids == nil { + x.Bids = []*Bid{} + } + value := &_Bids_1_list{list: &x.Bids} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Bids) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Bids.bids": + list := []*Bid{} + return protoreflect.ValueOfList(&_Bids_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Bids")) + } + panic(fmt.Errorf("message reserve.auction.v1.Bids does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Bids) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.Bids", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Bids) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Bids) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Bids) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Bids) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Bids) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Bids) > 0 { + for _, e := range x.Bids { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Bids) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Bids) > 0 { + for iNdEx := len(x.Bids) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Bids[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Bids) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bids: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bids: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bids = append(x.Bids, &Bid{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Bids[len(x.Bids)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/auction/v1/auction.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// AuctionStatus enumerates the valid auction status. +type AuctionStatus int32 + +const ( + // AUCTION_STATUS_UNSPECIFIED defines unknow auction status default is active. + AuctionStatus_AUCTION_STATUS_UNSPECIFIED AuctionStatus = 0 + // AUCTION_STATUS_ACTIVE defines auction active status. + AuctionStatus_AUCTION_STATUS_ACTIVE AuctionStatus = 1 + // AUCTION_STATUS_FINISHED defines auction finished reaching target goal. + AuctionStatus_AUCTION_STATUS_FINISHED AuctionStatus = 2 + // AUCTION_STATUS_EXPIRED defines auction reach end time without reaching target goal. + AuctionStatus_AUCTION_STATUS_EXPIRED AuctionStatus = 3 + // AUCTION_STATUS_OUT_OF_COLLATHERAL defines auction out of collatheral. + AuctionStatus_AUCTION_STATUS_OUT_OF_COLLATHERAL AuctionStatus = 4 +) + +// Enum value maps for AuctionStatus. +var ( + AuctionStatus_name = map[int32]string{ + 0: "AUCTION_STATUS_UNSPECIFIED", + 1: "AUCTION_STATUS_ACTIVE", + 2: "AUCTION_STATUS_FINISHED", + 3: "AUCTION_STATUS_EXPIRED", + 4: "AUCTION_STATUS_OUT_OF_COLLATHERAL", + } + AuctionStatus_value = map[string]int32{ + "AUCTION_STATUS_UNSPECIFIED": 0, + "AUCTION_STATUS_ACTIVE": 1, + "AUCTION_STATUS_FINISHED": 2, + "AUCTION_STATUS_EXPIRED": 3, + "AUCTION_STATUS_OUT_OF_COLLATHERAL": 4, + } +) + +func (x AuctionStatus) Enum() *AuctionStatus { + p := new(AuctionStatus) + *p = x + return p +} + +func (x AuctionStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AuctionStatus) Descriptor() protoreflect.EnumDescriptor { + return file_reserve_auction_v1_auction_proto_enumTypes[0].Descriptor() +} + +func (AuctionStatus) Type() protoreflect.EnumType { + return &file_reserve_auction_v1_auction_proto_enumTypes[0] +} + +func (x AuctionStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AuctionStatus.Descriptor instead. +func (AuctionStatus) EnumDescriptor() ([]byte, []int) { + return file_reserve_auction_v1_auction_proto_rawDescGZIP(), []int{0} +} + +// Auction struct +type Auction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // start_time defines auction's start time + StartTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + // end_time defines where the auction ended when there are no winning bid + EndTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + // for simplicity, will use vault id that start the auction as auction id + AuctionId uint64 `protobuf:"varint,3,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // starting price (currently only support usd stable token) + InitialPrice *v1beta1.Coin `protobuf:"bytes,4,opt,name=initial_price,json=initialPrice,proto3" json:"initial_price,omitempty"` + // items defines liquidate assets + Item *v1beta1.Coin `protobuf:"bytes,5,opt,name=item,proto3" json:"item,omitempty"` + // current_rate defines the rate compare with the initial price + CurrentRate string `protobuf:"bytes,6,opt,name=current_rate,json=currentRate,proto3" json:"current_rate,omitempty"` + // last_discount_time defines the last time a discount has been apply + LastDiscountTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=last_discount_time,json=lastDiscountTime,proto3" json:"last_discount_time,omitempty"` + TokenRaised *v1beta1.Coin `protobuf:"bytes,8,opt,name=token_raised,json=tokenRaised,proto3" json:"token_raised,omitempty"` + // status defines auction current status + Status AuctionStatus `protobuf:"varint,9,opt,name=status,proto3,enum=reserve.auction.v1.AuctionStatus" json:"status,omitempty"` + // target_goal defines the debt the auction is trying to recover + TargetGoal *v1beta1.Coin `protobuf:"bytes,10,opt,name=target_goal,json=targetGoal,proto3" json:"target_goal,omitempty"` +} + +func (x *Auction) Reset() { + *x = Auction{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Auction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Auction) ProtoMessage() {} + +// Deprecated: Use Auction.ProtoReflect.Descriptor instead. +func (*Auction) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_auction_proto_rawDescGZIP(), []int{0} +} + +func (x *Auction) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.StartTime + } + return nil +} + +func (x *Auction) GetEndTime() *timestamppb.Timestamp { + if x != nil { + return x.EndTime + } + return nil +} + +func (x *Auction) GetAuctionId() uint64 { + if x != nil { + return x.AuctionId + } + return 0 +} + +func (x *Auction) GetInitialPrice() *v1beta1.Coin { + if x != nil { + return x.InitialPrice + } + return nil +} + +func (x *Auction) GetItem() *v1beta1.Coin { + if x != nil { + return x.Item + } + return nil +} + +func (x *Auction) GetCurrentRate() string { + if x != nil { + return x.CurrentRate + } + return "" +} + +func (x *Auction) GetLastDiscountTime() *timestamppb.Timestamp { + if x != nil { + return x.LastDiscountTime + } + return nil +} + +func (x *Auction) GetTokenRaised() *v1beta1.Coin { + if x != nil { + return x.TokenRaised + } + return nil +} + +func (x *Auction) GetStatus() AuctionStatus { + if x != nil { + return x.Status + } + return AuctionStatus_AUCTION_STATUS_UNSPECIFIED +} + +func (x *Auction) GetTargetGoal() *v1beta1.Coin { + if x != nil { + return x.TargetGoal + } + return nil +} + +// Bid defines bid entry +type Bid struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id of bid + BidId uint64 `protobuf:"varint,1,opt,name=bid_id,json=bidId,proto3" json:"bid_id,omitempty"` + // bidder address + Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` + // bidding amount + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + // recive_rate defines the rate compare to the price at the start of the auction + // that the bid is willing to pay + ReciveRate string `protobuf:"bytes,4,opt,name=recive_rate,json=reciveRate,proto3" json:"recive_rate,omitempty"` + // maxReceive maximum receive-able amount + MaxReceive *v1beta1.Coin `protobuf:"bytes,5,opt,name=max_receive,json=maxReceive,proto3" json:"max_receive,omitempty"` + IsHandle bool `protobuf:"varint,6,opt,name=is_handle,json=isHandle,proto3" json:"is_handle,omitempty"` + // index in auction bid_queue + Index uint64 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"` +} + +func (x *Bid) Reset() { + *x = Bid{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Bid) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Bid) ProtoMessage() {} + +// Deprecated: Use Bid.ProtoReflect.Descriptor instead. +func (*Bid) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_auction_proto_rawDescGZIP(), []int{1} +} + +func (x *Bid) GetBidId() uint64 { + if x != nil { + return x.BidId + } + return 0 +} + +func (x *Bid) GetBidder() string { + if x != nil { + return x.Bidder + } + return "" +} + +func (x *Bid) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +func (x *Bid) GetReciveRate() string { + if x != nil { + return x.ReciveRate + } + return "" +} + +func (x *Bid) GetMaxReceive() *v1beta1.Coin { + if x != nil { + return x.MaxReceive + } + return nil +} + +func (x *Bid) GetIsHandle() bool { + if x != nil { + return x.IsHandle + } + return false +} + +func (x *Bid) GetIndex() uint64 { + if x != nil { + return x.Index + } + return 0 +} + +// BidQueue defines a list of bid entries for a single auction sorted by insertion time +type BidQueue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // bidder address + AuctionId uint64 `protobuf:"varint,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // array of bid entries with bidder address + Bids []*Bid `protobuf:"bytes,2,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (x *BidQueue) Reset() { + *x = BidQueue{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BidQueue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BidQueue) ProtoMessage() {} + +// Deprecated: Use BidQueue.ProtoReflect.Descriptor instead. +func (*BidQueue) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_auction_proto_rawDescGZIP(), []int{2} +} + +func (x *BidQueue) GetAuctionId() uint64 { + if x != nil { + return x.AuctionId + } + return 0 +} + +func (x *BidQueue) GetBids() []*Bid { + if x != nil { + return x.Bids + } + return nil +} + +// Bids defines a list of bid entries +type Bids struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // array of bid entries with bidder address + Bids []*Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (x *Bids) Reset() { + *x = Bids{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_auction_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Bids) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Bids) ProtoMessage() {} + +// Deprecated: Use Bids.ProtoReflect.Descriptor instead. +func (*Bids) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_auction_proto_rawDescGZIP(), []int{3} +} + +func (x *Bids) GetBids() []*Bid { + if x != nil { + return x.Bids + } + return nil +} + +var File_reserve_auction_v1_auction_proto protoreflect.FileDescriptor + +var file_reserve_auction_v1_auction_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x05, 0x0a, 0x07, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, + 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x44, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, + 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, + 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, + 0x6c, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, + 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x31, 0x0a, 0x0c, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x74, 0x65, 0x12, 0x57, + 0x0a, 0x12, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x6c, 0x61, 0x73, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x5f, 0x72, 0x61, 0x69, 0x73, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x61, 0x69, 0x73, 0x65, 0x64, + 0x12, 0x39, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x21, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x67, 0x6f, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x47, 0x6f, + 0x61, 0x6c, 0x22, 0xb7, 0x02, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x69, + 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x62, 0x69, 0x64, 0x49, + 0x64, 0x12, 0x30, 0x0a, 0x06, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x62, 0x69, 0x64, + 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x2f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x76, 0x65, 0x52, 0x61, + 0x74, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x6d, + 0x61, 0x78, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, + 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, + 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x56, 0x0a, 0x08, + 0x42, 0x69, 0x64, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x69, 0x64, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, + 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, 0x04, + 0x62, 0x69, 0x64, 0x73, 0x22, 0x33, 0x0a, 0x04, 0x42, 0x69, 0x64, 0x73, 0x12, 0x2b, 0x0a, 0x04, + 0x62, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x69, 0x64, 0x52, 0x04, 0x62, 0x69, 0x64, 0x73, 0x2a, 0xaa, 0x01, 0x0a, 0x0d, 0x41, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x1a, 0x41, + 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x41, + 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x41, 0x55, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x48, 0x45, + 0x44, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x12, + 0x25, 0x0a, 0x21, 0x41, 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x43, 0x4f, 0x4c, 0x4c, 0x41, 0x54, 0x48, + 0x45, 0x52, 0x41, 0x4c, 0x10, 0x04, 0x42, 0xbf, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x42, 0x0c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x52, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x41, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_auction_v1_auction_proto_rawDescOnce sync.Once + file_reserve_auction_v1_auction_proto_rawDescData = file_reserve_auction_v1_auction_proto_rawDesc +) + +func file_reserve_auction_v1_auction_proto_rawDescGZIP() []byte { + file_reserve_auction_v1_auction_proto_rawDescOnce.Do(func() { + file_reserve_auction_v1_auction_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_auction_v1_auction_proto_rawDescData) + }) + return file_reserve_auction_v1_auction_proto_rawDescData +} + +var file_reserve_auction_v1_auction_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_reserve_auction_v1_auction_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_reserve_auction_v1_auction_proto_goTypes = []interface{}{ + (AuctionStatus)(0), // 0: reserve.auction.v1.AuctionStatus + (*Auction)(nil), // 1: reserve.auction.v1.Auction + (*Bid)(nil), // 2: reserve.auction.v1.Bid + (*BidQueue)(nil), // 3: reserve.auction.v1.BidQueue + (*Bids)(nil), // 4: reserve.auction.v1.Bids + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp + (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin +} +var file_reserve_auction_v1_auction_proto_depIdxs = []int32{ + 5, // 0: reserve.auction.v1.Auction.start_time:type_name -> google.protobuf.Timestamp + 5, // 1: reserve.auction.v1.Auction.end_time:type_name -> google.protobuf.Timestamp + 6, // 2: reserve.auction.v1.Auction.initial_price:type_name -> cosmos.base.v1beta1.Coin + 6, // 3: reserve.auction.v1.Auction.item:type_name -> cosmos.base.v1beta1.Coin + 5, // 4: reserve.auction.v1.Auction.last_discount_time:type_name -> google.protobuf.Timestamp + 6, // 5: reserve.auction.v1.Auction.token_raised:type_name -> cosmos.base.v1beta1.Coin + 0, // 6: reserve.auction.v1.Auction.status:type_name -> reserve.auction.v1.AuctionStatus + 6, // 7: reserve.auction.v1.Auction.target_goal:type_name -> cosmos.base.v1beta1.Coin + 6, // 8: reserve.auction.v1.Bid.amount:type_name -> cosmos.base.v1beta1.Coin + 6, // 9: reserve.auction.v1.Bid.max_receive:type_name -> cosmos.base.v1beta1.Coin + 2, // 10: reserve.auction.v1.BidQueue.bids:type_name -> reserve.auction.v1.Bid + 2, // 11: reserve.auction.v1.Bids.bids:type_name -> reserve.auction.v1.Bid + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_reserve_auction_v1_auction_proto_init() } +func file_reserve_auction_v1_auction_proto_init() { + if File_reserve_auction_v1_auction_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_auction_v1_auction_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Auction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_auction_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Bid); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_auction_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BidQueue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_auction_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Bids); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_auction_v1_auction_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_auction_v1_auction_proto_goTypes, + DependencyIndexes: file_reserve_auction_v1_auction_proto_depIdxs, + EnumInfos: file_reserve_auction_v1_auction_proto_enumTypes, + MessageInfos: file_reserve_auction_v1_auction_proto_msgTypes, + }.Build() + File_reserve_auction_v1_auction_proto = out.File + file_reserve_auction_v1_auction_proto_rawDesc = nil + file_reserve_auction_v1_auction_proto_goTypes = nil + file_reserve_auction_v1_auction_proto_depIdxs = nil +} diff --git a/api/reserve/auction/v1/genesis.pulsar.go b/api/reserve/auction/v1/genesis.pulsar.go new file mode 100644 index 00000000..23c673b1 --- /dev/null +++ b/api/reserve/auction/v1/genesis.pulsar.go @@ -0,0 +1,905 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package auctionv1 + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Auction +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Auction) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Auction) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Auction) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(Auction) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_GenesisState_3_list)(nil) + +type _GenesisState_3_list struct { + list *[]*Bid +} + +func (x *_GenesisState_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bid) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_3_list) AppendMutable() protoreflect.Value { + v := new(Bid) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_3_list) NewElement() protoreflect.Value { + v := new(Bid) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_auctions protoreflect.FieldDescriptor + fd_GenesisState_bid_entries protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_genesis_proto_init() + md_GenesisState = File_reserve_auction_v1_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_auctions = md_GenesisState.Fields().ByName("auctions") + fd_GenesisState_bid_entries = md_GenesisState.Fields().ByName("bid_entries") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.Auctions) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Auctions}) + if !f(fd_GenesisState_auctions, value) { + return + } + } + if len(x.BidEntries) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_3_list{list: &x.BidEntries}) + if !f(fd_GenesisState_bid_entries, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.GenesisState.params": + return x.Params != nil + case "reserve.auction.v1.GenesisState.auctions": + return len(x.Auctions) != 0 + case "reserve.auction.v1.GenesisState.bid_entries": + return len(x.BidEntries) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.GenesisState.params": + x.Params = nil + case "reserve.auction.v1.GenesisState.auctions": + x.Auctions = nil + case "reserve.auction.v1.GenesisState.bid_entries": + x.BidEntries = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.GenesisState.auctions": + if len(x.Auctions) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.Auctions} + return protoreflect.ValueOfList(listValue) + case "reserve.auction.v1.GenesisState.bid_entries": + if len(x.BidEntries) == 0 { + return protoreflect.ValueOfList(&_GenesisState_3_list{}) + } + listValue := &_GenesisState_3_list{list: &x.BidEntries} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "reserve.auction.v1.GenesisState.auctions": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.Auctions = *clv.list + case "reserve.auction.v1.GenesisState.bid_entries": + lv := value.List() + clv := lv.(*_GenesisState_3_list) + x.BidEntries = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "reserve.auction.v1.GenesisState.auctions": + if x.Auctions == nil { + x.Auctions = []*Auction{} + } + value := &_GenesisState_2_list{list: &x.Auctions} + return protoreflect.ValueOfList(value) + case "reserve.auction.v1.GenesisState.bid_entries": + if x.BidEntries == nil { + x.BidEntries = []*Bid{} + } + value := &_GenesisState_3_list{list: &x.BidEntries} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.GenesisState.auctions": + list := []*Auction{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + case "reserve.auction.v1.GenesisState.bid_entries": + list := []*Bid{} + return protoreflect.ValueOfList(&_GenesisState_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.GenesisState")) + } + panic(fmt.Errorf("message reserve.auction.v1.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Auctions) > 0 { + for _, e := range x.Auctions { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.BidEntries) > 0 { + for _, e := range x.BidEntries { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.BidEntries) > 0 { + for iNdEx := len(x.BidEntries) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.BidEntries[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.Auctions) > 0 { + for iNdEx := len(x.Auctions) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Auctions[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Auctions = append(x.Auctions, &Auction{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Auctions[len(x.Auctions)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BidEntries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.BidEntries = append(x.BidEntries, &Bid{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BidEntries[len(x.BidEntries)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/auction/v1/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the auction module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + // list of auctions + Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty"` + // list of all bid entries + BidEntries []*Bid `protobuf:"bytes,3,rep,name=bid_entries,json=bidEntries,proto3" json:"bid_entries,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetAuctions() []*Auction { + if x != nil { + return x.Auctions + } + return nil +} + +func (x *GenesisState) GetBidEntries() []*Bid { + if x != nil { + return x.BidEntries + } + return nil +} + +var File_reserve_auction_v1_genesis_proto protoreflect.FileDescriptor + +var file_reserve_auction_v1_genesis_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xc0, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x62, + 0x69, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, 0x0a, 0x62, 0x69, 0x64, 0x45, 0x6e, + 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0xbf, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x52, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x1e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_auction_v1_genesis_proto_rawDescOnce sync.Once + file_reserve_auction_v1_genesis_proto_rawDescData = file_reserve_auction_v1_genesis_proto_rawDesc +) + +func file_reserve_auction_v1_genesis_proto_rawDescGZIP() []byte { + file_reserve_auction_v1_genesis_proto_rawDescOnce.Do(func() { + file_reserve_auction_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_auction_v1_genesis_proto_rawDescData) + }) + return file_reserve_auction_v1_genesis_proto_rawDescData +} + +var file_reserve_auction_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_auction_v1_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: reserve.auction.v1.GenesisState + (*Params)(nil), // 1: reserve.auction.v1.Params + (*Auction)(nil), // 2: reserve.auction.v1.Auction + (*Bid)(nil), // 3: reserve.auction.v1.Bid +} +var file_reserve_auction_v1_genesis_proto_depIdxs = []int32{ + 1, // 0: reserve.auction.v1.GenesisState.params:type_name -> reserve.auction.v1.Params + 2, // 1: reserve.auction.v1.GenesisState.auctions:type_name -> reserve.auction.v1.Auction + 3, // 2: reserve.auction.v1.GenesisState.bid_entries:type_name -> reserve.auction.v1.Bid + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_reserve_auction_v1_genesis_proto_init() } +func file_reserve_auction_v1_genesis_proto_init() { + if File_reserve_auction_v1_genesis_proto != nil { + return + } + file_reserve_auction_v1_params_proto_init() + file_reserve_auction_v1_auction_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_auction_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_auction_v1_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_auction_v1_genesis_proto_goTypes, + DependencyIndexes: file_reserve_auction_v1_genesis_proto_depIdxs, + MessageInfos: file_reserve_auction_v1_genesis_proto_msgTypes, + }.Build() + File_reserve_auction_v1_genesis_proto = out.File + file_reserve_auction_v1_genesis_proto_rawDesc = nil + file_reserve_auction_v1_genesis_proto_goTypes = nil + file_reserve_auction_v1_genesis_proto_depIdxs = nil +} diff --git a/api/reserve/auction/v1/params.pulsar.go b/api/reserve/auction/v1/params.pulsar.go new file mode 100644 index 00000000..e63b7e65 --- /dev/null +++ b/api/reserve/auction/v1/params.pulsar.go @@ -0,0 +1,928 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package auctionv1 + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_auction_periods protoreflect.FieldDescriptor + fd_Params_reduce_step protoreflect.FieldDescriptor + fd_Params_starting_rate protoreflect.FieldDescriptor + fd_Params_lowest_rate protoreflect.FieldDescriptor + fd_Params_discount_rate protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_params_proto_init() + md_Params = File_reserve_auction_v1_params_proto.Messages().ByName("Params") + fd_Params_auction_periods = md_Params.Fields().ByName("auction_periods") + fd_Params_reduce_step = md_Params.Fields().ByName("reduce_step") + fd_Params_starting_rate = md_Params.Fields().ByName("starting_rate") + fd_Params_lowest_rate = md_Params.Fields().ByName("lowest_rate") + fd_Params_discount_rate = md_Params.Fields().ByName("discount_rate") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AuctionPeriods != nil { + value := protoreflect.ValueOfMessage(x.AuctionPeriods.ProtoReflect()) + if !f(fd_Params_auction_periods, value) { + return + } + } + if x.ReduceStep != nil { + value := protoreflect.ValueOfMessage(x.ReduceStep.ProtoReflect()) + if !f(fd_Params_reduce_step, value) { + return + } + } + if x.StartingRate != "" { + value := protoreflect.ValueOfString(x.StartingRate) + if !f(fd_Params_starting_rate, value) { + return + } + } + if x.LowestRate != "" { + value := protoreflect.ValueOfString(x.LowestRate) + if !f(fd_Params_lowest_rate, value) { + return + } + } + if x.DiscountRate != "" { + value := protoreflect.ValueOfString(x.DiscountRate) + if !f(fd_Params_discount_rate, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.Params.auction_periods": + return x.AuctionPeriods != nil + case "reserve.auction.v1.Params.reduce_step": + return x.ReduceStep != nil + case "reserve.auction.v1.Params.starting_rate": + return x.StartingRate != "" + case "reserve.auction.v1.Params.lowest_rate": + return x.LowestRate != "" + case "reserve.auction.v1.Params.discount_rate": + return x.DiscountRate != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.Params.auction_periods": + x.AuctionPeriods = nil + case "reserve.auction.v1.Params.reduce_step": + x.ReduceStep = nil + case "reserve.auction.v1.Params.starting_rate": + x.StartingRate = "" + case "reserve.auction.v1.Params.lowest_rate": + x.LowestRate = "" + case "reserve.auction.v1.Params.discount_rate": + x.DiscountRate = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.Params.auction_periods": + value := x.AuctionPeriods + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Params.reduce_step": + value := x.ReduceStep + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.Params.starting_rate": + value := x.StartingRate + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.Params.lowest_rate": + value := x.LowestRate + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.Params.discount_rate": + value := x.DiscountRate + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.Params.auction_periods": + x.AuctionPeriods = value.Message().Interface().(*durationpb.Duration) + case "reserve.auction.v1.Params.reduce_step": + x.ReduceStep = value.Message().Interface().(*durationpb.Duration) + case "reserve.auction.v1.Params.starting_rate": + x.StartingRate = value.Interface().(string) + case "reserve.auction.v1.Params.lowest_rate": + x.LowestRate = value.Interface().(string) + case "reserve.auction.v1.Params.discount_rate": + x.DiscountRate = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Params.auction_periods": + if x.AuctionPeriods == nil { + x.AuctionPeriods = new(durationpb.Duration) + } + return protoreflect.ValueOfMessage(x.AuctionPeriods.ProtoReflect()) + case "reserve.auction.v1.Params.reduce_step": + if x.ReduceStep == nil { + x.ReduceStep = new(durationpb.Duration) + } + return protoreflect.ValueOfMessage(x.ReduceStep.ProtoReflect()) + case "reserve.auction.v1.Params.starting_rate": + panic(fmt.Errorf("field starting_rate of message reserve.auction.v1.Params is not mutable")) + case "reserve.auction.v1.Params.lowest_rate": + panic(fmt.Errorf("field lowest_rate of message reserve.auction.v1.Params is not mutable")) + case "reserve.auction.v1.Params.discount_rate": + panic(fmt.Errorf("field discount_rate of message reserve.auction.v1.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.Params.auction_periods": + m := new(durationpb.Duration) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Params.reduce_step": + m := new(durationpb.Duration) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.Params.starting_rate": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.Params.lowest_rate": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.Params.discount_rate": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.Params")) + } + panic(fmt.Errorf("message reserve.auction.v1.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.AuctionPeriods != nil { + l = options.Size(x.AuctionPeriods) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.ReduceStep != nil { + l = options.Size(x.ReduceStep) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.StartingRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.LowestRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DiscountRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.DiscountRate) > 0 { + i -= len(x.DiscountRate) + copy(dAtA[i:], x.DiscountRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DiscountRate))) + i-- + dAtA[i] = 0x2a + } + if len(x.LowestRate) > 0 { + i -= len(x.LowestRate) + copy(dAtA[i:], x.LowestRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LowestRate))) + i-- + dAtA[i] = 0x22 + } + if len(x.StartingRate) > 0 { + i -= len(x.StartingRate) + copy(dAtA[i:], x.StartingRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StartingRate))) + i-- + dAtA[i] = 0x1a + } + if x.ReduceStep != nil { + encoded, err := options.Marshal(x.ReduceStep) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.AuctionPeriods != nil { + encoded, err := options.Marshal(x.AuctionPeriods) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.AuctionPeriods == nil { + x.AuctionPeriods = &durationpb.Duration{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AuctionPeriods); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReduceStep", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ReduceStep == nil { + x.ReduceStep = &durationpb.Duration{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ReduceStep); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartingRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.StartingRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LowestRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LowestRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DiscountRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.DiscountRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/auction/v1/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // defines how long (either in blocktime or blockheight) + // between each auction + AuctionPeriods *durationpb.Duration `protobuf:"bytes,1,opt,name=auction_periods,json=auctionPeriods,proto3" json:"auction_periods,omitempty"` + // duration between each price reduction + ReduceStep *durationpb.Duration `protobuf:"bytes,2,opt,name=reduce_step,json=reduceStep,proto3" json:"reduce_step,omitempty"` + // rate compared with the collaterals price from the + // oracle at which the auction will start with + StartingRate string `protobuf:"bytes,3,opt,name=starting_rate,json=startingRate,proto3" json:"starting_rate,omitempty"` + // rate compared with the initial price that the price + // can drop to + LowestRate string `protobuf:"bytes,4,opt,name=lowest_rate,json=lowestRate,proto3" json:"lowest_rate,omitempty"` + // rate that are decrease every reduce_step + DiscountRate string `protobuf:"bytes,5,opt,name=discount_rate,json=discountRate,proto3" json:"discount_rate,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetAuctionPeriods() *durationpb.Duration { + if x != nil { + return x.AuctionPeriods + } + return nil +} + +func (x *Params) GetReduceStep() *durationpb.Duration { + if x != nil { + return x.ReduceStep + } + return nil +} + +func (x *Params) GetStartingRate() string { + if x != nil { + return x.StartingRate + } + return "" +} + +func (x *Params) GetLowestRate() string { + if x != nil { + return x.LowestRate + } + return "" +} + +func (x *Params) GetDiscountRate() string { + if x != nil { + return x.DiscountRate + } + return "" +} + +var File_reserve_auction_v1_params_proto protoreflect.FileDescriptor + +var file_reserve_auction_v1_params_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, + 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe4, 0x02, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x51, 0x0a, 0x0f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, + 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x12, 0x49, 0x0a, 0x0b, 0x72, 0x65, 0x64, 0x75, 0x63, + 0x65, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, + 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x53, 0x74, + 0x65, 0x70, 0x12, 0x33, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x69, 0x6e, 0x67, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x6c, 0x6f, 0x77, 0x65, 0x73, + 0x74, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0a, 0x6c, 0x6f, + 0x77, 0x65, 0x73, 0x74, 0x52, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, + 0x0c, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x61, 0x74, 0x65, 0x3a, 0x21, 0xe8, + 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x78, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0xbe, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, + 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x41, 0x58, 0xaa, + 0x02, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_auction_v1_params_proto_rawDescOnce sync.Once + file_reserve_auction_v1_params_proto_rawDescData = file_reserve_auction_v1_params_proto_rawDesc +) + +func file_reserve_auction_v1_params_proto_rawDescGZIP() []byte { + file_reserve_auction_v1_params_proto_rawDescOnce.Do(func() { + file_reserve_auction_v1_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_auction_v1_params_proto_rawDescData) + }) + return file_reserve_auction_v1_params_proto_rawDescData +} + +var file_reserve_auction_v1_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_auction_v1_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: reserve.auction.v1.Params + (*durationpb.Duration)(nil), // 1: google.protobuf.Duration +} +var file_reserve_auction_v1_params_proto_depIdxs = []int32{ + 1, // 0: reserve.auction.v1.Params.auction_periods:type_name -> google.protobuf.Duration + 1, // 1: reserve.auction.v1.Params.reduce_step:type_name -> google.protobuf.Duration + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_reserve_auction_v1_params_proto_init() } +func file_reserve_auction_v1_params_proto_init() { + if File_reserve_auction_v1_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_auction_v1_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_auction_v1_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_auction_v1_params_proto_goTypes, + DependencyIndexes: file_reserve_auction_v1_params_proto_depIdxs, + MessageInfos: file_reserve_auction_v1_params_proto_msgTypes, + }.Build() + File_reserve_auction_v1_params_proto = out.File + file_reserve_auction_v1_params_proto_rawDesc = nil + file_reserve_auction_v1_params_proto_goTypes = nil + file_reserve_auction_v1_params_proto_depIdxs = nil +} diff --git a/api/reserve/auction/v1/tx.pulsar.go b/api/reserve/auction/v1/tx.pulsar.go new file mode 100644 index 00000000..81b0e364 --- /dev/null +++ b/api/reserve/auction/v1/tx.pulsar.go @@ -0,0 +1,3206 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package auctionv1 + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgUpdateParams = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.MsgUpdateParams.authority": + return x.Authority != "" + case "reserve.auction.v1.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.MsgUpdateParams.authority": + x.Authority = "" + case "reserve.auction.v1.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "reserve.auction.v1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "reserve.auction.v1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message reserve.auction.v1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgUpdateParamsResponse = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgBid protoreflect.MessageDescriptor + fd_MsgBid_bidder protoreflect.FieldDescriptor + fd_MsgBid_auction_id protoreflect.FieldDescriptor + fd_MsgBid_amount protoreflect.FieldDescriptor + fd_MsgBid_recive_rate protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgBid = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgBid") + fd_MsgBid_bidder = md_MsgBid.Fields().ByName("bidder") + fd_MsgBid_auction_id = md_MsgBid.Fields().ByName("auction_id") + fd_MsgBid_amount = md_MsgBid.Fields().ByName("amount") + fd_MsgBid_recive_rate = md_MsgBid.Fields().ByName("recive_rate") +} + +var _ protoreflect.Message = (*fastReflection_MsgBid)(nil) + +type fastReflection_MsgBid MsgBid + +func (x *MsgBid) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBid)(x) +} + +func (x *MsgBid) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgBid_messageType fastReflection_MsgBid_messageType +var _ protoreflect.MessageType = fastReflection_MsgBid_messageType{} + +type fastReflection_MsgBid_messageType struct{} + +func (x fastReflection_MsgBid_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBid)(nil) +} +func (x fastReflection_MsgBid_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBid) +} +func (x fastReflection_MsgBid_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBid +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBid) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBid +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgBid) Type() protoreflect.MessageType { + return _fastReflection_MsgBid_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBid) New() protoreflect.Message { + return new(fastReflection_MsgBid) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBid) Interface() protoreflect.ProtoMessage { + return (*MsgBid)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgBid) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Bidder != "" { + value := protoreflect.ValueOfString(x.Bidder) + if !f(fd_MsgBid_bidder, value) { + return + } + } + if x.AuctionId != uint64(0) { + value := protoreflect.ValueOfUint64(x.AuctionId) + if !f(fd_MsgBid_auction_id, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgBid_amount, value) { + return + } + } + if x.ReciveRate != "" { + value := protoreflect.ValueOfString(x.ReciveRate) + if !f(fd_MsgBid_recive_rate, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgBid) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.MsgBid.bidder": + return x.Bidder != "" + case "reserve.auction.v1.MsgBid.auction_id": + return x.AuctionId != uint64(0) + case "reserve.auction.v1.MsgBid.amount": + return x.Amount != nil + case "reserve.auction.v1.MsgBid.recive_rate": + return x.ReciveRate != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBid) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.MsgBid.bidder": + x.Bidder = "" + case "reserve.auction.v1.MsgBid.auction_id": + x.AuctionId = uint64(0) + case "reserve.auction.v1.MsgBid.amount": + x.Amount = nil + case "reserve.auction.v1.MsgBid.recive_rate": + x.ReciveRate = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgBid) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.MsgBid.bidder": + value := x.Bidder + return protoreflect.ValueOfString(value) + case "reserve.auction.v1.MsgBid.auction_id": + value := x.AuctionId + return protoreflect.ValueOfUint64(value) + case "reserve.auction.v1.MsgBid.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.auction.v1.MsgBid.recive_rate": + value := x.ReciveRate + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBid) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.MsgBid.bidder": + x.Bidder = value.Interface().(string) + case "reserve.auction.v1.MsgBid.auction_id": + x.AuctionId = value.Uint() + case "reserve.auction.v1.MsgBid.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + case "reserve.auction.v1.MsgBid.recive_rate": + x.ReciveRate = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBid) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgBid.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.auction.v1.MsgBid.bidder": + panic(fmt.Errorf("field bidder of message reserve.auction.v1.MsgBid is not mutable")) + case "reserve.auction.v1.MsgBid.auction_id": + panic(fmt.Errorf("field auction_id of message reserve.auction.v1.MsgBid is not mutable")) + case "reserve.auction.v1.MsgBid.recive_rate": + panic(fmt.Errorf("field recive_rate of message reserve.auction.v1.MsgBid is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgBid) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgBid.bidder": + return protoreflect.ValueOfString("") + case "reserve.auction.v1.MsgBid.auction_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.auction.v1.MsgBid.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.auction.v1.MsgBid.recive_rate": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBid does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgBid) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgBid", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgBid) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBid) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgBid) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgBid) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBid) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Bidder) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.AuctionId != 0 { + n += 1 + runtime.Sov(uint64(x.AuctionId)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ReciveRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgBid) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ReciveRate) > 0 { + i -= len(x.ReciveRate) + copy(dAtA[i:], x.ReciveRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReciveRate))) + i-- + dAtA[i] = 0x22 + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if x.AuctionId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AuctionId)) + i-- + dAtA[i] = 0x10 + } + if len(x.Bidder) > 0 { + i -= len(x.Bidder) + copy(dAtA[i:], x.Bidder) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Bidder))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgBid) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + x.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReciveRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ReciveRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgBidResponse protoreflect.MessageDescriptor + fd_MsgBidResponse_response protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgBidResponse = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgBidResponse") + fd_MsgBidResponse_response = md_MsgBidResponse.Fields().ByName("response") +} + +var _ protoreflect.Message = (*fastReflection_MsgBidResponse)(nil) + +type fastReflection_MsgBidResponse MsgBidResponse + +func (x *MsgBidResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBidResponse)(x) +} + +func (x *MsgBidResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgBidResponse_messageType fastReflection_MsgBidResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgBidResponse_messageType{} + +type fastReflection_MsgBidResponse_messageType struct{} + +func (x fastReflection_MsgBidResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBidResponse)(nil) +} +func (x fastReflection_MsgBidResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBidResponse) +} +func (x fastReflection_MsgBidResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBidResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBidResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBidResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgBidResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgBidResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBidResponse) New() protoreflect.Message { + return new(fastReflection_MsgBidResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBidResponse) Interface() protoreflect.ProtoMessage { + return (*MsgBidResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgBidResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Response != "" { + value := protoreflect.ValueOfString(x.Response) + if !f(fd_MsgBidResponse_response, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgBidResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + return x.Response != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBidResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + x.Response = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgBidResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + value := x.Response + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBidResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + x.Response = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBidResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + panic(fmt.Errorf("field response of message reserve.auction.v1.MsgBidResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgBidResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgBidResponse.response": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgBidResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgBidResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgBidResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgBidResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgBidResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgBidResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgBidResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBidResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Response) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgBidResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Response) > 0 { + i -= len(x.Response) + copy(dAtA[i:], x.Response) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgBidResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Response = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCancelBid protoreflect.MessageDescriptor + fd_MsgCancelBid_bid_id protoreflect.FieldDescriptor + fd_MsgCancelBid_auction_id protoreflect.FieldDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgCancelBid = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgCancelBid") + fd_MsgCancelBid_bid_id = md_MsgCancelBid.Fields().ByName("bid_id") + fd_MsgCancelBid_auction_id = md_MsgCancelBid.Fields().ByName("auction_id") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelBid)(nil) + +type fastReflection_MsgCancelBid MsgCancelBid + +func (x *MsgCancelBid) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelBid)(x) +} + +func (x *MsgCancelBid) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCancelBid_messageType fastReflection_MsgCancelBid_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelBid_messageType{} + +type fastReflection_MsgCancelBid_messageType struct{} + +func (x fastReflection_MsgCancelBid_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelBid)(nil) +} +func (x fastReflection_MsgCancelBid_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelBid) +} +func (x fastReflection_MsgCancelBid_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelBid +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelBid) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelBid +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCancelBid) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelBid_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelBid) New() protoreflect.Message { + return new(fastReflection_MsgCancelBid) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelBid) Interface() protoreflect.ProtoMessage { + return (*MsgCancelBid)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCancelBid) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.BidId != uint64(0) { + value := protoreflect.ValueOfUint64(x.BidId) + if !f(fd_MsgCancelBid_bid_id, value) { + return + } + } + if x.AuctionId != uint64(0) { + value := protoreflect.ValueOfUint64(x.AuctionId) + if !f(fd_MsgCancelBid_auction_id, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCancelBid) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + return x.BidId != uint64(0) + case "reserve.auction.v1.MsgCancelBid.auction_id": + return x.AuctionId != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBid) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + x.BidId = uint64(0) + case "reserve.auction.v1.MsgCancelBid.auction_id": + x.AuctionId = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCancelBid) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + value := x.BidId + return protoreflect.ValueOfUint64(value) + case "reserve.auction.v1.MsgCancelBid.auction_id": + value := x.AuctionId + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBid) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + x.BidId = value.Uint() + case "reserve.auction.v1.MsgCancelBid.auction_id": + x.AuctionId = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBid) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + panic(fmt.Errorf("field bid_id of message reserve.auction.v1.MsgCancelBid is not mutable")) + case "reserve.auction.v1.MsgCancelBid.auction_id": + panic(fmt.Errorf("field auction_id of message reserve.auction.v1.MsgCancelBid is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCancelBid) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.auction.v1.MsgCancelBid.bid_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.auction.v1.MsgCancelBid.auction_id": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBid")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBid does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCancelBid) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgCancelBid", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCancelBid) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBid) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCancelBid) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCancelBid) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelBid) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.BidId != 0 { + n += 1 + runtime.Sov(uint64(x.BidId)) + } + if x.AuctionId != 0 { + n += 1 + runtime.Sov(uint64(x.AuctionId)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelBid) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.AuctionId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AuctionId)) + i-- + dAtA[i] = 0x10 + } + if x.BidId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BidId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelBid) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BidId", wireType) + } + x.BidId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BidId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + x.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCancelBidResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_auction_v1_tx_proto_init() + md_MsgCancelBidResponse = File_reserve_auction_v1_tx_proto.Messages().ByName("MsgCancelBidResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelBidResponse)(nil) + +type fastReflection_MsgCancelBidResponse MsgCancelBidResponse + +func (x *MsgCancelBidResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelBidResponse)(x) +} + +func (x *MsgCancelBidResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCancelBidResponse_messageType fastReflection_MsgCancelBidResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelBidResponse_messageType{} + +type fastReflection_MsgCancelBidResponse_messageType struct{} + +func (x fastReflection_MsgCancelBidResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelBidResponse)(nil) +} +func (x fastReflection_MsgCancelBidResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelBidResponse) +} +func (x fastReflection_MsgCancelBidResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelBidResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelBidResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelBidResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCancelBidResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelBidResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelBidResponse) New() protoreflect.Message { + return new(fastReflection_MsgCancelBidResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelBidResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCancelBidResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCancelBidResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCancelBidResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBidResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCancelBidResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBidResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBidResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCancelBidResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.auction.v1.MsgCancelBidResponse")) + } + panic(fmt.Errorf("message reserve.auction.v1.MsgCancelBidResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCancelBidResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.auction.v1.MsgCancelBidResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCancelBidResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCancelBidResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCancelBidResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCancelBidResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelBidResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelBidResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelBidResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/auction/v1/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgBid is the Msg/Bid request type. +type MsgBid struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // bidder is the address that submitting the bid entry. + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + // bidding auction id + AuctionId uint64 `protobuf:"varint,2,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // amount defines the amount that the bidder willing to pay. + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + // recive_rate defines the rate compare to the price at the start of the auction + // that the bid is willing to pay + ReciveRate string `protobuf:"bytes,4,opt,name=recive_rate,json=reciveRate,proto3" json:"recive_rate,omitempty"` +} + +func (x *MsgBid) Reset() { + *x = MsgBid{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBid) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBid) ProtoMessage() {} + +// Deprecated: Use MsgBid.ProtoReflect.Descriptor instead. +func (*MsgBid) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgBid) GetBidder() string { + if x != nil { + return x.Bidder + } + return "" +} + +func (x *MsgBid) GetAuctionId() uint64 { + if x != nil { + return x.AuctionId + } + return 0 +} + +func (x *MsgBid) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +func (x *MsgBid) GetReciveRate() string { + if x != nil { + return x.ReciveRate + } + return "" +} + +// MsgBidResponse defines the response structure for executing a +// MsgBid message. +type MsgBidResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *MsgBidResponse) Reset() { + *x = MsgBidResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBidResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBidResponse) ProtoMessage() {} + +// Deprecated: Use MsgBidResponse.ProtoReflect.Descriptor instead. +func (*MsgBidResponse) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *MsgBidResponse) GetResponse() string { + if x != nil { + return x.Response + } + return "" +} + +// MsgCancelBid is the Msg/CancelBid request type. +type MsgCancelBid struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // bid_id is the unique id. + BidId uint64 `protobuf:"varint,1,opt,name=bid_id,json=bidId,proto3" json:"bid_id,omitempty"` + // bidding auction id + AuctionId uint64 `protobuf:"varint,2,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` +} + +func (x *MsgCancelBid) Reset() { + *x = MsgCancelBid{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelBid) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelBid) ProtoMessage() {} + +// Deprecated: Use MsgCancelBid.ProtoReflect.Descriptor instead. +func (*MsgCancelBid) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgCancelBid) GetBidId() uint64 { + if x != nil { + return x.BidId + } + return 0 +} + +func (x *MsgCancelBid) GetAuctionId() uint64 { + if x != nil { + return x.AuctionId + } + return 0 +} + +// MsgCancelBidResponse defines the response structure for executing a +// MsgCancelBid message. +type MsgCancelBidResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCancelBidResponse) Reset() { + *x = MsgCancelBidResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_auction_v1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelBidResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelBidResponse) ProtoMessage() {} + +// Deprecated: Use MsgCancelBidResponse.ProtoReflect.Descriptor instead. +func (*MsgCancelBidResponse) Descriptor() ([]byte, []int) { + return file_reserve_auction_v1_tx_proto_rawDescGZIP(), []int{5} +} + +var File_reserve_auction_v1_tx_proto protoreflect.FileDescriptor + +var file_reserve_auction_v1_tx_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, + 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3d, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x33, 0x82, 0xe7, 0xb0, 0x2a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x20, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x78, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, + 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x06, 0x4d, + 0x73, 0x67, 0x42, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x06, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x69, 0x76, 0x65, 0x5f, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x76, + 0x65, 0x52, 0x61, 0x74, 0x65, 0x3a, 0x28, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x62, 0x69, 0x64, 0x64, + 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x78, + 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x4d, 0x73, 0x67, 0x42, 0x69, 0x64, 0x22, + 0x2c, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x74, 0x0a, + 0x0c, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x69, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x62, 0x69, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x62, + 0x69, 0x64, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x3a, 0x2e, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, + 0x8a, 0xe7, 0xb0, 0x2a, 0x1e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x78, 0x2f, 0x61, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x42, 0x69, 0x64, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8e, 0x02, 0x0a, 0x03, + 0x4d, 0x73, 0x67, 0x12, 0x60, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x23, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2b, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, 0x1a, 0x2e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x69, 0x64, 0x1a, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x09, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x69, 0x64, 0x12, 0x20, 0x2e, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x69, 0x64, 0x1a, 0x28, 0x2e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xba, 0x01, 0x0a, + 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x61, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, + 0x31, 0xa2, 0x02, 0x03, 0x52, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, + 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x41, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x41, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_reserve_auction_v1_tx_proto_rawDescOnce sync.Once + file_reserve_auction_v1_tx_proto_rawDescData = file_reserve_auction_v1_tx_proto_rawDesc +) + +func file_reserve_auction_v1_tx_proto_rawDescGZIP() []byte { + file_reserve_auction_v1_tx_proto_rawDescOnce.Do(func() { + file_reserve_auction_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_auction_v1_tx_proto_rawDescData) + }) + return file_reserve_auction_v1_tx_proto_rawDescData +} + +var file_reserve_auction_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_reserve_auction_v1_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: reserve.auction.v1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: reserve.auction.v1.MsgUpdateParamsResponse + (*MsgBid)(nil), // 2: reserve.auction.v1.MsgBid + (*MsgBidResponse)(nil), // 3: reserve.auction.v1.MsgBidResponse + (*MsgCancelBid)(nil), // 4: reserve.auction.v1.MsgCancelBid + (*MsgCancelBidResponse)(nil), // 5: reserve.auction.v1.MsgCancelBidResponse + (*Params)(nil), // 6: reserve.auction.v1.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin +} +var file_reserve_auction_v1_tx_proto_depIdxs = []int32{ + 6, // 0: reserve.auction.v1.MsgUpdateParams.params:type_name -> reserve.auction.v1.Params + 7, // 1: reserve.auction.v1.MsgBid.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 2: reserve.auction.v1.Msg.UpdateParams:input_type -> reserve.auction.v1.MsgUpdateParams + 2, // 3: reserve.auction.v1.Msg.Bid:input_type -> reserve.auction.v1.MsgBid + 4, // 4: reserve.auction.v1.Msg.CancelBid:input_type -> reserve.auction.v1.MsgCancelBid + 1, // 5: reserve.auction.v1.Msg.UpdateParams:output_type -> reserve.auction.v1.MsgUpdateParamsResponse + 3, // 6: reserve.auction.v1.Msg.Bid:output_type -> reserve.auction.v1.MsgBidResponse + 5, // 7: reserve.auction.v1.Msg.CancelBid:output_type -> reserve.auction.v1.MsgCancelBidResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_reserve_auction_v1_tx_proto_init() } +func file_reserve_auction_v1_tx_proto_init() { + if File_reserve_auction_v1_tx_proto != nil { + return + } + file_reserve_auction_v1_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_auction_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBid); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBidResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelBid); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_auction_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelBidResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_auction_v1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_reserve_auction_v1_tx_proto_goTypes, + DependencyIndexes: file_reserve_auction_v1_tx_proto_depIdxs, + MessageInfos: file_reserve_auction_v1_tx_proto_msgTypes, + }.Build() + File_reserve_auction_v1_tx_proto = out.File + file_reserve_auction_v1_tx_proto_rawDesc = nil + file_reserve_auction_v1_tx_proto_goTypes = nil + file_reserve_auction_v1_tx_proto_depIdxs = nil +} diff --git a/api/reserve/auction/v1/tx_grpc.pb.go b/api/reserve/auction/v1/tx_grpc.pb.go new file mode 100644 index 00000000..253cf735 --- /dev/null +++ b/api/reserve/auction/v1/tx_grpc.pb.go @@ -0,0 +1,209 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: reserve/auction/v1/tx.proto + +package auctionv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Msg_UpdateParams_FullMethodName = "/reserve.auction.v1.Msg/UpdateParams" + Msg_Bid_FullMethodName = "/reserve.auction.v1.Msg/Bid" + Msg_CancelBid_FullMethodName = "/reserve.auction.v1.Msg/CancelBid" +) + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Msg defines the Msg service. +type MsgClient interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // Bid defines an operation for submit a bid entry. + Bid(ctx context.Context, in *MsgBid, opts ...grpc.CallOption) (*MsgBidResponse, error) + // CancelBid defines an operation for cancel an existing bid entry. + CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Bid(ctx context.Context, in *MsgBid, opts ...grpc.CallOption) (*MsgBidResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgBidResponse) + err := c.cc.Invoke(ctx, Msg_Bid_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgCancelBidResponse) + err := c.cc.Invoke(ctx, Msg_CancelBid_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +// All implementations must embed UnimplementedMsgServer +// for forward compatibility. +// +// Msg defines the Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // Bid defines an operation for submit a bid entry. + Bid(context.Context, *MsgBid) (*MsgBidResponse, error) + // CancelBid defines an operation for cancel an existing bid entry. + CancelBid(context.Context, *MsgCancelBid) (*MsgCancelBidResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMsgServer struct{} + +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (UnimplementedMsgServer) Bid(context.Context, *MsgBid) (*MsgBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bid not implemented") +} +func (UnimplementedMsgServer) CancelBid(context.Context, *MsgCancelBid) (*MsgCancelBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelBid not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Msg_ServiceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParams_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Bid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Bid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Bid_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Bid(ctx, req.(*MsgBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CancelBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CancelBid_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelBid(ctx, req.(*MsgCancelBid)) + } + return interceptor(ctx, in, info, handler) +} + +// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Msg_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.auction.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "Bid", + Handler: _Msg_Bid_Handler, + }, + { + MethodName: "CancelBid", + Handler: _Msg_CancelBid_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/auction/v1/tx.proto", +} diff --git a/api/reserve/oracle/genesis.pulsar.go b/api/reserve/oracle/genesis.pulsar.go index 3bf2c41f..94db6788 100644 --- a/api/reserve/oracle/genesis.pulsar.go +++ b/api/reserve/oracle/genesis.pulsar.go @@ -2,17 +2,16 @@ package oracle import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/reserve/oracle/module/module.pulsar.go b/api/reserve/oracle/module/module.pulsar.go index 62ea9a4a..7d438939 100644 --- a/api/reserve/oracle/module/module.pulsar.go +++ b/api/reserve/oracle/module/module.pulsar.go @@ -2,16 +2,15 @@ package module import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( @@ -453,7 +452,8 @@ type Module struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // authority defines the custom module authority. If not set, defaults to the governance module. + // authority defines the custom module authority. If not set, defaults to the + // governance module. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` } @@ -492,24 +492,26 @@ var file_reserve_oracle_module_module_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x59, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x18, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x12, 0x0a, 0x10, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x78, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, - 0xc6, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, - 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x52, 0x4f, 0x4d, 0xaa, 0x02, 0x15, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0xca, 0x02, 0x15, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x21, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x17, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x31, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2b, 0x0a, 0x29, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x78, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0xc6, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, + 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, + 0x52, 0x4f, 0x4d, 0xaa, 0x02, 0x15, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x15, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x21, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/reserve/oracle/packet.pulsar.go b/api/reserve/oracle/packet.pulsar.go index 0f31fc99..d58e4ceb 100644 --- a/api/reserve/oracle/packet.pulsar.go +++ b/api/reserve/oracle/packet.pulsar.go @@ -3,14 +3,13 @@ package oracle import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/reserve/oracle/params.pulsar.go b/api/reserve/oracle/params.pulsar.go index 3af87e11..5df20a84 100644 --- a/api/reserve/oracle/params.pulsar.go +++ b/api/reserve/oracle/params.pulsar.go @@ -2,17 +2,16 @@ package oracle import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/reserve/oracle/query.pulsar.go b/api/reserve/oracle/query.pulsar.go index 26fbe89a..8853fd23 100644 --- a/api/reserve/oracle/query.pulsar.go +++ b/api/reserve/oracle/query.pulsar.go @@ -2,19 +2,17 @@ package oracle import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( @@ -895,36 +893,33 @@ var file_reserve_oracle_query_proto_rawDesc = []byte{ 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, - 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, - 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x32, 0x7a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x71, 0x0a, - 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x72, 0x65, + 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x7a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x71, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, - 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x52, 0x4f, 0x58, 0xaa, 0x02, 0x0e, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0e, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, - 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x23, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x52, 0x4f, 0x58, + 0xaa, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0xca, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xe2, 0x02, 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0f, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/reserve/oracle/query_grpc.pb.go b/api/reserve/oracle/query_grpc.pb.go index b70263ee..b5b8780f 100644 --- a/api/reserve/oracle/query_grpc.pb.go +++ b/api/reserve/oracle/query_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: reserve/oracle/query.proto @@ -8,7 +8,6 @@ package oracle import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Query_Params_FullMethodName = "/reserve.oracle.Query/Params" @@ -26,6 +25,8 @@ const ( // QueryClient is the client API for Query service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Query defines the gRPC querier service. type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) @@ -40,8 +41,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { } func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -50,21 +52,27 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer -// for forward compatibility +// for forward compatibility. +// +// Query defines the gRPC querier service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) mustEmbedUnimplementedQueryServer() } -// UnimplementedQueryServer must be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +// UnimplementedQueryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedQueryServer struct{} func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} +func (UnimplementedQueryServer) testEmbeddedByValue() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to QueryServer will @@ -74,6 +82,13 @@ type UnsafeQueryServer interface { } func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + // If the following call pancis, it indicates UnimplementedQueryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Query_ServiceDesc, srv) } diff --git a/api/reserve/oracle/tx.pulsar.go b/api/reserve/oracle/tx.pulsar.go index 151986d9..f2fa4496 100644 --- a/api/reserve/oracle/tx.pulsar.go +++ b/api/reserve/oracle/tx.pulsar.go @@ -2,19 +2,18 @@ package oracle import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( @@ -891,7 +890,8 @@ type MsgUpdateParams struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the module parameters to update. // diff --git a/api/reserve/oracle/tx_grpc.pb.go b/api/reserve/oracle/tx_grpc.pb.go index 89c21dc9..c1e65e4d 100644 --- a/api/reserve/oracle/tx_grpc.pb.go +++ b/api/reserve/oracle/tx_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: reserve/oracle/tx.proto @@ -8,7 +8,6 @@ package oracle import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Msg_UpdateParams_FullMethodName = "/reserve.oracle.Msg/UpdateParams" @@ -26,6 +25,8 @@ const ( // MsgClient is the client API for Msg service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Msg defines the Msg service. type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. @@ -41,8 +42,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { } func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -51,7 +53,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer -// for forward compatibility +// for forward compatibility. +// +// Msg defines the Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. @@ -59,14 +63,18 @@ type MsgServer interface { mustEmbedUnimplementedMsgServer() } -// UnimplementedMsgServer must be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMsgServer struct{} func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MsgServer will @@ -76,6 +84,13 @@ type UnsafeMsgServer interface { } func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Msg_ServiceDesc, srv) } diff --git a/api/reserve/psm/module/v1/module.pulsar.go b/api/reserve/psm/module/v1/module.pulsar.go new file mode 100644 index 00000000..03e4341d --- /dev/null +++ b/api/reserve/psm/module/v1/module.pulsar.go @@ -0,0 +1,577 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package modulev1 + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_reserve_psm_module_v1_module_proto_init() + md_Module = File_reserve_psm_module_v1_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_psm_module_v1_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.psm.module.v1.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.psm.module.v1.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.psm.module.v1.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.psm.module.v1.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.psm.module.v1.Module.authority": + panic(fmt.Errorf("field authority of message reserve.psm.module.v1.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.psm.module.v1.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.psm.module.v1.Module")) + } + panic(fmt.Errorf("message reserve.psm.module.v1.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.psm.module.v1.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/psm/module/v1/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_psm_module_v1_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_reserve_psm_module_v1_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_reserve_psm_module_v1_module_proto protoreflect.FileDescriptor + +var file_reserve_psm_module_v1_module_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x73, 0x6d, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x73, 0x6d, 0x2e, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x06, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x70, 0x73, 0x6d, 0x42, + 0xca, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x73, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x73, 0x6d, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, + 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x50, + 0x4d, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x50, 0x73, 0x6d, 0x2e, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x50, 0x73, 0x6d, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x73, 0x6d, 0x5c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x50, 0x73, 0x6d, + 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_psm_module_v1_module_proto_rawDescOnce sync.Once + file_reserve_psm_module_v1_module_proto_rawDescData = file_reserve_psm_module_v1_module_proto_rawDesc +) + +func file_reserve_psm_module_v1_module_proto_rawDescGZIP() []byte { + file_reserve_psm_module_v1_module_proto_rawDescOnce.Do(func() { + file_reserve_psm_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_psm_module_v1_module_proto_rawDescData) + }) + return file_reserve_psm_module_v1_module_proto_rawDescData +} + +var file_reserve_psm_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_psm_module_v1_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: reserve.psm.module.v1.Module +} +var file_reserve_psm_module_v1_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_reserve_psm_module_v1_module_proto_init() } +func file_reserve_psm_module_v1_module_proto_init() { + if File_reserve_psm_module_v1_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_psm_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_psm_module_v1_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_psm_module_v1_module_proto_goTypes, + DependencyIndexes: file_reserve_psm_module_v1_module_proto_depIdxs, + MessageInfos: file_reserve_psm_module_v1_module_proto_msgTypes, + }.Build() + File_reserve_psm_module_v1_module_proto = out.File + file_reserve_psm_module_v1_module_proto_rawDesc = nil + file_reserve_psm_module_v1_module_proto_goTypes = nil + file_reserve_psm_module_v1_module_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/genesis.pulsar.go b/api/reserve/vaults/genesis.pulsar.go new file mode 100644 index 00000000..18467b18 --- /dev/null +++ b/api/reserve/vaults/genesis.pulsar.go @@ -0,0 +1,901 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vaults + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*VaultMamager +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VaultMamager) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VaultMamager) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(VaultMamager) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(VaultMamager) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_GenesisState_3_list)(nil) + +type _GenesisState_3_list struct { + list *[]*Vault +} + +func (x *_GenesisState_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Vault) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Vault) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_3_list) AppendMutable() protoreflect.Value { + v := new(Vault) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_3_list) NewElement() protoreflect.Value { + v := new(Vault) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_vault_managers protoreflect.FieldDescriptor + fd_GenesisState_vaults protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_genesis_proto_init() + md_GenesisState = File_reserve_vaults_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_vault_managers = md_GenesisState.Fields().ByName("vault_managers") + fd_GenesisState_vaults = md_GenesisState.Fields().ByName("vaults") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.VaultManagers) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.VaultManagers}) + if !f(fd_GenesisState_vault_managers, value) { + return + } + } + if len(x.Vaults) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_3_list{list: &x.Vaults}) + if !f(fd_GenesisState_vaults, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.GenesisState.params": + return x.Params != nil + case "reserve.vaults.GenesisState.vault_managers": + return len(x.VaultManagers) != 0 + case "reserve.vaults.GenesisState.vaults": + return len(x.Vaults) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.GenesisState.params": + x.Params = nil + case "reserve.vaults.GenesisState.vault_managers": + x.VaultManagers = nil + case "reserve.vaults.GenesisState.vaults": + x.Vaults = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.vaults.GenesisState.vault_managers": + if len(x.VaultManagers) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.VaultManagers} + return protoreflect.ValueOfList(listValue) + case "reserve.vaults.GenesisState.vaults": + if len(x.Vaults) == 0 { + return protoreflect.ValueOfList(&_GenesisState_3_list{}) + } + listValue := &_GenesisState_3_list{list: &x.Vaults} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "reserve.vaults.GenesisState.vault_managers": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.VaultManagers = *clv.list + case "reserve.vaults.GenesisState.vaults": + lv := value.List() + clv := lv.(*_GenesisState_3_list) + x.Vaults = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "reserve.vaults.GenesisState.vault_managers": + if x.VaultManagers == nil { + x.VaultManagers = []*VaultMamager{} + } + value := &_GenesisState_2_list{list: &x.VaultManagers} + return protoreflect.ValueOfList(value) + case "reserve.vaults.GenesisState.vaults": + if x.Vaults == nil { + x.Vaults = []*Vault{} + } + value := &_GenesisState_3_list{list: &x.Vaults} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.vaults.GenesisState.vault_managers": + list := []*VaultMamager{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + case "reserve.vaults.GenesisState.vaults": + list := []*Vault{} + return protoreflect.ValueOfList(&_GenesisState_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.GenesisState")) + } + panic(fmt.Errorf("message reserve.vaults.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.VaultManagers) > 0 { + for _, e := range x.VaultManagers { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.Vaults) > 0 { + for _, e := range x.Vaults { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Vaults) > 0 { + for iNdEx := len(x.Vaults) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Vaults[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.VaultManagers) > 0 { + for iNdEx := len(x.VaultManagers) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.VaultManagers[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VaultManagers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.VaultManagers = append(x.VaultManagers, &VaultMamager{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.VaultManagers[len(x.VaultManagers)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Vaults", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Vaults = append(x.Vaults, &Vault{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Vaults[len(x.Vaults)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the oracle module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + VaultManagers []*VaultMamager `protobuf:"bytes,2,rep,name=vault_managers,json=vaultManagers,proto3" json:"vault_managers,omitempty"` + Vaults []*Vault `protobuf:"bytes,3,rep,name=vaults,proto3" json:"vaults,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_reserve_vaults_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetVaultManagers() []*VaultMamager { + if x != nil { + return x.VaultManagers + } + return nil +} + +func (x *GenesisState) GetVaults() []*Vault { + if x != nil { + return x.Vaults + } + return nil +} + +var File_reserve_vaults_genesis_proto protoreflect.FileDescriptor + +var file_reserve_vaults_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x14, + 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xd3, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4e, 0x0a, 0x0e, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, + 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x6d, 0x61, 0x67, + 0x65, 0x72, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0d, 0x76, + 0x61, 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x73, 0x12, 0x38, 0x0a, 0x06, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x9c, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0c, 0x47, + 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xa2, 0x02, + 0x03, 0x52, 0x56, 0x58, 0xaa, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x56, + 0x61, 0x75, 0x6c, 0x74, 0x73, 0xca, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, + 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xe2, 0x02, 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x56, + 0x61, 0x75, 0x6c, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_vaults_genesis_proto_rawDescOnce sync.Once + file_reserve_vaults_genesis_proto_rawDescData = file_reserve_vaults_genesis_proto_rawDesc +) + +func file_reserve_vaults_genesis_proto_rawDescGZIP() []byte { + file_reserve_vaults_genesis_proto_rawDescOnce.Do(func() { + file_reserve_vaults_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_genesis_proto_rawDescData) + }) + return file_reserve_vaults_genesis_proto_rawDescData +} + +var file_reserve_vaults_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_vaults_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: reserve.vaults.GenesisState + (*Params)(nil), // 1: reserve.vaults.Params + (*VaultMamager)(nil), // 2: reserve.vaults.VaultMamager + (*Vault)(nil), // 3: reserve.vaults.Vault +} +var file_reserve_vaults_genesis_proto_depIdxs = []int32{ + 1, // 0: reserve.vaults.GenesisState.params:type_name -> reserve.vaults.Params + 2, // 1: reserve.vaults.GenesisState.vault_managers:type_name -> reserve.vaults.VaultMamager + 3, // 2: reserve.vaults.GenesisState.vaults:type_name -> reserve.vaults.Vault + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_genesis_proto_init() } +func file_reserve_vaults_genesis_proto_init() { + if File_reserve_vaults_genesis_proto != nil { + return + } + file_reserve_vaults_params_proto_init() + file_reserve_vaults_vault_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_vaults_genesis_proto_goTypes, + DependencyIndexes: file_reserve_vaults_genesis_proto_depIdxs, + MessageInfos: file_reserve_vaults_genesis_proto_msgTypes, + }.Build() + File_reserve_vaults_genesis_proto = out.File + file_reserve_vaults_genesis_proto_rawDesc = nil + file_reserve_vaults_genesis_proto_goTypes = nil + file_reserve_vaults_genesis_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/module/module.pulsar.go b/api/reserve/vaults/module/module.pulsar.go new file mode 100644 index 00000000..3479a31e --- /dev/null +++ b/api/reserve/vaults/module/module.pulsar.go @@ -0,0 +1,577 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_module_module_proto_init() + md_Module = File_reserve_vaults_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.module.Module.authority": + panic(fmt.Errorf("field authority of message reserve.vaults.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.module.Module")) + } + panic(fmt.Errorf("message reserve.vaults.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_reserve_vaults_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_reserve_vaults_module_module_proto protoreflect.FileDescriptor + +var file_reserve_vaults_module_module_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x59, 0x0a, + 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x31, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2b, 0x0a, 0x29, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x78, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x42, 0xc6, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, + 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, + 0x52, 0x56, 0x4d, 0xaa, 0x02, 0x15, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x15, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x21, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x3a, 0x3a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_vaults_module_module_proto_rawDescOnce sync.Once + file_reserve_vaults_module_module_proto_rawDescData = file_reserve_vaults_module_module_proto_rawDesc +) + +func file_reserve_vaults_module_module_proto_rawDescGZIP() []byte { + file_reserve_vaults_module_module_proto_rawDescOnce.Do(func() { + file_reserve_vaults_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_module_module_proto_rawDescData) + }) + return file_reserve_vaults_module_module_proto_rawDescData +} + +var file_reserve_vaults_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reserve_vaults_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: reserve.vaults.module.Module +} +var file_reserve_vaults_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_module_module_proto_init() } +func file_reserve_vaults_module_module_proto_init() { + if File_reserve_vaults_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_vaults_module_module_proto_goTypes, + DependencyIndexes: file_reserve_vaults_module_module_proto_depIdxs, + MessageInfos: file_reserve_vaults_module_module_proto_msgTypes, + }.Build() + File_reserve_vaults_module_module_proto = out.File + file_reserve_vaults_module_module_proto_rawDesc = nil + file_reserve_vaults_module_module_proto_goTypes = nil + file_reserve_vaults_module_module_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/params.pulsar.go b/api/reserve/vaults/params.pulsar.go new file mode 100644 index 00000000..3caea97f --- /dev/null +++ b/api/reserve/vaults/params.pulsar.go @@ -0,0 +1,1569 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vaults + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_minting_fee protoreflect.FieldDescriptor + fd_Params_stability_fee protoreflect.FieldDescriptor + fd_Params_liquidation_penalty protoreflect.FieldDescriptor + fd_Params_min_initial_debt protoreflect.FieldDescriptor + fd_Params_recalculate_debt_period protoreflect.FieldDescriptor + fd_Params_liquidate_period protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_params_proto_init() + md_Params = File_reserve_vaults_params_proto.Messages().ByName("Params") + fd_Params_minting_fee = md_Params.Fields().ByName("minting_fee") + fd_Params_stability_fee = md_Params.Fields().ByName("stability_fee") + fd_Params_liquidation_penalty = md_Params.Fields().ByName("liquidation_penalty") + fd_Params_min_initial_debt = md_Params.Fields().ByName("min_initial_debt") + fd_Params_recalculate_debt_period = md_Params.Fields().ByName("recalculate_debt_period") + fd_Params_liquidate_period = md_Params.Fields().ByName("liquidate_period") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MintingFee != "" { + value := protoreflect.ValueOfString(x.MintingFee) + if !f(fd_Params_minting_fee, value) { + return + } + } + if x.StabilityFee != "" { + value := protoreflect.ValueOfString(x.StabilityFee) + if !f(fd_Params_stability_fee, value) { + return + } + } + if x.LiquidationPenalty != "" { + value := protoreflect.ValueOfString(x.LiquidationPenalty) + if !f(fd_Params_liquidation_penalty, value) { + return + } + } + if x.MinInitialDebt != "" { + value := protoreflect.ValueOfString(x.MinInitialDebt) + if !f(fd_Params_min_initial_debt, value) { + return + } + } + if x.RecalculateDebtPeriod != uint64(0) { + value := protoreflect.ValueOfUint64(x.RecalculateDebtPeriod) + if !f(fd_Params_recalculate_debt_period, value) { + return + } + } + if x.LiquidatePeriod != uint64(0) { + value := protoreflect.ValueOfUint64(x.LiquidatePeriod) + if !f(fd_Params_liquidate_period, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.Params.minting_fee": + return x.MintingFee != "" + case "reserve.vaults.Params.stability_fee": + return x.StabilityFee != "" + case "reserve.vaults.Params.liquidation_penalty": + return x.LiquidationPenalty != "" + case "reserve.vaults.Params.min_initial_debt": + return x.MinInitialDebt != "" + case "reserve.vaults.Params.recalculate_debt_period": + return x.RecalculateDebtPeriod != uint64(0) + case "reserve.vaults.Params.liquidate_period": + return x.LiquidatePeriod != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.Params.minting_fee": + x.MintingFee = "" + case "reserve.vaults.Params.stability_fee": + x.StabilityFee = "" + case "reserve.vaults.Params.liquidation_penalty": + x.LiquidationPenalty = "" + case "reserve.vaults.Params.min_initial_debt": + x.MinInitialDebt = "" + case "reserve.vaults.Params.recalculate_debt_period": + x.RecalculateDebtPeriod = uint64(0) + case "reserve.vaults.Params.liquidate_period": + x.LiquidatePeriod = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.Params.minting_fee": + value := x.MintingFee + return protoreflect.ValueOfString(value) + case "reserve.vaults.Params.stability_fee": + value := x.StabilityFee + return protoreflect.ValueOfString(value) + case "reserve.vaults.Params.liquidation_penalty": + value := x.LiquidationPenalty + return protoreflect.ValueOfString(value) + case "reserve.vaults.Params.min_initial_debt": + value := x.MinInitialDebt + return protoreflect.ValueOfString(value) + case "reserve.vaults.Params.recalculate_debt_period": + value := x.RecalculateDebtPeriod + return protoreflect.ValueOfUint64(value) + case "reserve.vaults.Params.liquidate_period": + value := x.LiquidatePeriod + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.Params.minting_fee": + x.MintingFee = value.Interface().(string) + case "reserve.vaults.Params.stability_fee": + x.StabilityFee = value.Interface().(string) + case "reserve.vaults.Params.liquidation_penalty": + x.LiquidationPenalty = value.Interface().(string) + case "reserve.vaults.Params.min_initial_debt": + x.MinInitialDebt = value.Interface().(string) + case "reserve.vaults.Params.recalculate_debt_period": + x.RecalculateDebtPeriod = value.Uint() + case "reserve.vaults.Params.liquidate_period": + x.LiquidatePeriod = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.Params.minting_fee": + panic(fmt.Errorf("field minting_fee of message reserve.vaults.Params is not mutable")) + case "reserve.vaults.Params.stability_fee": + panic(fmt.Errorf("field stability_fee of message reserve.vaults.Params is not mutable")) + case "reserve.vaults.Params.liquidation_penalty": + panic(fmt.Errorf("field liquidation_penalty of message reserve.vaults.Params is not mutable")) + case "reserve.vaults.Params.min_initial_debt": + panic(fmt.Errorf("field min_initial_debt of message reserve.vaults.Params is not mutable")) + case "reserve.vaults.Params.recalculate_debt_period": + panic(fmt.Errorf("field recalculate_debt_period of message reserve.vaults.Params is not mutable")) + case "reserve.vaults.Params.liquidate_period": + panic(fmt.Errorf("field liquidate_period of message reserve.vaults.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.Params.minting_fee": + return protoreflect.ValueOfString("") + case "reserve.vaults.Params.stability_fee": + return protoreflect.ValueOfString("") + case "reserve.vaults.Params.liquidation_penalty": + return protoreflect.ValueOfString("") + case "reserve.vaults.Params.min_initial_debt": + return protoreflect.ValueOfString("") + case "reserve.vaults.Params.recalculate_debt_period": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.vaults.Params.liquidate_period": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) + } + panic(fmt.Errorf("message reserve.vaults.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.MintingFee) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.StabilityFee) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.LiquidationPenalty) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MinInitialDebt) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.RecalculateDebtPeriod != 0 { + n += 1 + runtime.Sov(uint64(x.RecalculateDebtPeriod)) + } + if x.LiquidatePeriod != 0 { + n += 1 + runtime.Sov(uint64(x.LiquidatePeriod)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.LiquidatePeriod != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.LiquidatePeriod)) + i-- + dAtA[i] = 0x30 + } + if x.RecalculateDebtPeriod != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RecalculateDebtPeriod)) + i-- + dAtA[i] = 0x28 + } + if len(x.MinInitialDebt) > 0 { + i -= len(x.MinInitialDebt) + copy(dAtA[i:], x.MinInitialDebt) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinInitialDebt))) + i-- + dAtA[i] = 0x22 + } + if len(x.LiquidationPenalty) > 0 { + i -= len(x.LiquidationPenalty) + copy(dAtA[i:], x.LiquidationPenalty) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LiquidationPenalty))) + i-- + dAtA[i] = 0x1a + } + if len(x.StabilityFee) > 0 { + i -= len(x.StabilityFee) + copy(dAtA[i:], x.StabilityFee) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StabilityFee))) + i-- + dAtA[i] = 0x12 + } + if len(x.MintingFee) > 0 { + i -= len(x.MintingFee) + copy(dAtA[i:], x.MintingFee) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MintingFee))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MintingFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MintingFee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StabilityFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.StabilityFee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LiquidationPenalty", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LiquidationPenalty = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinInitialDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MinInitialDebt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RecalculateDebtPeriod", wireType) + } + x.RecalculateDebtPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RecalculateDebtPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LiquidatePeriod", wireType) + } + x.LiquidatePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.LiquidatePeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_VaultMamagerParams protoreflect.MessageDescriptor + fd_VaultMamagerParams_min_collateral_ratio protoreflect.FieldDescriptor + fd_VaultMamagerParams_liquidation_ratio protoreflect.FieldDescriptor + fd_VaultMamagerParams_max_debt protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_params_proto_init() + md_VaultMamagerParams = File_reserve_vaults_params_proto.Messages().ByName("VaultMamagerParams") + fd_VaultMamagerParams_min_collateral_ratio = md_VaultMamagerParams.Fields().ByName("min_collateral_ratio") + fd_VaultMamagerParams_liquidation_ratio = md_VaultMamagerParams.Fields().ByName("liquidation_ratio") + fd_VaultMamagerParams_max_debt = md_VaultMamagerParams.Fields().ByName("max_debt") +} + +var _ protoreflect.Message = (*fastReflection_VaultMamagerParams)(nil) + +type fastReflection_VaultMamagerParams VaultMamagerParams + +func (x *VaultMamagerParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_VaultMamagerParams)(x) +} + +func (x *VaultMamagerParams) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_params_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_VaultMamagerParams_messageType fastReflection_VaultMamagerParams_messageType +var _ protoreflect.MessageType = fastReflection_VaultMamagerParams_messageType{} + +type fastReflection_VaultMamagerParams_messageType struct{} + +func (x fastReflection_VaultMamagerParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_VaultMamagerParams)(nil) +} +func (x fastReflection_VaultMamagerParams_messageType) New() protoreflect.Message { + return new(fastReflection_VaultMamagerParams) +} +func (x fastReflection_VaultMamagerParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_VaultMamagerParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_VaultMamagerParams) Descriptor() protoreflect.MessageDescriptor { + return md_VaultMamagerParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_VaultMamagerParams) Type() protoreflect.MessageType { + return _fastReflection_VaultMamagerParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_VaultMamagerParams) New() protoreflect.Message { + return new(fastReflection_VaultMamagerParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_VaultMamagerParams) Interface() protoreflect.ProtoMessage { + return (*VaultMamagerParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_VaultMamagerParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MinCollateralRatio != "" { + value := protoreflect.ValueOfString(x.MinCollateralRatio) + if !f(fd_VaultMamagerParams_min_collateral_ratio, value) { + return + } + } + if x.LiquidationRatio != "" { + value := protoreflect.ValueOfString(x.LiquidationRatio) + if !f(fd_VaultMamagerParams_liquidation_ratio, value) { + return + } + } + if x.MaxDebt != "" { + value := protoreflect.ValueOfString(x.MaxDebt) + if !f(fd_VaultMamagerParams_max_debt, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_VaultMamagerParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + return x.MinCollateralRatio != "" + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + return x.LiquidationRatio != "" + case "reserve.vaults.VaultMamagerParams.max_debt": + return x.MaxDebt != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamagerParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + x.MinCollateralRatio = "" + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + x.LiquidationRatio = "" + case "reserve.vaults.VaultMamagerParams.max_debt": + x.MaxDebt = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_VaultMamagerParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + value := x.MinCollateralRatio + return protoreflect.ValueOfString(value) + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + value := x.LiquidationRatio + return protoreflect.ValueOfString(value) + case "reserve.vaults.VaultMamagerParams.max_debt": + value := x.MaxDebt + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamagerParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + x.MinCollateralRatio = value.Interface().(string) + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + x.LiquidationRatio = value.Interface().(string) + case "reserve.vaults.VaultMamagerParams.max_debt": + x.MaxDebt = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamagerParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + panic(fmt.Errorf("field min_collateral_ratio of message reserve.vaults.VaultMamagerParams is not mutable")) + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + panic(fmt.Errorf("field liquidation_ratio of message reserve.vaults.VaultMamagerParams is not mutable")) + case "reserve.vaults.VaultMamagerParams.max_debt": + panic(fmt.Errorf("field max_debt of message reserve.vaults.VaultMamagerParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_VaultMamagerParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.VaultMamagerParams.min_collateral_ratio": + return protoreflect.ValueOfString("") + case "reserve.vaults.VaultMamagerParams.liquidation_ratio": + return protoreflect.ValueOfString("") + case "reserve.vaults.VaultMamagerParams.max_debt": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamagerParams")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamagerParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_VaultMamagerParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.VaultMamagerParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_VaultMamagerParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamagerParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_VaultMamagerParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_VaultMamagerParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*VaultMamagerParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.MinCollateralRatio) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.LiquidationRatio) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MaxDebt) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*VaultMamagerParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.MaxDebt) > 0 { + i -= len(x.MaxDebt) + copy(dAtA[i:], x.MaxDebt) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxDebt))) + i-- + dAtA[i] = 0x1a + } + if len(x.LiquidationRatio) > 0 { + i -= len(x.LiquidationRatio) + copy(dAtA[i:], x.LiquidationRatio) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LiquidationRatio))) + i-- + dAtA[i] = 0x12 + } + if len(x.MinCollateralRatio) > 0 { + i -= len(x.MinCollateralRatio) + copy(dAtA[i:], x.MinCollateralRatio) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinCollateralRatio))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*VaultMamagerParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VaultMamagerParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VaultMamagerParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MinCollateralRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LiquidationRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MaxDebt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MintingFee string `protobuf:"bytes,1,opt,name=minting_fee,json=mintingFee,proto3" json:"minting_fee,omitempty"` + StabilityFee string `protobuf:"bytes,2,opt,name=stability_fee,json=stabilityFee,proto3" json:"stability_fee,omitempty"` + LiquidationPenalty string `protobuf:"bytes,3,opt,name=liquidation_penalty,json=liquidationPenalty,proto3" json:"liquidation_penalty,omitempty"` + MinInitialDebt string `protobuf:"bytes,4,opt,name=min_initial_debt,json=minInitialDebt,proto3" json:"min_initial_debt,omitempty"` + RecalculateDebtPeriod uint64 `protobuf:"varint,5,opt,name=recalculate_debt_period,json=recalculateDebtPeriod,proto3" json:"recalculate_debt_period,omitempty"` + LiquidatePeriod uint64 `protobuf:"varint,6,opt,name=liquidate_period,json=liquidatePeriod,proto3" json:"liquidate_period,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_reserve_vaults_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetMintingFee() string { + if x != nil { + return x.MintingFee + } + return "" +} + +func (x *Params) GetStabilityFee() string { + if x != nil { + return x.StabilityFee + } + return "" +} + +func (x *Params) GetLiquidationPenalty() string { + if x != nil { + return x.LiquidationPenalty + } + return "" +} + +func (x *Params) GetMinInitialDebt() string { + if x != nil { + return x.MinInitialDebt + } + return "" +} + +func (x *Params) GetRecalculateDebtPeriod() uint64 { + if x != nil { + return x.RecalculateDebtPeriod + } + return 0 +} + +func (x *Params) GetLiquidatePeriod() uint64 { + if x != nil { + return x.LiquidatePeriod + } + return 0 +} + +// VaultParams defines the parameters for each collateral vault type. +type VaultMamagerParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MinCollateralRatio string `protobuf:"bytes,1,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3" json:"min_collateral_ratio,omitempty"` + LiquidationRatio string `protobuf:"bytes,2,opt,name=liquidation_ratio,json=liquidationRatio,proto3" json:"liquidation_ratio,omitempty"` + MaxDebt string `protobuf:"bytes,3,opt,name=max_debt,json=maxDebt,proto3" json:"max_debt,omitempty"` +} + +func (x *VaultMamagerParams) Reset() { + *x = VaultMamagerParams{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_params_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VaultMamagerParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VaultMamagerParams) ProtoMessage() {} + +// Deprecated: Use VaultMamagerParams.ProtoReflect.Descriptor instead. +func (*VaultMamagerParams) Descriptor() ([]byte, []int) { + return file_reserve_vaults_params_proto_rawDescGZIP(), []int{1} +} + +func (x *VaultMamagerParams) GetMinCollateralRatio() string { + if x != nil { + return x.MinCollateralRatio + } + return "" +} + +func (x *VaultMamagerParams) GetLiquidationRatio() string { + if x != nil { + return x.LiquidationRatio + } + return "" +} + +func (x *VaultMamagerParams) GetMaxDebt() string { + if x != nil { + return x.MaxDebt + } + return "" +} + +var File_reserve_vaults_params_proto protoreflect.FileDescriptor + +var file_reserve_vaults_params_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x14, 0x67, + 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, + 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x57, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, + 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x46, + 0x65, 0x65, 0x12, 0x5b, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, + 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, + 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, + 0x01, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x12, + 0x67, 0x0a, 0x13, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, + 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, + 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, + 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x5a, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x62, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, + 0x44, 0x65, 0x62, 0x74, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x65, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, + 0x61, 0x74, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x72, 0x65, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, + 0x74, 0x65, 0x44, 0x65, 0x62, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x29, 0x0a, 0x10, + 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, + 0x2a, 0x17, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x78, 0x2f, 0x76, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xb0, 0x02, 0x0a, 0x12, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x68, 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, + 0x74, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x63, 0x0a, 0x11, 0x6c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, + 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x6c, + 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, + 0x4b, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x62, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x62, 0x74, 0x42, 0x9b, 0x01, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x52, 0x56, 0x58, 0xaa, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xca, 0x02, 0x0e, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xe2, 0x02, 0x1a, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x3a, 0x3a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_reserve_vaults_params_proto_rawDescOnce sync.Once + file_reserve_vaults_params_proto_rawDescData = file_reserve_vaults_params_proto_rawDesc +) + +func file_reserve_vaults_params_proto_rawDescGZIP() []byte { + file_reserve_vaults_params_proto_rawDescOnce.Do(func() { + file_reserve_vaults_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_params_proto_rawDescData) + }) + return file_reserve_vaults_params_proto_rawDescData +} + +var file_reserve_vaults_params_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_reserve_vaults_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: reserve.vaults.Params + (*VaultMamagerParams)(nil), // 1: reserve.vaults.VaultMamagerParams +} +var file_reserve_vaults_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_params_proto_init() } +func file_reserve_vaults_params_proto_init() { + if File_reserve_vaults_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_params_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VaultMamagerParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_vaults_params_proto_goTypes, + DependencyIndexes: file_reserve_vaults_params_proto_depIdxs, + MessageInfos: file_reserve_vaults_params_proto_msgTypes, + }.Build() + File_reserve_vaults_params_proto = out.File + file_reserve_vaults_params_proto_rawDesc = nil + file_reserve_vaults_params_proto_goTypes = nil + file_reserve_vaults_params_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/query.pulsar.go b/api/reserve/vaults/query.pulsar.go new file mode 100644 index 00000000..d9816ebe --- /dev/null +++ b/api/reserve/vaults/query.pulsar.go @@ -0,0 +1,1008 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vaults + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_query_proto_init() + md_QueryParamsRequest = File_reserve_vaults_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsRequest")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_query_proto_init() + md_QueryParamsResponse = File_reserve_vaults_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.QueryParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_reserve_vaults_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_reserve_vaults_query_proto protoreflect.FileDescriptor + +var file_reserve_vaults_query_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x11, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x32, 0x7a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x71, 0x0a, + 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x52, 0x56, 0x58, 0xaa, 0x02, 0x0e, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xca, 0x02, 0x0e, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xe2, 0x02, + 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_vaults_query_proto_rawDescOnce sync.Once + file_reserve_vaults_query_proto_rawDescData = file_reserve_vaults_query_proto_rawDesc +) + +func file_reserve_vaults_query_proto_rawDescGZIP() []byte { + file_reserve_vaults_query_proto_rawDescOnce.Do(func() { + file_reserve_vaults_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_query_proto_rawDescData) + }) + return file_reserve_vaults_query_proto_rawDescData +} + +var file_reserve_vaults_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_reserve_vaults_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: reserve.vaults.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: reserve.vaults.QueryParamsResponse + (*Params)(nil), // 2: reserve.vaults.Params +} +var file_reserve_vaults_query_proto_depIdxs = []int32{ + 2, // 0: reserve.vaults.QueryParamsResponse.params:type_name -> reserve.vaults.Params + 0, // 1: reserve.vaults.Query.Params:input_type -> reserve.vaults.QueryParamsRequest + 1, // 2: reserve.vaults.Query.Params:output_type -> reserve.vaults.QueryParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_query_proto_init() } +func file_reserve_vaults_query_proto_init() { + if File_reserve_vaults_query_proto != nil { + return + } + file_reserve_vaults_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_reserve_vaults_query_proto_goTypes, + DependencyIndexes: file_reserve_vaults_query_proto_depIdxs, + MessageInfos: file_reserve_vaults_query_proto_msgTypes, + }.Build() + File_reserve_vaults_query_proto = out.File + file_reserve_vaults_query_proto_rawDesc = nil + file_reserve_vaults_query_proto_goTypes = nil + file_reserve_vaults_query_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/query_grpc.pb.go b/api/reserve/vaults/query_grpc.pb.go new file mode 100644 index 00000000..e9f7776e --- /dev/null +++ b/api/reserve/vaults/query_grpc.pb.go @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: reserve/vaults/query.proto + +package vaults + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Query_Params_FullMethodName = "/reserve.vaults.Query/Params" +) + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Query defines the gRPC querier service. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +// All implementations must embed UnimplementedQueryServer +// for forward compatibility. +// +// Query defines the gRPC querier service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedQueryServer struct{} + +func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} +func (UnimplementedQueryServer) testEmbeddedByValue() {} + +// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QueryServer will +// result in compilation errors. +type UnsafeQueryServer interface { + mustEmbedUnimplementedQueryServer() +} + +func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + // If the following call pancis, it indicates UnimplementedQueryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Query_ServiceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_Params_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Query_ServiceDesc is the grpc.ServiceDesc for Query service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Query_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.vaults.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/vaults/query.proto", +} diff --git a/api/reserve/vaults/tx.pulsar.go b/api/reserve/vaults/tx.pulsar.go new file mode 100644 index 00000000..2616e6f9 --- /dev/null +++ b/api/reserve/vaults/tx.pulsar.go @@ -0,0 +1,7530 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vaults + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgUpdateParams = File_reserve_vaults_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgUpdateParams.authority": + return x.Authority != "" + case "reserve.vaults.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgUpdateParams.authority": + x.Authority = "" + case "reserve.vaults.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "reserve.vaults.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "reserve.vaults.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message reserve.vaults.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParams")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgUpdateParamsResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgActiveCollateral protoreflect.MessageDescriptor + fd_MsgActiveCollateral_denom protoreflect.FieldDescriptor + fd_MsgActiveCollateral_min_collateral_ratio protoreflect.FieldDescriptor + fd_MsgActiveCollateral_liquidation_ratio protoreflect.FieldDescriptor + fd_MsgActiveCollateral_max_debt protoreflect.FieldDescriptor + fd_MsgActiveCollateral_authority protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgActiveCollateral = File_reserve_vaults_tx_proto.Messages().ByName("MsgActiveCollateral") + fd_MsgActiveCollateral_denom = md_MsgActiveCollateral.Fields().ByName("denom") + fd_MsgActiveCollateral_min_collateral_ratio = md_MsgActiveCollateral.Fields().ByName("min_collateral_ratio") + fd_MsgActiveCollateral_liquidation_ratio = md_MsgActiveCollateral.Fields().ByName("liquidation_ratio") + fd_MsgActiveCollateral_max_debt = md_MsgActiveCollateral.Fields().ByName("max_debt") + fd_MsgActiveCollateral_authority = md_MsgActiveCollateral.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgActiveCollateral)(nil) + +type fastReflection_MsgActiveCollateral MsgActiveCollateral + +func (x *MsgActiveCollateral) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgActiveCollateral)(x) +} + +func (x *MsgActiveCollateral) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgActiveCollateral_messageType fastReflection_MsgActiveCollateral_messageType +var _ protoreflect.MessageType = fastReflection_MsgActiveCollateral_messageType{} + +type fastReflection_MsgActiveCollateral_messageType struct{} + +func (x fastReflection_MsgActiveCollateral_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgActiveCollateral)(nil) +} +func (x fastReflection_MsgActiveCollateral_messageType) New() protoreflect.Message { + return new(fastReflection_MsgActiveCollateral) +} +func (x fastReflection_MsgActiveCollateral_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActiveCollateral +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgActiveCollateral) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActiveCollateral +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgActiveCollateral) Type() protoreflect.MessageType { + return _fastReflection_MsgActiveCollateral_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgActiveCollateral) New() protoreflect.Message { + return new(fastReflection_MsgActiveCollateral) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgActiveCollateral) Interface() protoreflect.ProtoMessage { + return (*MsgActiveCollateral)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgActiveCollateral) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_MsgActiveCollateral_denom, value) { + return + } + } + if x.MinCollateralRatio != "" { + value := protoreflect.ValueOfString(x.MinCollateralRatio) + if !f(fd_MsgActiveCollateral_min_collateral_ratio, value) { + return + } + } + if x.LiquidationRatio != "" { + value := protoreflect.ValueOfString(x.LiquidationRatio) + if !f(fd_MsgActiveCollateral_liquidation_ratio, value) { + return + } + } + if x.MaxDebt != "" { + value := protoreflect.ValueOfString(x.MaxDebt) + if !f(fd_MsgActiveCollateral_max_debt, value) { + return + } + } + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgActiveCollateral_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgActiveCollateral) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + return x.Denom != "" + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + return x.MinCollateralRatio != "" + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + return x.LiquidationRatio != "" + case "reserve.vaults.MsgActiveCollateral.max_debt": + return x.MaxDebt != "" + case "reserve.vaults.MsgActiveCollateral.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateral) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + x.Denom = "" + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + x.MinCollateralRatio = "" + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + x.LiquidationRatio = "" + case "reserve.vaults.MsgActiveCollateral.max_debt": + x.MaxDebt = "" + case "reserve.vaults.MsgActiveCollateral.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgActiveCollateral) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + value := x.MinCollateralRatio + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + value := x.LiquidationRatio + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgActiveCollateral.max_debt": + value := x.MaxDebt + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgActiveCollateral.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateral) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + x.Denom = value.Interface().(string) + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + x.MinCollateralRatio = value.Interface().(string) + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + x.LiquidationRatio = value.Interface().(string) + case "reserve.vaults.MsgActiveCollateral.max_debt": + x.MaxDebt = value.Interface().(string) + case "reserve.vaults.MsgActiveCollateral.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateral) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + panic(fmt.Errorf("field denom of message reserve.vaults.MsgActiveCollateral is not mutable")) + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + panic(fmt.Errorf("field min_collateral_ratio of message reserve.vaults.MsgActiveCollateral is not mutable")) + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + panic(fmt.Errorf("field liquidation_ratio of message reserve.vaults.MsgActiveCollateral is not mutable")) + case "reserve.vaults.MsgActiveCollateral.max_debt": + panic(fmt.Errorf("field max_debt of message reserve.vaults.MsgActiveCollateral is not mutable")) + case "reserve.vaults.MsgActiveCollateral.authority": + panic(fmt.Errorf("field authority of message reserve.vaults.MsgActiveCollateral is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgActiveCollateral) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgActiveCollateral.denom": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgActiveCollateral.min_collateral_ratio": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgActiveCollateral.liquidation_ratio": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgActiveCollateral.max_debt": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgActiveCollateral.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateral")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateral does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgActiveCollateral) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgActiveCollateral", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgActiveCollateral) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateral) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgActiveCollateral) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgActiveCollateral) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgActiveCollateral) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MinCollateralRatio) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.LiquidationRatio) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MaxDebt) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgActiveCollateral) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0x2a + } + if len(x.MaxDebt) > 0 { + i -= len(x.MaxDebt) + copy(dAtA[i:], x.MaxDebt) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxDebt))) + i-- + dAtA[i] = 0x22 + } + if len(x.LiquidationRatio) > 0 { + i -= len(x.LiquidationRatio) + copy(dAtA[i:], x.LiquidationRatio) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LiquidationRatio))) + i-- + dAtA[i] = 0x1a + } + if len(x.MinCollateralRatio) > 0 { + i -= len(x.MinCollateralRatio) + copy(dAtA[i:], x.MinCollateralRatio) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinCollateralRatio))) + i-- + dAtA[i] = 0x12 + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgActiveCollateral) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActiveCollateral: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActiveCollateral: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MinCollateralRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LiquidationRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MaxDebt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgActiveCollateralResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgActiveCollateralResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgActiveCollateralResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgActiveCollateralResponse)(nil) + +type fastReflection_MsgActiveCollateralResponse MsgActiveCollateralResponse + +func (x *MsgActiveCollateralResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgActiveCollateralResponse)(x) +} + +func (x *MsgActiveCollateralResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgActiveCollateralResponse_messageType fastReflection_MsgActiveCollateralResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgActiveCollateralResponse_messageType{} + +type fastReflection_MsgActiveCollateralResponse_messageType struct{} + +func (x fastReflection_MsgActiveCollateralResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgActiveCollateralResponse)(nil) +} +func (x fastReflection_MsgActiveCollateralResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgActiveCollateralResponse) +} +func (x fastReflection_MsgActiveCollateralResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActiveCollateralResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgActiveCollateralResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActiveCollateralResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgActiveCollateralResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgActiveCollateralResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgActiveCollateralResponse) New() protoreflect.Message { + return new(fastReflection_MsgActiveCollateralResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgActiveCollateralResponse) Interface() protoreflect.ProtoMessage { + return (*MsgActiveCollateralResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgActiveCollateralResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgActiveCollateralResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateralResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgActiveCollateralResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateralResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateralResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgActiveCollateralResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgActiveCollateralResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgActiveCollateralResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgActiveCollateralResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgActiveCollateralResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgActiveCollateralResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgActiveCollateralResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgActiveCollateralResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgActiveCollateralResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgActiveCollateralResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgActiveCollateralResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgActiveCollateralResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActiveCollateralResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActiveCollateralResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateVault protoreflect.MessageDescriptor + fd_MsgCreateVault_denom protoreflect.FieldDescriptor + fd_MsgCreateVault_owner protoreflect.FieldDescriptor + fd_MsgCreateVault_collateral protoreflect.FieldDescriptor + fd_MsgCreateVault_minted protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgCreateVault = File_reserve_vaults_tx_proto.Messages().ByName("MsgCreateVault") + fd_MsgCreateVault_denom = md_MsgCreateVault.Fields().ByName("denom") + fd_MsgCreateVault_owner = md_MsgCreateVault.Fields().ByName("owner") + fd_MsgCreateVault_collateral = md_MsgCreateVault.Fields().ByName("collateral") + fd_MsgCreateVault_minted = md_MsgCreateVault.Fields().ByName("minted") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateVault)(nil) + +type fastReflection_MsgCreateVault MsgCreateVault + +func (x *MsgCreateVault) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateVault)(x) +} + +func (x *MsgCreateVault) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateVault_messageType fastReflection_MsgCreateVault_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateVault_messageType{} + +type fastReflection_MsgCreateVault_messageType struct{} + +func (x fastReflection_MsgCreateVault_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateVault)(nil) +} +func (x fastReflection_MsgCreateVault_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateVault) +} +func (x fastReflection_MsgCreateVault_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVault +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateVault) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVault +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateVault) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateVault_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateVault) New() protoreflect.Message { + return new(fastReflection_MsgCreateVault) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateVault) Interface() protoreflect.ProtoMessage { + return (*MsgCreateVault)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateVault) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_MsgCreateVault_denom, value) { + return + } + } + if x.Owner != "" { + value := protoreflect.ValueOfString(x.Owner) + if !f(fd_MsgCreateVault_owner, value) { + return + } + } + if x.Collateral != nil { + value := protoreflect.ValueOfMessage(x.Collateral.ProtoReflect()) + if !f(fd_MsgCreateVault_collateral, value) { + return + } + } + if x.Minted != nil { + value := protoreflect.ValueOfMessage(x.Minted.ProtoReflect()) + if !f(fd_MsgCreateVault_minted, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateVault) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgCreateVault.denom": + return x.Denom != "" + case "reserve.vaults.MsgCreateVault.owner": + return x.Owner != "" + case "reserve.vaults.MsgCreateVault.collateral": + return x.Collateral != nil + case "reserve.vaults.MsgCreateVault.minted": + return x.Minted != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVault) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgCreateVault.denom": + x.Denom = "" + case "reserve.vaults.MsgCreateVault.owner": + x.Owner = "" + case "reserve.vaults.MsgCreateVault.collateral": + x.Collateral = nil + case "reserve.vaults.MsgCreateVault.minted": + x.Minted = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateVault) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgCreateVault.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgCreateVault.owner": + value := x.Owner + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgCreateVault.collateral": + value := x.Collateral + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.vaults.MsgCreateVault.minted": + value := x.Minted + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVault) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgCreateVault.denom": + x.Denom = value.Interface().(string) + case "reserve.vaults.MsgCreateVault.owner": + x.Owner = value.Interface().(string) + case "reserve.vaults.MsgCreateVault.collateral": + x.Collateral = value.Message().Interface().(*v1beta1.Coin) + case "reserve.vaults.MsgCreateVault.minted": + x.Minted = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVault) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgCreateVault.collateral": + if x.Collateral == nil { + x.Collateral = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Collateral.ProtoReflect()) + case "reserve.vaults.MsgCreateVault.minted": + if x.Minted == nil { + x.Minted = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Minted.ProtoReflect()) + case "reserve.vaults.MsgCreateVault.denom": + panic(fmt.Errorf("field denom of message reserve.vaults.MsgCreateVault is not mutable")) + case "reserve.vaults.MsgCreateVault.owner": + panic(fmt.Errorf("field owner of message reserve.vaults.MsgCreateVault is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateVault) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgCreateVault.denom": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgCreateVault.owner": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgCreateVault.collateral": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.vaults.MsgCreateVault.minted": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVault")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVault does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateVault) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgCreateVault", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateVault) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVault) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateVault) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateVault) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateVault) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Owner) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Collateral != nil { + l = options.Size(x.Collateral) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Minted != nil { + l = options.Size(x.Minted) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVault) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Minted != nil { + encoded, err := options.Marshal(x.Minted) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x22 + } + if x.Collateral != nil { + encoded, err := options.Marshal(x.Collateral) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Owner) > 0 { + i -= len(x.Owner) + copy(dAtA[i:], x.Owner) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVault) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Collateral == nil { + x.Collateral = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Collateral); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Minted", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Minted == nil { + x.Minted = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Minted); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateVaultResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgCreateVaultResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgCreateVaultResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateVaultResponse)(nil) + +type fastReflection_MsgCreateVaultResponse MsgCreateVaultResponse + +func (x *MsgCreateVaultResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateVaultResponse)(x) +} + +func (x *MsgCreateVaultResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateVaultResponse_messageType fastReflection_MsgCreateVaultResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateVaultResponse_messageType{} + +type fastReflection_MsgCreateVaultResponse_messageType struct{} + +func (x fastReflection_MsgCreateVaultResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateVaultResponse)(nil) +} +func (x fastReflection_MsgCreateVaultResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateVaultResponse) +} +func (x fastReflection_MsgCreateVaultResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVaultResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateVaultResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVaultResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateVaultResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateVaultResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateVaultResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateVaultResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateVaultResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateVaultResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateVaultResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateVaultResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVaultResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateVaultResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVaultResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVaultResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateVaultResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgCreateVaultResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgCreateVaultResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateVaultResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgCreateVaultResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateVaultResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVaultResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateVaultResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateVaultResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateVaultResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVaultResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVaultResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgDeposit protoreflect.MessageDescriptor + fd_MsgDeposit_vault_id protoreflect.FieldDescriptor + fd_MsgDeposit_sender protoreflect.FieldDescriptor + fd_MsgDeposit_amount protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgDeposit = File_reserve_vaults_tx_proto.Messages().ByName("MsgDeposit") + fd_MsgDeposit_vault_id = md_MsgDeposit.Fields().ByName("vault_id") + fd_MsgDeposit_sender = md_MsgDeposit.Fields().ByName("sender") + fd_MsgDeposit_amount = md_MsgDeposit.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgDeposit)(nil) + +type fastReflection_MsgDeposit MsgDeposit + +func (x *MsgDeposit) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDeposit)(x) +} + +func (x *MsgDeposit) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDeposit_messageType fastReflection_MsgDeposit_messageType +var _ protoreflect.MessageType = fastReflection_MsgDeposit_messageType{} + +type fastReflection_MsgDeposit_messageType struct{} + +func (x fastReflection_MsgDeposit_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDeposit)(nil) +} +func (x fastReflection_MsgDeposit_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDeposit) +} +func (x fastReflection_MsgDeposit_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeposit +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDeposit) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeposit +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDeposit) Type() protoreflect.MessageType { + return _fastReflection_MsgDeposit_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDeposit) New() protoreflect.Message { + return new(fastReflection_MsgDeposit) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDeposit) Interface() protoreflect.ProtoMessage { + return (*MsgDeposit)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDeposit) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.VaultId != uint64(0) { + value := protoreflect.ValueOfUint64(x.VaultId) + if !f(fd_MsgDeposit_vault_id, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgDeposit_sender, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgDeposit_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDeposit) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgDeposit.vault_id": + return x.VaultId != uint64(0) + case "reserve.vaults.MsgDeposit.sender": + return x.Sender != "" + case "reserve.vaults.MsgDeposit.amount": + return x.Amount != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeposit) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgDeposit.vault_id": + x.VaultId = uint64(0) + case "reserve.vaults.MsgDeposit.sender": + x.Sender = "" + case "reserve.vaults.MsgDeposit.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDeposit) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgDeposit.vault_id": + value := x.VaultId + return protoreflect.ValueOfUint64(value) + case "reserve.vaults.MsgDeposit.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgDeposit.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeposit) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgDeposit.vault_id": + x.VaultId = value.Uint() + case "reserve.vaults.MsgDeposit.sender": + x.Sender = value.Interface().(string) + case "reserve.vaults.MsgDeposit.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeposit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgDeposit.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.vaults.MsgDeposit.vault_id": + panic(fmt.Errorf("field vault_id of message reserve.vaults.MsgDeposit is not mutable")) + case "reserve.vaults.MsgDeposit.sender": + panic(fmt.Errorf("field sender of message reserve.vaults.MsgDeposit is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDeposit) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgDeposit.vault_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.vaults.MsgDeposit.sender": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgDeposit.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDeposit")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDeposit does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDeposit) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgDeposit", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDeposit) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeposit) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDeposit) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDeposit) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDeposit) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.VaultId != 0 { + n += 1 + runtime.Sov(uint64(x.VaultId)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDeposit) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.VaultId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.VaultId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDeposit) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + x.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgDepositResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgDepositResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgDepositResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgDepositResponse)(nil) + +type fastReflection_MsgDepositResponse MsgDepositResponse + +func (x *MsgDepositResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDepositResponse)(x) +} + +func (x *MsgDepositResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDepositResponse_messageType fastReflection_MsgDepositResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgDepositResponse_messageType{} + +type fastReflection_MsgDepositResponse_messageType struct{} + +func (x fastReflection_MsgDepositResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDepositResponse)(nil) +} +func (x fastReflection_MsgDepositResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDepositResponse) +} +func (x fastReflection_MsgDepositResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDepositResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDepositResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDepositResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDepositResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgDepositResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDepositResponse) New() protoreflect.Message { + return new(fastReflection_MsgDepositResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDepositResponse) Interface() protoreflect.ProtoMessage { + return (*MsgDepositResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDepositResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDepositResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDepositResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDepositResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDepositResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDepositResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDepositResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgDepositResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgDepositResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDepositResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgDepositResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDepositResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDepositResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDepositResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDepositResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDepositResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDepositResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDepositResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgWithdraw protoreflect.MessageDescriptor + fd_MsgWithdraw_vault_id protoreflect.FieldDescriptor + fd_MsgWithdraw_sender protoreflect.FieldDescriptor + fd_MsgWithdraw_amount protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgWithdraw = File_reserve_vaults_tx_proto.Messages().ByName("MsgWithdraw") + fd_MsgWithdraw_vault_id = md_MsgWithdraw.Fields().ByName("vault_id") + fd_MsgWithdraw_sender = md_MsgWithdraw.Fields().ByName("sender") + fd_MsgWithdraw_amount = md_MsgWithdraw.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgWithdraw)(nil) + +type fastReflection_MsgWithdraw MsgWithdraw + +func (x *MsgWithdraw) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdraw)(x) +} + +func (x *MsgWithdraw) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgWithdraw_messageType fastReflection_MsgWithdraw_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdraw_messageType{} + +type fastReflection_MsgWithdraw_messageType struct{} + +func (x fastReflection_MsgWithdraw_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdraw)(nil) +} +func (x fastReflection_MsgWithdraw_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdraw) +} +func (x fastReflection_MsgWithdraw_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdraw +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgWithdraw) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdraw +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgWithdraw) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdraw_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgWithdraw) New() protoreflect.Message { + return new(fastReflection_MsgWithdraw) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgWithdraw) Interface() protoreflect.ProtoMessage { + return (*MsgWithdraw)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgWithdraw) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.VaultId != uint64(0) { + value := protoreflect.ValueOfUint64(x.VaultId) + if !f(fd_MsgWithdraw_vault_id, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgWithdraw_sender, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgWithdraw_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgWithdraw) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgWithdraw.vault_id": + return x.VaultId != uint64(0) + case "reserve.vaults.MsgWithdraw.sender": + return x.Sender != "" + case "reserve.vaults.MsgWithdraw.amount": + return x.Amount != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdraw) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgWithdraw.vault_id": + x.VaultId = uint64(0) + case "reserve.vaults.MsgWithdraw.sender": + x.Sender = "" + case "reserve.vaults.MsgWithdraw.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgWithdraw) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgWithdraw.vault_id": + value := x.VaultId + return protoreflect.ValueOfUint64(value) + case "reserve.vaults.MsgWithdraw.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgWithdraw.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdraw) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgWithdraw.vault_id": + x.VaultId = value.Uint() + case "reserve.vaults.MsgWithdraw.sender": + x.Sender = value.Interface().(string) + case "reserve.vaults.MsgWithdraw.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdraw) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgWithdraw.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.vaults.MsgWithdraw.vault_id": + panic(fmt.Errorf("field vault_id of message reserve.vaults.MsgWithdraw is not mutable")) + case "reserve.vaults.MsgWithdraw.sender": + panic(fmt.Errorf("field sender of message reserve.vaults.MsgWithdraw is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgWithdraw) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgWithdraw.vault_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.vaults.MsgWithdraw.sender": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgWithdraw.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdraw")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdraw does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgWithdraw) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgWithdraw", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgWithdraw) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdraw) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgWithdraw) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgWithdraw) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgWithdraw) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.VaultId != 0 { + n += 1 + runtime.Sov(uint64(x.VaultId)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgWithdraw) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.VaultId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.VaultId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgWithdraw) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdraw: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + x.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgWithdrawResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgWithdrawResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgWithdrawResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgWithdrawResponse)(nil) + +type fastReflection_MsgWithdrawResponse MsgWithdrawResponse + +func (x *MsgWithdrawResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawResponse)(x) +} + +func (x *MsgWithdrawResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgWithdrawResponse_messageType fastReflection_MsgWithdrawResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawResponse_messageType{} + +type fastReflection_MsgWithdrawResponse_messageType struct{} + +func (x fastReflection_MsgWithdrawResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawResponse)(nil) +} +func (x fastReflection_MsgWithdrawResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawResponse) +} +func (x fastReflection_MsgWithdrawResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgWithdrawResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgWithdrawResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgWithdrawResponse) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgWithdrawResponse) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgWithdrawResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgWithdrawResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdrawResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgWithdrawResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdrawResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdrawResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgWithdrawResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgWithdrawResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgWithdrawResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgWithdrawResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgWithdrawResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgWithdrawResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgWithdrawResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgWithdrawResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgWithdrawResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgWithdrawResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgWithdrawResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgWithdrawResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMint protoreflect.MessageDescriptor + fd_MsgMint_vault_id protoreflect.FieldDescriptor + fd_MsgMint_sender protoreflect.FieldDescriptor + fd_MsgMint_amount protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgMint = File_reserve_vaults_tx_proto.Messages().ByName("MsgMint") + fd_MsgMint_vault_id = md_MsgMint.Fields().ByName("vault_id") + fd_MsgMint_sender = md_MsgMint.Fields().ByName("sender") + fd_MsgMint_amount = md_MsgMint.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgMint)(nil) + +type fastReflection_MsgMint MsgMint + +func (x *MsgMint) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMint)(x) +} + +func (x *MsgMint) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMint_messageType fastReflection_MsgMint_messageType +var _ protoreflect.MessageType = fastReflection_MsgMint_messageType{} + +type fastReflection_MsgMint_messageType struct{} + +func (x fastReflection_MsgMint_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMint)(nil) +} +func (x fastReflection_MsgMint_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMint) +} +func (x fastReflection_MsgMint_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMint +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMint) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMint +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMint) Type() protoreflect.MessageType { + return _fastReflection_MsgMint_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMint) New() protoreflect.Message { + return new(fastReflection_MsgMint) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMint) Interface() protoreflect.ProtoMessage { + return (*MsgMint)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMint) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.VaultId != uint64(0) { + value := protoreflect.ValueOfUint64(x.VaultId) + if !f(fd_MsgMint_vault_id, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgMint_sender, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgMint_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMint) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgMint.vault_id": + return x.VaultId != uint64(0) + case "reserve.vaults.MsgMint.sender": + return x.Sender != "" + case "reserve.vaults.MsgMint.amount": + return x.Amount != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgMint.vault_id": + x.VaultId = uint64(0) + case "reserve.vaults.MsgMint.sender": + x.Sender = "" + case "reserve.vaults.MsgMint.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMint) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgMint.vault_id": + value := x.VaultId + return protoreflect.ValueOfUint64(value) + case "reserve.vaults.MsgMint.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgMint.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgMint.vault_id": + x.VaultId = value.Uint() + case "reserve.vaults.MsgMint.sender": + x.Sender = value.Interface().(string) + case "reserve.vaults.MsgMint.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgMint.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.vaults.MsgMint.vault_id": + panic(fmt.Errorf("field vault_id of message reserve.vaults.MsgMint is not mutable")) + case "reserve.vaults.MsgMint.sender": + panic(fmt.Errorf("field sender of message reserve.vaults.MsgMint is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMint) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgMint.vault_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.vaults.MsgMint.sender": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgMint.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMint")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMint does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMint) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgMint", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMint) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMint) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMint) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMint) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.VaultId != 0 { + n += 1 + runtime.Sov(uint64(x.VaultId)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgMint) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.VaultId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.VaultId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgMint) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + x.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMintResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgMintResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgMintResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgMintResponse)(nil) + +type fastReflection_MsgMintResponse MsgMintResponse + +func (x *MsgMintResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMintResponse)(x) +} + +func (x *MsgMintResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMintResponse_messageType fastReflection_MsgMintResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgMintResponse_messageType{} + +type fastReflection_MsgMintResponse_messageType struct{} + +func (x fastReflection_MsgMintResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMintResponse)(nil) +} +func (x fastReflection_MsgMintResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMintResponse) +} +func (x fastReflection_MsgMintResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMintResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMintResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgMintResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMintResponse) New() protoreflect.Message { + return new(fastReflection_MsgMintResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMintResponse) Interface() protoreflect.ProtoMessage { + return (*MsgMintResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMintResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMintResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMintResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMintResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgMintResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMintResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgMintResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMintResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMintResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMintResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgRepay protoreflect.MessageDescriptor + fd_MsgRepay_vault_id protoreflect.FieldDescriptor + fd_MsgRepay_sender protoreflect.FieldDescriptor + fd_MsgRepay_amount protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgRepay = File_reserve_vaults_tx_proto.Messages().ByName("MsgRepay") + fd_MsgRepay_vault_id = md_MsgRepay.Fields().ByName("vault_id") + fd_MsgRepay_sender = md_MsgRepay.Fields().ByName("sender") + fd_MsgRepay_amount = md_MsgRepay.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgRepay)(nil) + +type fastReflection_MsgRepay MsgRepay + +func (x *MsgRepay) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRepay)(x) +} + +func (x *MsgRepay) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgRepay_messageType fastReflection_MsgRepay_messageType +var _ protoreflect.MessageType = fastReflection_MsgRepay_messageType{} + +type fastReflection_MsgRepay_messageType struct{} + +func (x fastReflection_MsgRepay_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRepay)(nil) +} +func (x fastReflection_MsgRepay_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRepay) +} +func (x fastReflection_MsgRepay_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRepay +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgRepay) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRepay +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgRepay) Type() protoreflect.MessageType { + return _fastReflection_MsgRepay_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgRepay) New() protoreflect.Message { + return new(fastReflection_MsgRepay) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgRepay) Interface() protoreflect.ProtoMessage { + return (*MsgRepay)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgRepay) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.VaultId != uint64(0) { + value := protoreflect.ValueOfUint64(x.VaultId) + if !f(fd_MsgRepay_vault_id, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgRepay_sender, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgRepay_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgRepay) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.MsgRepay.vault_id": + return x.VaultId != uint64(0) + case "reserve.vaults.MsgRepay.sender": + return x.Sender != "" + case "reserve.vaults.MsgRepay.amount": + return x.Amount != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepay) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.MsgRepay.vault_id": + x.VaultId = uint64(0) + case "reserve.vaults.MsgRepay.sender": + x.Sender = "" + case "reserve.vaults.MsgRepay.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgRepay) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.MsgRepay.vault_id": + value := x.VaultId + return protoreflect.ValueOfUint64(value) + case "reserve.vaults.MsgRepay.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "reserve.vaults.MsgRepay.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepay) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.MsgRepay.vault_id": + x.VaultId = value.Uint() + case "reserve.vaults.MsgRepay.sender": + x.Sender = value.Interface().(string) + case "reserve.vaults.MsgRepay.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepay) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgRepay.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "reserve.vaults.MsgRepay.vault_id": + panic(fmt.Errorf("field vault_id of message reserve.vaults.MsgRepay is not mutable")) + case "reserve.vaults.MsgRepay.sender": + panic(fmt.Errorf("field sender of message reserve.vaults.MsgRepay is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgRepay) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.MsgRepay.vault_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "reserve.vaults.MsgRepay.sender": + return protoreflect.ValueOfString("") + case "reserve.vaults.MsgRepay.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepay")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepay does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgRepay) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgRepay", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgRepay) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepay) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgRepay) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgRepay) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgRepay) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.VaultId != 0 { + n += 1 + runtime.Sov(uint64(x.VaultId)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgRepay) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.VaultId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.VaultId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgRepay) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRepay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRepay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + x.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgRepayResponse protoreflect.MessageDescriptor +) + +func init() { + file_reserve_vaults_tx_proto_init() + md_MsgRepayResponse = File_reserve_vaults_tx_proto.Messages().ByName("MsgRepayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgRepayResponse)(nil) + +type fastReflection_MsgRepayResponse MsgRepayResponse + +func (x *MsgRepayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRepayResponse)(x) +} + +func (x *MsgRepayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_tx_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgRepayResponse_messageType fastReflection_MsgRepayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgRepayResponse_messageType{} + +type fastReflection_MsgRepayResponse_messageType struct{} + +func (x fastReflection_MsgRepayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRepayResponse)(nil) +} +func (x fastReflection_MsgRepayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRepayResponse) +} +func (x fastReflection_MsgRepayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRepayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgRepayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRepayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgRepayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgRepayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgRepayResponse) New() protoreflect.Message { + return new(fastReflection_MsgRepayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgRepayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgRepayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgRepayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgRepayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgRepayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgRepayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.MsgRepayResponse")) + } + panic(fmt.Errorf("message reserve.vaults.MsgRepayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgRepayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.MsgRepayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgRepayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgRepayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgRepayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgRepayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgRepayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgRepayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgRepayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRepayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRepayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgActiveCollateral struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + MinCollateralRatio string `protobuf:"bytes,2,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3" json:"min_collateral_ratio,omitempty"` + LiquidationRatio string `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3" json:"liquidation_ratio,omitempty"` + MaxDebt string `protobuf:"bytes,4,opt,name=max_debt,json=maxDebt,proto3" json:"max_debt,omitempty"` + Authority string `protobuf:"bytes,5,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *MsgActiveCollateral) Reset() { + *x = MsgActiveCollateral{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgActiveCollateral) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgActiveCollateral) ProtoMessage() {} + +// Deprecated: Use MsgActiveCollateral.ProtoReflect.Descriptor instead. +func (*MsgActiveCollateral) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgActiveCollateral) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *MsgActiveCollateral) GetMinCollateralRatio() string { + if x != nil { + return x.MinCollateralRatio + } + return "" +} + +func (x *MsgActiveCollateral) GetLiquidationRatio() string { + if x != nil { + return x.LiquidationRatio + } + return "" +} + +func (x *MsgActiveCollateral) GetMaxDebt() string { + if x != nil { + return x.MaxDebt + } + return "" +} + +func (x *MsgActiveCollateral) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +type MsgActiveCollateralResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgActiveCollateralResponse) Reset() { + *x = MsgActiveCollateralResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgActiveCollateralResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgActiveCollateralResponse) ProtoMessage() {} + +// Deprecated: Use MsgActiveCollateralResponse.ProtoReflect.Descriptor instead. +func (*MsgActiveCollateralResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{3} +} + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgCreateVault struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Collateral *v1beta1.Coin `protobuf:"bytes,3,opt,name=collateral,proto3" json:"collateral,omitempty"` + Minted *v1beta1.Coin `protobuf:"bytes,4,opt,name=minted,proto3" json:"minted,omitempty"` +} + +func (x *MsgCreateVault) Reset() { + *x = MsgCreateVault{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateVault) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateVault) ProtoMessage() {} + +// Deprecated: Use MsgCreateVault.ProtoReflect.Descriptor instead. +func (*MsgCreateVault) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgCreateVault) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *MsgCreateVault) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *MsgCreateVault) GetCollateral() *v1beta1.Coin { + if x != nil { + return x.Collateral + } + return nil +} + +func (x *MsgCreateVault) GetMinted() *v1beta1.Coin { + if x != nil { + return x.Minted + } + return nil +} + +// MsgCreateVaultResponse defines the Msg/CreateVault response type. +type MsgCreateVaultResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCreateVaultResponse) Reset() { + *x = MsgCreateVaultResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateVaultResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateVaultResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreateVaultResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateVaultResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{5} +} + +// MsgDeposit defines a SDK message for depositing collateral assets to the vault. +type MsgDeposit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgDeposit) Reset() { + *x = MsgDeposit{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgDeposit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgDeposit) ProtoMessage() {} + +// Deprecated: Use MsgDeposit.ProtoReflect.Descriptor instead. +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgDeposit) GetVaultId() uint64 { + if x != nil { + return x.VaultId + } + return 0 +} + +func (x *MsgDeposit) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *MsgDeposit) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +// MsgDepositResponse defines the Msg/Deposit response type. +type MsgDepositResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgDepositResponse) Reset() { + *x = MsgDepositResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgDepositResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgDepositResponse) ProtoMessage() {} + +// Deprecated: Use MsgDepositResponse.ProtoReflect.Descriptor instead. +func (*MsgDepositResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{7} +} + +// MsgWithdraw defines a SDK message for withdrawing collateral assets out of the vault. +type MsgWithdraw struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgWithdraw) Reset() { + *x = MsgWithdraw{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgWithdraw) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgWithdraw) ProtoMessage() {} + +// Deprecated: Use MsgWithdraw.ProtoReflect.Descriptor instead. +func (*MsgWithdraw) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgWithdraw) GetVaultId() uint64 { + if x != nil { + return x.VaultId + } + return 0 +} + +func (x *MsgWithdraw) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *MsgWithdraw) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +// MsgWithdrawResponse defines the Msg/Withdraw response type. +type MsgWithdrawResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgWithdrawResponse) Reset() { + *x = MsgWithdrawResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgWithdrawResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgWithdrawResponse) ProtoMessage() {} + +// Deprecated: Use MsgWithdrawResponse.ProtoReflect.Descriptor instead. +func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{9} +} + +// MsgMint defines a SDK message for minting more tokens. +type MsgMint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgMint) Reset() { + *x = MsgMint{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMint) ProtoMessage() {} + +// Deprecated: Use MsgMint.ProtoReflect.Descriptor instead. +func (*MsgMint) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgMint) GetVaultId() uint64 { + if x != nil { + return x.VaultId + } + return 0 +} + +func (x *MsgMint) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *MsgMint) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +// MsgMintResponse defines the Msg/Mint response type. +type MsgMintResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgMintResponse) Reset() { + *x = MsgMintResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMintResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMintResponse) ProtoMessage() {} + +// Deprecated: Use MsgMintResponse.ProtoReflect.Descriptor instead. +func (*MsgMintResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{11} +} + +// MsgRepay defines a SDK message for repay debt. +type MsgRepay struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgRepay) Reset() { + *x = MsgRepay{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRepay) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRepay) ProtoMessage() {} + +// Deprecated: Use MsgRepay.ProtoReflect.Descriptor instead. +func (*MsgRepay) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{12} +} + +func (x *MsgRepay) GetVaultId() uint64 { + if x != nil { + return x.VaultId + } + return 0 +} + +func (x *MsgRepay) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *MsgRepay) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +// MsgRepayResponse defines the Msg/Mint response type. +type MsgRepayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgRepayResponse) Reset() { + *x = MsgRepayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_tx_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRepayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRepayResponse) ProtoMessage() {} + +// Deprecated: Use MsgRepayResponse.ProtoReflect.Descriptor instead. +func (*MsgRepayResponse) Descriptor() ([]byte, []int) { + return file_reserve_vaults_tx_proto_rawDescGZIP(), []int{13} +} + +var File_reserve_vaults_tx_proto protoreflect.FileDescriptor + +var file_reserve_vaults_tx_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x33, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x2f, 0x78, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x97, 0x03, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x68, 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6c, + 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, + 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x6d, 0x69, 0x6e, + 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, + 0x63, 0x0a, 0x11, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x10, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x61, 0x74, 0x69, 0x6f, 0x12, 0x4b, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x62, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, + 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x62, + 0x74, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x16, 0x88, 0xa0, 0x1f, 0x00, 0xe8, + 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, + 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xee, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, + 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x12, + 0x3c, 0x0a, 0x06, 0x6d, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x6d, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x3a, 0x12, 0x88, + 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, + 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x0a, + 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, + 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x14, 0x0a, 0x12, 0x4d, 0x73, + 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xad, 0x01, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, + 0x12, 0x19, 0x0a, 0x08, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x07, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, 0x88, 0xa0, 0x1f, + 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x22, 0x15, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x4d, + 0x69, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x64, 0x12, 0x30, + 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, + 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x70, 0x61, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x64, 0x12, 0x30, + 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, + 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x22, 0x12, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x70, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc3, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x1f, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x27, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x12, 0x23, 0x2e, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, + 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x1a, 0x2b, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, + 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x55, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1e, + 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x1a, 0x26, + 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x22, 0x2e, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, + 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4c, 0x0a, 0x08, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x12, 0x1b, 0x2e, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, + 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x1a, 0x23, 0x2e, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x40, 0x0a, 0x04, 0x4d, 0x69, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, + 0x1a, 0x1f, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x61, 0x79, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x52, + 0x65, 0x70, 0x61, 0x79, 0x1a, 0x20, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, + 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x70, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, + 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0xa2, 0x02, 0x03, 0x52, 0x56, 0x58, 0xaa, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xca, 0x02, 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xe2, 0x02, 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, + 0x3a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_vaults_tx_proto_rawDescOnce sync.Once + file_reserve_vaults_tx_proto_rawDescData = file_reserve_vaults_tx_proto_rawDesc +) + +func file_reserve_vaults_tx_proto_rawDescGZIP() []byte { + file_reserve_vaults_tx_proto_rawDescOnce.Do(func() { + file_reserve_vaults_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_tx_proto_rawDescData) + }) + return file_reserve_vaults_tx_proto_rawDescData +} + +var file_reserve_vaults_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_reserve_vaults_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: reserve.vaults.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: reserve.vaults.MsgUpdateParamsResponse + (*MsgActiveCollateral)(nil), // 2: reserve.vaults.MsgActiveCollateral + (*MsgActiveCollateralResponse)(nil), // 3: reserve.vaults.MsgActiveCollateralResponse + (*MsgCreateVault)(nil), // 4: reserve.vaults.MsgCreateVault + (*MsgCreateVaultResponse)(nil), // 5: reserve.vaults.MsgCreateVaultResponse + (*MsgDeposit)(nil), // 6: reserve.vaults.MsgDeposit + (*MsgDepositResponse)(nil), // 7: reserve.vaults.MsgDepositResponse + (*MsgWithdraw)(nil), // 8: reserve.vaults.MsgWithdraw + (*MsgWithdrawResponse)(nil), // 9: reserve.vaults.MsgWithdrawResponse + (*MsgMint)(nil), // 10: reserve.vaults.MsgMint + (*MsgMintResponse)(nil), // 11: reserve.vaults.MsgMintResponse + (*MsgRepay)(nil), // 12: reserve.vaults.MsgRepay + (*MsgRepayResponse)(nil), // 13: reserve.vaults.MsgRepayResponse + (*Params)(nil), // 14: reserve.vaults.Params + (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin +} +var file_reserve_vaults_tx_proto_depIdxs = []int32{ + 14, // 0: reserve.vaults.MsgUpdateParams.params:type_name -> reserve.vaults.Params + 15, // 1: reserve.vaults.MsgCreateVault.collateral:type_name -> cosmos.base.v1beta1.Coin + 15, // 2: reserve.vaults.MsgCreateVault.minted:type_name -> cosmos.base.v1beta1.Coin + 15, // 3: reserve.vaults.MsgDeposit.amount:type_name -> cosmos.base.v1beta1.Coin + 15, // 4: reserve.vaults.MsgWithdraw.amount:type_name -> cosmos.base.v1beta1.Coin + 15, // 5: reserve.vaults.MsgMint.amount:type_name -> cosmos.base.v1beta1.Coin + 15, // 6: reserve.vaults.MsgRepay.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 7: reserve.vaults.Msg.UpdateParams:input_type -> reserve.vaults.MsgUpdateParams + 2, // 8: reserve.vaults.Msg.ActiveCollateral:input_type -> reserve.vaults.MsgActiveCollateral + 4, // 9: reserve.vaults.Msg.CreateVault:input_type -> reserve.vaults.MsgCreateVault + 6, // 10: reserve.vaults.Msg.Deposit:input_type -> reserve.vaults.MsgDeposit + 8, // 11: reserve.vaults.Msg.Withdraw:input_type -> reserve.vaults.MsgWithdraw + 10, // 12: reserve.vaults.Msg.Mint:input_type -> reserve.vaults.MsgMint + 12, // 13: reserve.vaults.Msg.Repay:input_type -> reserve.vaults.MsgRepay + 1, // 14: reserve.vaults.Msg.UpdateParams:output_type -> reserve.vaults.MsgUpdateParamsResponse + 3, // 15: reserve.vaults.Msg.ActiveCollateral:output_type -> reserve.vaults.MsgActiveCollateralResponse + 5, // 16: reserve.vaults.Msg.CreateVault:output_type -> reserve.vaults.MsgCreateVaultResponse + 7, // 17: reserve.vaults.Msg.Deposit:output_type -> reserve.vaults.MsgDepositResponse + 9, // 18: reserve.vaults.Msg.Withdraw:output_type -> reserve.vaults.MsgWithdrawResponse + 11, // 19: reserve.vaults.Msg.Mint:output_type -> reserve.vaults.MsgMintResponse + 13, // 20: reserve.vaults.Msg.Repay:output_type -> reserve.vaults.MsgRepayResponse + 14, // [14:21] is the sub-list for method output_type + 7, // [7:14] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_tx_proto_init() } +func file_reserve_vaults_tx_proto_init() { + if File_reserve_vaults_tx_proto != nil { + return + } + file_reserve_vaults_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgActiveCollateral); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgActiveCollateralResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateVault); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateVaultResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDeposit); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDepositResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgWithdraw); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgWithdrawResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMintResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRepay); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_tx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRepayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_reserve_vaults_tx_proto_goTypes, + DependencyIndexes: file_reserve_vaults_tx_proto_depIdxs, + MessageInfos: file_reserve_vaults_tx_proto_msgTypes, + }.Build() + File_reserve_vaults_tx_proto = out.File + file_reserve_vaults_tx_proto_rawDesc = nil + file_reserve_vaults_tx_proto_goTypes = nil + file_reserve_vaults_tx_proto_depIdxs = nil +} diff --git a/api/reserve/vaults/tx_grpc.pb.go b/api/reserve/vaults/tx_grpc.pb.go new file mode 100644 index 00000000..72243990 --- /dev/null +++ b/api/reserve/vaults/tx_grpc.pb.go @@ -0,0 +1,369 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: reserve/vaults/tx.proto + +package vaults + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Msg_UpdateParams_FullMethodName = "/reserve.vaults.Msg/UpdateParams" + Msg_ActiveCollateral_FullMethodName = "/reserve.vaults.Msg/ActiveCollateral" + Msg_CreateVault_FullMethodName = "/reserve.vaults.Msg/CreateVault" + Msg_Deposit_FullMethodName = "/reserve.vaults.Msg/Deposit" + Msg_Withdraw_FullMethodName = "/reserve.vaults.Msg/Withdraw" + Msg_Mint_FullMethodName = "/reserve.vaults.Msg/Mint" + Msg_Repay_FullMethodName = "/reserve.vaults.Msg/Repay" +) + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Msg defines the vaults Msg service. +type MsgClient interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // ActiveCollateral defines a method for enable a collateral asset + ActiveCollateral(ctx context.Context, in *MsgActiveCollateral, opts ...grpc.CallOption) (*MsgActiveCollateralResponse, error) + // CreateVault defines a method for creating a new vault and mint token + CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) + // Deposit defines a method for depositing collateral assets to vault + Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) + // Withdraw defines a method for withdrawing collateral assets out of the vault + Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) + // Mint defines a method for minting more tokens + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) + // Repay defines a method for reducing debt by burning tokens + Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ActiveCollateral(ctx context.Context, in *MsgActiveCollateral, opts ...grpc.CallOption) (*MsgActiveCollateralResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgActiveCollateralResponse) + err := c.cc.Invoke(ctx, Msg_ActiveCollateral_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgCreateVaultResponse) + err := c.cc.Invoke(ctx, Msg_CreateVault_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgDepositResponse) + err := c.cc.Invoke(ctx, Msg_Deposit_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgWithdrawResponse) + err := c.cc.Invoke(ctx, Msg_Withdraw_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgMintResponse) + err := c.cc.Invoke(ctx, Msg_Mint_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgRepayResponse) + err := c.cc.Invoke(ctx, Msg_Repay_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +// All implementations must embed UnimplementedMsgServer +// for forward compatibility. +// +// Msg defines the vaults Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // ActiveCollateral defines a method for enable a collateral asset + ActiveCollateral(context.Context, *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) + // CreateVault defines a method for creating a new vault and mint token + CreateVault(context.Context, *MsgCreateVault) (*MsgCreateVaultResponse, error) + // Deposit defines a method for depositing collateral assets to vault + Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) + // Withdraw defines a method for withdrawing collateral assets out of the vault + Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) + // Mint defines a method for minting more tokens + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) + // Repay defines a method for reducing debt by burning tokens + Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMsgServer struct{} + +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (UnimplementedMsgServer) ActiveCollateral(context.Context, *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ActiveCollateral not implemented") +} +func (UnimplementedMsgServer) CreateVault(context.Context, *MsgCreateVault) (*MsgCreateVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateVault not implemented") +} +func (UnimplementedMsgServer) Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (UnimplementedMsgServer) Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") +} +func (UnimplementedMsgServer) Mint(context.Context, *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} +func (UnimplementedMsgServer) Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Repay not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Msg_ServiceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParams_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ActiveCollateral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgActiveCollateral) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ActiveCollateral(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_ActiveCollateral_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ActiveCollateral(ctx, req.(*MsgActiveCollateral)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateVault) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateVault(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CreateVault_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateVault(ctx, req.(*MsgCreateVault)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Deposit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdraw) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Withdraw(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Withdraw_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdraw)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Mint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Mint_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Repay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRepay) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Repay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Repay_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Repay(ctx, req.(*MsgRepay)) + } + return interceptor(ctx, in, info, handler) +} + +// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Msg_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.vaults.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "ActiveCollateral", + Handler: _Msg_ActiveCollateral_Handler, + }, + { + MethodName: "CreateVault", + Handler: _Msg_CreateVault_Handler, + }, + { + MethodName: "Deposit", + Handler: _Msg_Deposit_Handler, + }, + { + MethodName: "Withdraw", + Handler: _Msg_Withdraw_Handler, + }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, + { + MethodName: "Repay", + Handler: _Msg_Repay_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/vaults/tx.proto", +} diff --git a/api/reserve/vaults/vault.pulsar.go b/api/reserve/vaults/vault.pulsar.go new file mode 100644 index 00000000..5baf1a0b --- /dev/null +++ b/api/reserve/vaults/vault.pulsar.go @@ -0,0 +1,1547 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vaults + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_VaultMamager protoreflect.MessageDescriptor + fd_VaultMamager_params protoreflect.FieldDescriptor + fd_VaultMamager_denom protoreflect.FieldDescriptor + fd_VaultMamager_mint_available protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_vault_proto_init() + md_VaultMamager = File_reserve_vaults_vault_proto.Messages().ByName("VaultMamager") + fd_VaultMamager_params = md_VaultMamager.Fields().ByName("params") + fd_VaultMamager_denom = md_VaultMamager.Fields().ByName("denom") + fd_VaultMamager_mint_available = md_VaultMamager.Fields().ByName("mint_available") +} + +var _ protoreflect.Message = (*fastReflection_VaultMamager)(nil) + +type fastReflection_VaultMamager VaultMamager + +func (x *VaultMamager) ProtoReflect() protoreflect.Message { + return (*fastReflection_VaultMamager)(x) +} + +func (x *VaultMamager) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_vault_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_VaultMamager_messageType fastReflection_VaultMamager_messageType +var _ protoreflect.MessageType = fastReflection_VaultMamager_messageType{} + +type fastReflection_VaultMamager_messageType struct{} + +func (x fastReflection_VaultMamager_messageType) Zero() protoreflect.Message { + return (*fastReflection_VaultMamager)(nil) +} +func (x fastReflection_VaultMamager_messageType) New() protoreflect.Message { + return new(fastReflection_VaultMamager) +} +func (x fastReflection_VaultMamager_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_VaultMamager +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_VaultMamager) Descriptor() protoreflect.MessageDescriptor { + return md_VaultMamager +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_VaultMamager) Type() protoreflect.MessageType { + return _fastReflection_VaultMamager_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_VaultMamager) New() protoreflect.Message { + return new(fastReflection_VaultMamager) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_VaultMamager) Interface() protoreflect.ProtoMessage { + return (*VaultMamager)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_VaultMamager) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_VaultMamager_params, value) { + return + } + } + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_VaultMamager_denom, value) { + return + } + } + if x.MintAvailable != "" { + value := protoreflect.ValueOfString(x.MintAvailable) + if !f(fd_VaultMamager_mint_available, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_VaultMamager) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.VaultMamager.params": + return x.Params != nil + case "reserve.vaults.VaultMamager.denom": + return x.Denom != "" + case "reserve.vaults.VaultMamager.mint_available": + return x.MintAvailable != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamager) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.VaultMamager.params": + x.Params = nil + case "reserve.vaults.VaultMamager.denom": + x.Denom = "" + case "reserve.vaults.VaultMamager.mint_available": + x.MintAvailable = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_VaultMamager) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.VaultMamager.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.vaults.VaultMamager.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + case "reserve.vaults.VaultMamager.mint_available": + value := x.MintAvailable + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamager) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.VaultMamager.params": + x.Params = value.Message().Interface().(*VaultMamagerParams) + case "reserve.vaults.VaultMamager.denom": + x.Denom = value.Interface().(string) + case "reserve.vaults.VaultMamager.mint_available": + x.MintAvailable = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamager) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.VaultMamager.params": + if x.Params == nil { + x.Params = new(VaultMamagerParams) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "reserve.vaults.VaultMamager.denom": + panic(fmt.Errorf("field denom of message reserve.vaults.VaultMamager is not mutable")) + case "reserve.vaults.VaultMamager.mint_available": + panic(fmt.Errorf("field mint_available of message reserve.vaults.VaultMamager is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_VaultMamager) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.VaultMamager.params": + m := new(VaultMamagerParams) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.vaults.VaultMamager.denom": + return protoreflect.ValueOfString("") + case "reserve.vaults.VaultMamager.mint_available": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.VaultMamager")) + } + panic(fmt.Errorf("message reserve.vaults.VaultMamager does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_VaultMamager) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.VaultMamager", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_VaultMamager) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_VaultMamager) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_VaultMamager) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_VaultMamager) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*VaultMamager) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MintAvailable) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*VaultMamager) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.MintAvailable) > 0 { + i -= len(x.MintAvailable) + copy(dAtA[i:], x.MintAvailable) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MintAvailable))) + i-- + dAtA[i] = 0x1a + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0x12 + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*VaultMamager) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VaultMamager: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VaultMamager: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &VaultMamagerParams{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MintAvailable", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MintAvailable = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_Vault protoreflect.MessageDescriptor + fd_Vault_owner protoreflect.FieldDescriptor + fd_Vault_debt protoreflect.FieldDescriptor + fd_Vault_collateral_locked protoreflect.FieldDescriptor + fd_Vault_status protoreflect.FieldDescriptor +) + +func init() { + file_reserve_vaults_vault_proto_init() + md_Vault = File_reserve_vaults_vault_proto.Messages().ByName("Vault") + fd_Vault_owner = md_Vault.Fields().ByName("owner") + fd_Vault_debt = md_Vault.Fields().ByName("debt") + fd_Vault_collateral_locked = md_Vault.Fields().ByName("collateral_locked") + fd_Vault_status = md_Vault.Fields().ByName("status") +} + +var _ protoreflect.Message = (*fastReflection_Vault)(nil) + +type fastReflection_Vault Vault + +func (x *Vault) ProtoReflect() protoreflect.Message { + return (*fastReflection_Vault)(x) +} + +func (x *Vault) slowProtoReflect() protoreflect.Message { + mi := &file_reserve_vaults_vault_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Vault_messageType fastReflection_Vault_messageType +var _ protoreflect.MessageType = fastReflection_Vault_messageType{} + +type fastReflection_Vault_messageType struct{} + +func (x fastReflection_Vault_messageType) Zero() protoreflect.Message { + return (*fastReflection_Vault)(nil) +} +func (x fastReflection_Vault_messageType) New() protoreflect.Message { + return new(fastReflection_Vault) +} +func (x fastReflection_Vault_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Vault +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Vault) Descriptor() protoreflect.MessageDescriptor { + return md_Vault +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Vault) Type() protoreflect.MessageType { + return _fastReflection_Vault_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Vault) New() protoreflect.Message { + return new(fastReflection_Vault) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Vault) Interface() protoreflect.ProtoMessage { + return (*Vault)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Vault) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Owner != "" { + value := protoreflect.ValueOfString(x.Owner) + if !f(fd_Vault_owner, value) { + return + } + } + if x.Debt != nil { + value := protoreflect.ValueOfMessage(x.Debt.ProtoReflect()) + if !f(fd_Vault_debt, value) { + return + } + } + if x.CollateralLocked != nil { + value := protoreflect.ValueOfMessage(x.CollateralLocked.ProtoReflect()) + if !f(fd_Vault_collateral_locked, value) { + return + } + } + if x.Status != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) + if !f(fd_Vault_status, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Vault) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "reserve.vaults.Vault.owner": + return x.Owner != "" + case "reserve.vaults.Vault.debt": + return x.Debt != nil + case "reserve.vaults.Vault.collateral_locked": + return x.CollateralLocked != nil + case "reserve.vaults.Vault.status": + return x.Status != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Vault) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "reserve.vaults.Vault.owner": + x.Owner = "" + case "reserve.vaults.Vault.debt": + x.Debt = nil + case "reserve.vaults.Vault.collateral_locked": + x.CollateralLocked = nil + case "reserve.vaults.Vault.status": + x.Status = 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Vault) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "reserve.vaults.Vault.owner": + value := x.Owner + return protoreflect.ValueOfString(value) + case "reserve.vaults.Vault.debt": + value := x.Debt + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.vaults.Vault.collateral_locked": + value := x.CollateralLocked + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "reserve.vaults.Vault.status": + value := x.Status + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Vault) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "reserve.vaults.Vault.owner": + x.Owner = value.Interface().(string) + case "reserve.vaults.Vault.debt": + x.Debt = value.Message().Interface().(*v1beta1.Coin) + case "reserve.vaults.Vault.collateral_locked": + x.CollateralLocked = value.Message().Interface().(*v1beta1.Coin) + case "reserve.vaults.Vault.status": + x.Status = (VaultStatus)(value.Enum()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Vault) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.Vault.debt": + if x.Debt == nil { + x.Debt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Debt.ProtoReflect()) + case "reserve.vaults.Vault.collateral_locked": + if x.CollateralLocked == nil { + x.CollateralLocked = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.CollateralLocked.ProtoReflect()) + case "reserve.vaults.Vault.owner": + panic(fmt.Errorf("field owner of message reserve.vaults.Vault is not mutable")) + case "reserve.vaults.Vault.status": + panic(fmt.Errorf("field status of message reserve.vaults.Vault is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Vault) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "reserve.vaults.Vault.owner": + return protoreflect.ValueOfString("") + case "reserve.vaults.Vault.debt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.vaults.Vault.collateral_locked": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "reserve.vaults.Vault.status": + return protoreflect.ValueOfEnum(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Vault")) + } + panic(fmt.Errorf("message reserve.vaults.Vault does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Vault) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in reserve.vaults.Vault", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Vault) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Vault) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Vault) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Vault) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Vault) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Owner) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Debt != nil { + l = options.Size(x.Debt) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.CollateralLocked != nil { + l = options.Size(x.CollateralLocked) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Status != 0 { + n += 1 + runtime.Sov(uint64(x.Status)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Vault) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Status != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) + i-- + dAtA[i] = 0x20 + } + if x.CollateralLocked != nil { + encoded, err := options.Marshal(x.CollateralLocked) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if x.Debt != nil { + encoded, err := options.Marshal(x.Debt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Owner) > 0 { + i -= len(x.Owner) + copy(dAtA[i:], x.Owner) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Owner))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Vault) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Vault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Vault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Debt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Debt == nil { + x.Debt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Debt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CollateralLocked", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.CollateralLocked == nil { + x.CollateralLocked = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CollateralLocked); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + x.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Status |= VaultStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: reserve/vaults/vault.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// VaultStatus is the status of a vault. +type VaultStatus int32 + +const ( + // ACTIVE - vault is in use and can be changed + VaultStatus_ACTIVE VaultStatus = 0 + // LIQUIDATING - vault is being liquidated by the vault manager, and cannot be + // changed by the user. If liquidation fails, vaults may remain in this state. + // An upgrade might be able to recover them. + VaultStatus_LIQUIDATING VaultStatus = 1 + // TRANSFER - vault is able to be transferred (payments and debits frozen until + // it has a new owner) + VaultStatus_TRANSFER VaultStatus = 2 + // CLOSED - vault was closed by the user and all assets have been paid out + VaultStatus_CLOSED VaultStatus = 3 + // LIQUIDATED - vault was closed by the manager, with remaining assets paid to owner + VaultStatus_LIQUIDATED VaultStatus = 4 +) + +// Enum value maps for VaultStatus. +var ( + VaultStatus_name = map[int32]string{ + 0: "ACTIVE", + 1: "LIQUIDATING", + 2: "TRANSFER", + 3: "CLOSED", + 4: "LIQUIDATED", + } + VaultStatus_value = map[string]int32{ + "ACTIVE": 0, + "LIQUIDATING": 1, + "TRANSFER": 2, + "CLOSED": 3, + "LIQUIDATED": 4, + } +) + +func (x VaultStatus) Enum() *VaultStatus { + p := new(VaultStatus) + *p = x + return p +} + +func (x VaultStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VaultStatus) Descriptor() protoreflect.EnumDescriptor { + return file_reserve_vaults_vault_proto_enumTypes[0].Descriptor() +} + +func (VaultStatus) Type() protoreflect.EnumType { + return &file_reserve_vaults_vault_proto_enumTypes[0] +} + +func (x VaultStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VaultStatus.Descriptor instead. +func (VaultStatus) EnumDescriptor() ([]byte, []int) { + return file_reserve_vaults_vault_proto_rawDescGZIP(), []int{0} +} + +// VaultMamager defines the manager of each collateral vault type. +type VaultMamager struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *VaultMamagerParams `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + MintAvailable string `protobuf:"bytes,3,opt,name=mint_available,json=mintAvailable,proto3" json:"mint_available,omitempty"` +} + +func (x *VaultMamager) Reset() { + *x = VaultMamager{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_vault_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VaultMamager) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VaultMamager) ProtoMessage() {} + +// Deprecated: Use VaultMamager.ProtoReflect.Descriptor instead. +func (*VaultMamager) Descriptor() ([]byte, []int) { + return file_reserve_vaults_vault_proto_rawDescGZIP(), []int{0} +} + +func (x *VaultMamager) GetParams() *VaultMamagerParams { + if x != nil { + return x.Params + } + return nil +} + +func (x *VaultMamager) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *VaultMamager) GetMintAvailable() string { + if x != nil { + return x.MintAvailable + } + return "" +} + +type Vault struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Debt *v1beta1.Coin `protobuf:"bytes,2,opt,name=debt,proto3" json:"debt,omitempty"` + CollateralLocked *v1beta1.Coin `protobuf:"bytes,3,opt,name=collateral_locked,json=collateralLocked,proto3" json:"collateral_locked,omitempty"` + Status VaultStatus `protobuf:"varint,4,opt,name=status,proto3,enum=reserve.vaults.VaultStatus" json:"status,omitempty"` +} + +func (x *Vault) Reset() { + *x = Vault{} + if protoimpl.UnsafeEnabled { + mi := &file_reserve_vaults_vault_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Vault) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vault) ProtoMessage() {} + +// Deprecated: Use Vault.ProtoReflect.Descriptor instead. +func (*Vault) Descriptor() ([]byte, []int) { + return file_reserve_vaults_vault_proto_rawDescGZIP(), []int{1} +} + +func (x *Vault) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *Vault) GetDebt() *v1beta1.Coin { + if x != nil { + return x.Debt + } + return nil +} + +func (x *Vault) GetCollateralLocked() *v1beta1.Coin { + if x != nil { + return x.CollateralLocked + } + return nil +} + +func (x *Vault) GetStatus() VaultStatus { + if x != nil { + return x.Status + } + return VaultStatus_ACTIVE +} + +var File_reserve_vaults_vault_proto protoreflect.FileDescriptor + +var file_reserve_vaults_vault_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x14, 0x67, 0x6f, + 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc4, 0x01, 0x0a, 0x0c, 0x56, + 0x61, 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x56, 0x61, 0x75, + 0x6c, 0x74, 0x4d, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x57, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x74, + 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, + 0x65, 0x22, 0xf9, 0x01, 0x0a, 0x05, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x04, 0x64, + 0x65, 0x62, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x04, 0x64, 0x65, 0x62, 0x74, 0x12, 0x51, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, + 0x72, 0x61, 0x6c, 0x5f, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0xa1, 0x01, + 0x0a, 0x0b, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x00, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4c, 0x49, 0x51, 0x55, 0x49, 0x44, 0x41, + 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0f, 0x8a, 0x9d, 0x20, 0x0b, 0x6c, 0x69, 0x71, 0x75, + 0x69, 0x64, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x52, 0x41, 0x4e, 0x53, + 0x46, 0x45, 0x52, 0x10, 0x02, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x03, 0x1a, + 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, + 0x49, 0x51, 0x55, 0x49, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0e, 0x8a, 0x9d, 0x20, + 0x0a, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x61, 0x74, 0x65, 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, + 0x00, 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x2f, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x52, 0x56, 0x58, 0xaa, 0x02, 0x0e, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xca, 0x02, + 0x0e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0xe2, + 0x02, 0x1a, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x3a, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_reserve_vaults_vault_proto_rawDescOnce sync.Once + file_reserve_vaults_vault_proto_rawDescData = file_reserve_vaults_vault_proto_rawDesc +) + +func file_reserve_vaults_vault_proto_rawDescGZIP() []byte { + file_reserve_vaults_vault_proto_rawDescOnce.Do(func() { + file_reserve_vaults_vault_proto_rawDescData = protoimpl.X.CompressGZIP(file_reserve_vaults_vault_proto_rawDescData) + }) + return file_reserve_vaults_vault_proto_rawDescData +} + +var file_reserve_vaults_vault_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_reserve_vaults_vault_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_reserve_vaults_vault_proto_goTypes = []interface{}{ + (VaultStatus)(0), // 0: reserve.vaults.VaultStatus + (*VaultMamager)(nil), // 1: reserve.vaults.VaultMamager + (*Vault)(nil), // 2: reserve.vaults.Vault + (*VaultMamagerParams)(nil), // 3: reserve.vaults.VaultMamagerParams + (*v1beta1.Coin)(nil), // 4: cosmos.base.v1beta1.Coin +} +var file_reserve_vaults_vault_proto_depIdxs = []int32{ + 3, // 0: reserve.vaults.VaultMamager.params:type_name -> reserve.vaults.VaultMamagerParams + 4, // 1: reserve.vaults.Vault.debt:type_name -> cosmos.base.v1beta1.Coin + 4, // 2: reserve.vaults.Vault.collateral_locked:type_name -> cosmos.base.v1beta1.Coin + 0, // 3: reserve.vaults.Vault.status:type_name -> reserve.vaults.VaultStatus + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_reserve_vaults_vault_proto_init() } +func file_reserve_vaults_vault_proto_init() { + if File_reserve_vaults_vault_proto != nil { + return + } + file_reserve_vaults_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_reserve_vaults_vault_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VaultMamager); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reserve_vaults_vault_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Vault); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reserve_vaults_vault_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_reserve_vaults_vault_proto_goTypes, + DependencyIndexes: file_reserve_vaults_vault_proto_depIdxs, + EnumInfos: file_reserve_vaults_vault_proto_enumTypes, + MessageInfos: file_reserve_vaults_vault_proto_msgTypes, + }.Build() + File_reserve_vaults_vault_proto = out.File + file_reserve_vaults_vault_proto_rawDesc = nil + file_reserve_vaults_vault_proto_goTypes = nil + file_reserve_vaults_vault_proto_depIdxs = nil +} diff --git a/app/app.go b/app/app.go index 80cfb9fd..ff2fc1a6 100644 --- a/app/app.go +++ b/app/app.go @@ -32,7 +32,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" - _ "github.com/cosmos/cosmos-sdk/x/auth" // import for side-effects authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects @@ -75,8 +74,13 @@ import ( ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" + auctionkeeper "github.com/onomyprotocol/reserve/x/auction/keeper" oraclemodulekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" + psmkeeper "github.com/onomyprotocol/reserve/x/psm/keeper" + vaultskeeper "github.com/onomyprotocol/reserve/x/vaults/keeper" + // this line is used by starport scaffolding # stargate/app/moduleImport "github.com/onomyprotocol/reserve/docs" @@ -140,8 +144,13 @@ type App struct { ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedKeepers map[string]capabilitykeeper.ScopedKeeper + // ScopedOracleKeeper capabilitykeeper.ScopedKeeper - OracleKeeper oraclemodulekeeper.Keeper + OracleKeeper oraclemodulekeeper.Keeper + VaultsKeeper vaultskeeper.Keeper + PSMKeeper psmkeeper.Keeper + AuctionKeeper auctionkeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration // simulation manager @@ -211,7 +220,7 @@ func New( baseAppOptions ...func(*baseapp.BaseApp), ) (*App, error) { var ( - app = &App{} + app = &App{ScopedKeepers: make(map[string]capabilitykeeper.ScopedKeeper)} appBuilder *runtime.AppBuilder // merge the AppConfig and other configuration in one config @@ -295,6 +304,9 @@ func New( &app.GroupKeeper, &app.CircuitBreakerKeeper, &app.OracleKeeper, + &app.VaultsKeeper, + &app.PSMKeeper, + &app.AuctionKeeper, // this line is used by starport scaffolding # stargate/app/keeperDefinition ); err != nil { panic(err) @@ -335,7 +347,7 @@ func New( app.App = appBuilder.Build(db, traceStore, baseAppOptions...) // Register legacy modules - if err := app.registerIBCModules(appOpts); err != nil { + if err := app.registerIBCModules(); err != nil { return nil, err } @@ -435,7 +447,12 @@ func (app *App) GetIBCKeeper() *ibckeeper.Keeper { // GetCapabilityScopedKeeper returns the capability scoped keeper. func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { - return app.CapabilityKeeper.ScopeToModule(moduleName) + sk, ok := app.ScopedKeepers[moduleName] + if !ok { + sk = app.CapabilityKeeper.ScopeToModule(moduleName) + app.ScopedKeepers[moduleName] = sk + } + return sk } // SimulationManager implements the SimulationApp interface. @@ -456,6 +473,18 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig docs.RegisterOpenAPIService(Name, apiSvr.Router) } +func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } + +func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper { + return app.StakingKeeper +} + +func (app *App) GetTxConfig() client.TxConfig { return app.txConfig } + // GetMaccPerms returns a copy of the module account permissions // // NOTE: This is solely to be used for testing purposes. diff --git a/app/app_config.go b/app/app_config.go index 5b1cc753..d285c7d8 100644 --- a/app/app_config.go +++ b/app/app_config.go @@ -3,9 +3,18 @@ package app import ( "time" + auctionmodulev1 "github.com/onomyprotocol/reserve/api/reserve/auction/module" oraclemodulev1 "github.com/onomyprotocol/reserve/api/reserve/oracle/module" + psmmodulev1 "github.com/onomyprotocol/reserve/api/reserve/psm/module/v1" + vaultmodulev1 "github.com/onomyprotocol/reserve/api/reserve/vaults/module" + auctionmoduletypes "github.com/onomyprotocol/reserve/x/auction/types" _ "github.com/onomyprotocol/reserve/x/oracle/module" // import for side-effects + + _ "github.com/onomyprotocol/reserve/x/auction/module" // import for side-effects oraclemoduletypes "github.com/onomyprotocol/reserve/x/oracle/types" + psmtypes "github.com/onomyprotocol/reserve/x/psm/types" + _ "github.com/onomyprotocol/reserve/x/vaults/module" // import for side-effects + vaultsmoduletypes "github.com/onomyprotocol/reserve/x/vaults/types" runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" @@ -95,6 +104,9 @@ var ( circuittypes.ModuleName, // chain modules oraclemoduletypes.ModuleName, + vaultsmoduletypes.ModuleName, + psmtypes.ModuleName, + auctionmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis } @@ -120,6 +132,9 @@ var ( ibcfeetypes.ModuleName, // chain modules oraclemoduletypes.ModuleName, + vaultsmoduletypes.ModuleName, + psmtypes.ModuleName, + auctionmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers } @@ -139,6 +154,9 @@ var ( ibcfeetypes.ModuleName, // chain modules oraclemoduletypes.ModuleName, + vaultsmoduletypes.ModuleName, + psmtypes.ModuleName, + auctionmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers } @@ -159,7 +177,11 @@ var ( {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, {Account: ibcfeetypes.ModuleName}, {Account: icatypes.ModuleName}, + {Account: psmtypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, // this line is used by starport scaffolding # stargate/app/maccPerms + {Account: vaultsmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: vaultsmoduletypes.ReserveModuleName, Permissions: []string{authtypes.Burner}}, + {Account: auctionmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, } // blocked account addresses @@ -298,6 +320,18 @@ var ( Name: oraclemoduletypes.ModuleName, Config: appconfig.WrapAny(&oraclemodulev1.Module{}), }, + { + Name: vaultsmoduletypes.ModuleName, + Config: appconfig.WrapAny(&vaultmodulev1.Module{}), + }, + { + Name: psmtypes.ModuleName, + Config: appconfig.WrapAny(&psmmodulev1.Module{}), + }, + { + Name: auctionmoduletypes.ModuleName, + Config: appconfig.WrapAny(&auctionmodulev1.Module{}), + }, // this line is used by starport scaffolding # stargate/app/moduleConfig }, }) diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 4f6d15c7..d3df2c58 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -69,3 +69,8 @@ func (s *KeeperTestHelper) Setup() { } } } + +func (s *KeeperTestHelper) FundAccount(acccount sdk.AccAddress, moduleName string, coins sdk.Coins) { + s.App.BankKeeper.MintCoins(s.Ctx, moduleName, coins) + s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, moduleName, acccount, coins) +} diff --git a/app/ibc.go b/app/ibc.go index c5508aec..b067a54c 100644 --- a/app/ibc.go +++ b/app/ibc.go @@ -4,12 +4,13 @@ import ( "cosmossdk.io/core/appmodule" storetypes "cosmossdk.io/store/types" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/params" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" @@ -36,13 +37,15 @@ import ( solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - // this line is used by starport scaffolding # ibc/app/import + oracle "github.com/onomyprotocol/reserve/x/oracle" oraclemodule "github.com/onomyprotocol/reserve/x/oracle/module" oraclemoduletypes "github.com/onomyprotocol/reserve/x/oracle/types" + psm "github.com/onomyprotocol/reserve/x/psm/module" + psmtypes "github.com/onomyprotocol/reserve/x/psm/types" ) // registerIBCModules register IBC keepers and non dependency inject modules. -func (app *App) registerIBCModules(appOpts servertypes.AppOptions) error { +func (app *App) registerIBCModules() error { // set up non depinject support modules store keys if err := app.RegisterStores( storetypes.NewKVStoreKey(capabilitytypes.StoreKey), @@ -94,7 +97,10 @@ func (app *App) registerIBCModules(appOpts servertypes.AppOptions) error { // by granting the governance module the right to execute the message. // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler) + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(oraclemoduletypes.RouterKey, oracle.NewOracleProposalHandler(app.OracleKeeper)). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(psmtypes.RouterKey, psm.NewPSMProposalHandler(&app.PSMKeeper)) app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( app.appCodec, app.GetKey(ibcfeetypes.StoreKey), @@ -162,6 +168,12 @@ func (app *App) registerIBCModules(appOpts servertypes.AppOptions) error { AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) oracleIBCModule := ibcfee.NewIBCMiddleware(oraclemodule.NewIBCModule(app.OracleKeeper), app.IBCFeeKeeper) + // oracleStack, err := app.registerOracleModule() + // if err != nil { + // return err + // } + + // ibcRouter.AddRoute(oraclemoduletypes.ModuleName, oracleStack) ibcRouter.AddRoute(oraclemoduletypes.ModuleName, oracleIBCModule) // this line is used by starport scaffolding # ibc/app/module @@ -200,6 +212,8 @@ func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppMo capabilitytypes.ModuleName: capability.AppModule{}, ibctm.ModuleName: ibctm.AppModule{}, solomachine.ModuleName: solomachine.AppModule{}, + + // oraclemoduletypes.ModuleName: oraclemodule.AppModule{}, } for name, m := range modules { diff --git a/app/oracle.go b/app/oracle.go new file mode 100644 index 00000000..e882f392 --- /dev/null +++ b/app/oracle.go @@ -0,0 +1,56 @@ +package app + +// import ( +// storetypes "cosmossdk.io/store/types" +// oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" +// oraclemodule "github.com/onomyprotocol/reserve/x/oracle/module" +// oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" +// "github.com/cosmos/cosmos-sdk/runtime" +// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +// ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" +// porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" +// ) + +// // registerOracleModule register Oracle keepers and non dependency inject modules. +// func (app *App) registerOracleModule() (porttypes.IBCModule, error) { +// // set up non depinject support modules store keys +// if err := app.RegisterStores( +// storetypes.NewKVStoreKey(oracletypes.StoreKey), +// ); err != nil { +// panic(err) +// } + +// // register the key tables for legacy param subspaces +// app.ParamsKeeper.Subspace(oracletypes.ModuleName).WithKeyTable(oracletypes.ParamKeyTable()) +// // add capability keeper and ScopeToModule for oracle ibc module +// scopedOralceKeeper := app.CapabilityKeeper.ScopeToModule(oracletypes.ModuleName) + +// app.OracleKeeper = oraclekeeper.NewKeeper( +// app.AppCodec(), +// runtime.NewKVStoreService(app.GetKey(oracletypes.StoreKey)), +// app.Logger(), +// authtypes.NewModuleAddress(oracletypes.ModuleName).String(), +// app.GetIBCKeeper, +// scopedOralceKeeper, +// ) + +// // register IBC modules +// if err := app.RegisterModules( +// oraclemodule.NewAppModule( +// app.AppCodec(), +// app.OracleKeeper, +// app.AccountKeeper, +// app.BankKeeper, +// )); err != nil { +// return nil, err +// } + +// app.ScopedOracleKeeper = scopedOralceKeeper + +// // Create fee enabled ibc stack for oracel +// var oracleStack porttypes.IBCModule +// oracleStack = oraclemodule.NewIBCModule(app.OracleKeeper) +// oracleStack = ibcfee.NewIBCMiddleware(oracleStack, app.IBCFeeKeeper) + +// return oracleStack, nil +// } diff --git a/app/test_helpers.go b/app/test_helpers.go index 45258412..ceb93e9d 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -3,6 +3,7 @@ package app import ( "encoding/json" "testing" + "os" abci "github.com/cometbft/cometbft/abci/types" cmtjson "github.com/cometbft/cometbft/libs/json" @@ -209,3 +210,7 @@ func initAccountWithCoins(app *App, ctx sdk.Context, addr sdk.AccAddress, coins panic(err) } } + +func Cleanup(app *App) { // release cosmwasm instance cache lock + _ = os.RemoveAll(DefaultNodeHome) // remove default dir, if it was overridden during test Setup, it's a responsibility of the sender to remove the folder +} \ No newline at end of file diff --git a/cmd/reserved/cmd/commands.go b/cmd/reserved/cmd/commands.go index 29611a00..ad1147f0 100644 --- a/cmd/reserved/cmd/commands.go +++ b/cmd/reserved/cmd/commands.go @@ -45,8 +45,8 @@ func initRootCmd( rootCmd.AddCommand( server.StatusCommand(), genesisCommand(txConfig, basicManager), - queryCommand(), - txCommand(), + queryCommand(basicManager), + txCommand(basicManager), keys.Commands(), ) } @@ -65,7 +65,7 @@ func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, return cmd } -func queryCommand() *cobra.Command { +func queryCommand(basicManager module.BasicManager) *cobra.Command { cmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, @@ -84,12 +84,15 @@ func queryCommand() *cobra.Command { authcmd.QueryTxCmd(), server.QueryBlockResultsCmd(), ) + + basicManager.AddQueryCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } -func txCommand() *cobra.Command { +func txCommand(basicManager module.BasicManager) *cobra.Command { cmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", @@ -110,6 +113,9 @@ func txCommand() *cobra.Command { authcmd.GetDecodeCommand(), authcmd.GetSimulateCmd(), ) + + basicManager.AddTxCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd diff --git a/go.mod b/go.mod index a499b6ae..bd9545c1 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,9 @@ replace ( require ( cosmossdk.io/api v0.7.3 cosmossdk.io/client/v2 v2.0.0-beta.1 - cosmossdk.io/core v0.11.0 - cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/collections v0.4.0 + cosmossdk.io/core v0.11.1 + cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 @@ -23,28 +24,33 @@ require ( cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/nft v0.1.0 + cosmossdk.io/x/tx v0.13.1 cosmossdk.io/x/upgrade v0.1.1 github.com/bufbuild/buf v1.30.0 github.com/cometbft/cometbft v0.38.6 github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/cosmos-proto v1.0.0-beta.4 + github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.5 - github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/gogoproto v1.5.0 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.1.1 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 + github.com/pkg/errors v0.9.1 + github.com/rakyll/statik v0.1.7 + github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - golang.org/x/tools v0.19.0 + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 - google.golang.org/grpc v1.64.0 + google.golang.org/grpc v1.64.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.34.2 + gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -55,8 +61,6 @@ require ( cloud.google.com/go/storage v1.38.0 // indirect connectrpc.com/connect v1.15.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect - cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -190,7 +194,6 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect @@ -208,7 +211,6 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -231,21 +233,20 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.21.0 // indirect + golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect - golang.org/x/mod v0.16.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.27.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.6.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/term v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.169.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/go.sum b/go.sum index 113cfb6d..b9c3670e 100644 --- a/go.sum +++ b/go.sum @@ -194,10 +194,10 @@ cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= @@ -370,8 +370,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= -github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/cosmos-sdk v0.50.5 h1:MOEi+DKYgW67YaPgB+Pf+nHbD3V9S/ayitRKJYLfGIA= github.com/cosmos/cosmos-sdk v0.50.5/go.mod h1:oV/k6GJgXV9QPoM2fsYDPPsyPBgQbdotv532O6Mz1OQ= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= @@ -379,8 +379,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= -github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= +github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= @@ -991,6 +991,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1179,8 +1181,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1220,8 +1222,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1281,8 +1283,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1324,8 +1326,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1429,8 +1431,8 @@ golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1441,8 +1443,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1511,8 +1513,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1692,8 +1694,8 @@ google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJ google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1735,8 +1737,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= diff --git a/proto/buf.lock b/proto/buf.lock index f001cdd8..c13911be 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -4,35 +4,40 @@ deps: - remote: buf.build owner: cosmos repository: cosmos-proto - commit: 1935555c206d4afb9e94615dfd0fad31 - digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + commit: 04467658e59e44bbb22fe568206e1f70 + digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466 - remote: buf.build owner: cosmos repository: cosmos-sdk - commit: aa25660f4ff746388669ce36b3778442 - digest: shake256:a20eb29eb7284d9d0b76e94324a6e24e3665d13682bed0d5beac647d7109b7b2f22080301276779a91f394c97dab334da36dfc01d4252d9f869b090bfc8248aa + commit: 05419252bcc241ea8023acf1ed4cadc5 + digest: shake256:1e54a48c19a8b59d35e0a7efa76402939f515f2d8005df099856f24c37c20a52800308f025abb8cffcd014d437b49707388aaca4865d9d063d8f25d5d4eb77d5 - remote: buf.build owner: cosmos repository: gogo-proto - commit: 34d970b699f84aa382f3c29773a60836 - digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 + commit: 88ef6483f90f478fb938c37dde52ece3 + digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba - remote: buf.build owner: cosmos repository: ibc - commit: c159402ffeef4c21a7f9f0643817ae0d - digest: shake256:694e3f5a1d469798bb6cb3510f6f489e10d9309d1f2e8f7a369a776947602195f13ab65972d2d586a1134978b6a6fa28a43e5d7710ef5032ba0c7fbbe6038f08 + commit: 41fbc441e4d645119d275150719c5441 + digest: shake256:a61d3e152909abddc91dcc1aec8ac997007bebd48a7921bc243681c708e6c9068f6484aa7ed4e6ff60101d3422c98744a4a5294bbda6aacdba07f1dfa4291020 - remote: buf.build owner: cosmos repository: ics23 - commit: 3c44d8daa8b44059ac744cd17d4a49d7 - digest: shake256:fed75bde09a652f2cbe6085d5e1afa8292f166a0f6314369fb60b71c189d34e893ee1bffde527373abd371c110bdc80e8ed1d534eaaf5da6bc62634903a6ec44 + commit: d2ad30d1af0e4e978fa1f5c143acf63b + digest: shake256:000ea62514f7d507c96905d70ef11d16b8f8f32fda5a75def40d4130058af0174142ed3cd6c4a89c5fdb3cbf138277d771d86eeb6992f054d13a82556a2ff079 - remote: buf.build owner: googleapis repository: googleapis - commit: 75b4300737fb4efca0831636be94e517 - digest: shake256:d865f55b8ceb838c90c28b09894ab43d07f42551108c23760004a6a4e28fe24d3a1f7380a3c9278edb329a338a9cc5db8ad9f394de548e70d534e98504972d67 + commit: e7f8d366f5264595bcc4cd4139af9973 + digest: shake256:e5e5f1c12f82e028ea696faa43b4f9dc6258a6d1226282962a8c8b282e10946281d815884f574bd279ebd9cd7588629beb3db17b892af6c33b56f92f8f67f509 - remote: buf.build owner: protocolbuffers repository: wellknowntypes - commit: 44e83bc050a4497fa7b36b34d95ca156 - digest: shake256:bcdc007a8baabe27bdc06f3c8973bed7bea9faca4b486903a8f65c0492985864143888eb570a956ce4127d6afdaea346cf0393405a8144a1c5d026318c4c254c + commit: d59b7d45e69d4e129a1b797e2766f067 + digest: shake256:e4bb315f5a90aace88fe39709c831eda8eb0ce66b4cf947065888100b9867c2eb9a0f61f6b8d73c51b1fcccdfe8611090f55ce5db1aee6901ec9b4e6d8fa8e52 + - remote: buf.build + owner: tendermint + repository: tendermint + commit: 33ed361a90514289beabf3189e1d7665 + digest: shake256:038267e06294714fd883610626554b04a127b576b4e253befb4206cb72d5d3c1eeccacd4b9ec8e3fb891f7c14e1cb0f770c077d2989638995b0a61c85afedb1d diff --git a/proto/reserve/auction/module/module.pb.go b/proto/reserve/auction/module/module.pb.go new file mode 100644 index 00000000..88af282a --- /dev/null +++ b/proto/reserve/auction/module/module.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/module/module.proto + +package reserve_auction_module + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +// Module is the config object for the module. +type Module struct { + // authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_d5fcdd580e2c70d8, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "reserve.auction.module.Module") +} + +func init() { + proto.RegisterFile("reserve/auction/module/module.proto", fileDescriptor_d5fcdd580e2c70d8) +} + +var fileDescriptor_d5fcdd580e2c70d8 = []byte{ + // 188 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0xcf, 0xcd, 0x4f, 0x29, + 0xcd, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x62, 0x50, 0x45, 0x7a, 0x50, + 0x45, 0x7a, 0x10, 0x59, 0x29, 0x85, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, 0xfd, 0xc4, 0x82, 0x02, + 0xfd, 0x32, 0xc3, 0xc4, 0x9c, 0x82, 0x8c, 0x44, 0x43, 0x14, 0x9d, 0x4a, 0x51, 0x5c, 0x6c, 0xbe, + 0x60, 0xbe, 0x90, 0x0c, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, + 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x42, 0xc0, 0xca, 0x68, 0xd7, 0x81, 0x69, 0xb7, 0x18, 0x75, + 0xb8, 0xb4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf3, 0xf2, + 0x73, 0x2b, 0xc1, 0xc6, 0x24, 0xe7, 0xe7, 0xe8, 0xc3, 0xdc, 0x59, 0x01, 0x73, 0xa9, 0x93, 0xc4, + 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, + 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x75, 0x19, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0xd8, 0x5c, 0x8e, 0x4b, 0xdd, 0x00, 0x00, 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/reserve/auction/module/module.proto b/proto/reserve/auction/module/module.proto new file mode 100644 index 00000000..06e92abb --- /dev/null +++ b/proto/reserve/auction/module/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package reserve.auction.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import : "github.com/onomyprotocol/reserve/x/auction" + }; + + // authority defines the custom module authority. If not set, defaults to the + // governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/reserve/auction/v1/auction.proto b/proto/reserve/auction/v1/auction.proto new file mode 100644 index 00000000..1bab4a39 --- /dev/null +++ b/proto/reserve/auction/v1/auction.proto @@ -0,0 +1,112 @@ +syntax = "proto3"; +package reserve.auction.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/auction/types"; + +// AuctionStatus enumerates the valid auction status. +enum AuctionStatus { + // AUCTION_STATUS_UNSPECIFIED defines unknow auction status default is active. + AUCTION_STATUS_UNSPECIFIED= 0; + // AUCTION_STATUS_ACTIVE defines auction active status. + AUCTION_STATUS_ACTIVE= 1; + // AUCTION_STATUS_FINISHED defines auction finished reaching target goal. + AUCTION_STATUS_FINISHED = 2; + // AUCTION_STATUS_EXPIRED defines auction reach end time without reaching target goal. + AUCTION_STATUS_EXPIRED = 3; + // AUCTION_STATUS_OUT_OF_COLLATHERAL defines auction out of collatheral. + AUCTION_STATUS_OUT_OF_COLLATHERAL = 4; + } + +// Auction struct +message Auction { + // start_time defines auction's start time + google.protobuf.Timestamp start_time = 1 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // end_time defines where the auction ended when there are no winning bid + google.protobuf.Timestamp end_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // for simplicity, will use vault id that start the auction as auction id + uint64 auction_id = 3; + + // starting price (currently only support usd stable token) + string initial_price = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + + // items defines liquidate assets + cosmos.base.v1beta1.Coin item = 5 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // current_rate defines the rate compare with the initial price + string current_rate = 6 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + + // last_discount_time defines the last time a discount has been apply + google.protobuf.Timestamp last_discount_time = 7 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + cosmos.base.v1beta1.Coin token_raised = 8 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // status defines auction current status + AuctionStatus status = 9; + + // target_goal defines the debt the auction is trying to recover + cosmos.base.v1beta1.Coin target_goal = 10 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // vault_id defines id of auction vault + uint64 vault_id = 11; +} + +// Bid defines bid entry +message Bid { + // id of bid + uint64 bid_id = 1; + + // bidder address + string bidder = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // bidding amount + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // recive_price defines the price that the bid is willing to pay + string recive_price = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + + // maxReceive maximum receive-able amount + cosmos.base.v1beta1.Coin max_receive = 5 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + bool is_handle = 6; + + // index in auction bid_queue + uint64 index = 7; +} + +// BidQueue defines a list of bid entries for a single auction sorted by insertion time +message BidQueue { + // bidder address + uint64 auction_id = 1; + + // array of bid entries with bidder address + repeated Bid bids = 2; +} + +// Bids defines a list of bid entries +message Bids { + // array of bid entries with bidder address + repeated Bid bids = 1; +} \ No newline at end of file diff --git a/proto/reserve/auction/v1/genesis.proto b/proto/reserve/auction/v1/genesis.proto new file mode 100644 index 00000000..20a4c3a9 --- /dev/null +++ b/proto/reserve/auction/v1/genesis.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package reserve.auction.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "reserve/auction/v1/params.proto"; +import "reserve/auction/v1/auction.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/auction/types"; + +// GenesisState defines the auction module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // list of auctions + repeated Auction auctions = 2; + + // list of all bid entries + repeated Bid bid_entries = 3; +} diff --git a/proto/reserve/auction/v1/params.proto b/proto/reserve/auction/v1/params.proto new file mode 100644 index 00000000..d3f9c849 --- /dev/null +++ b/proto/reserve/auction/v1/params.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package reserve.auction.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/auction/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "reserve/x/auction/Params"; + option (gogoproto.equal) = true; + // defines how long (either in blocktime or blockheight) + // between each auction + google.protobuf.Duration auction_periods = 1 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // duration between each price reduction + google.protobuf.Duration reduce_step = 2 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // rate compared with the collaterals price from the + // oracle at which the auction will start with + string starting_rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + + // rate compared with the initial price that the price + // can drop to + string lowest_rate = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + + // rate that are decrease every reduce_step + string discount_rate = 5 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; +} \ No newline at end of file diff --git a/proto/reserve/auction/v1/query.proto b/proto/reserve/auction/v1/query.proto new file mode 100644 index 00000000..5ce43ca7 --- /dev/null +++ b/proto/reserve/auction/v1/query.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package reserve.auction.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "reserve/auction/v1/params.proto"; +import "reserve/auction/v1/auction.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/auction/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/reserve/auction/params"; + } + + rpc QueryAllAuction(QueryAllAuctionRequest) returns (QueryAllAuctionResponse){ + option (google.api.http).get = "/reserve/auction/auction"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +message QueryAllAuctionRequest {} + +message QueryAllAuctionResponse { + // params holds all the parameters of this module. + repeated Auction auctions = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} \ No newline at end of file diff --git a/proto/reserve/auction/v1/tx.proto b/proto/reserve/auction/v1/tx.proto new file mode 100644 index 00000000..280f5d24 --- /dev/null +++ b/proto/reserve/auction/v1/tx.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package reserve.auction.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "reserve/auction/v1/params.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/auction/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // Bid defines an operation for submit a bid entry. + rpc Bid(MsgBid) returns (MsgBidResponse); + + // CancelBid defines an operation for cancel an existing bid entry. + rpc CancelBid(MsgCancelBid) returns (MsgCancelBidResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/auction/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +// MsgBid is the Msg/Bid request type. +message MsgBid { + option (cosmos.msg.v1.signer) = "bidder"; + option (amino.name) = "reserve/x/auction/MsgBid"; + + // bidder is the address that submitting the bid entry. + string bidder = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // bidding auction id + uint64 auction_id = 2; + + // amount defines the amount that the bidder willing to pay. + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // recive_price defines the price that the bid is willing to pay + string recive_price = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; +} + +// MsgBidResponse defines the response structure for executing a +// MsgBid message. +message MsgBidResponse { + string response = 1; + + uint64 bid_id = 2; +} + +// MsgCancelBid is the Msg/CancelBid request type. +message MsgCancelBid { + option (cosmos.msg.v1.signer) = "bidder"; + option (amino.name) = "reserve/x/auction/MsgCancelBid"; + + // bidder is the address that submitting the bid entry. + string bidder = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // bid_id is the unique id. + uint64 bid_id = 2; + + // bidding auction id + uint64 auction_id = 3; +} + +// MsgCancelBidResponse defines the response structure for executing a +// MsgCancelBid message. +message MsgCancelBidResponse {} \ No newline at end of file diff --git a/proto/reserve/oracle/events.proto b/proto/reserve/oracle/events.proto new file mode 100644 index 00000000..7fd5231d --- /dev/null +++ b/proto/reserve/oracle/events.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package reserve.oracle; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; + +message EventBandAckSuccess { + string ack_result = 1; + int64 client_id = 2; + } + +message EventBandAckError { +string ack_error = 1; +int64 client_id = 2; +} + +message EventBandResponseTimeout { int64 client_id = 1; } + +message SetBandPriceEvent { + string relayer = 1; + repeated string symbols = 2; + repeated string prices = 3 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + uint64 resolve_time = 4; + uint64 request_id = 5; + int64 client_id = 6; +} \ No newline at end of file diff --git a/proto/reserve/oracle/genesis.proto b/proto/reserve/oracle/genesis.proto index f67cecee..762cfc0e 100644 --- a/proto/reserve/oracle/genesis.proto +++ b/proto/reserve/oracle/genesis.proto @@ -5,6 +5,8 @@ package reserve.oracle; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "reserve/oracle/params.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "reserve/oracle/proposal.proto"; option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; @@ -14,5 +16,61 @@ message GenesisState { // params defines all the parameters of the module. Params params = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - string port_id = 2; + BandParams band_params = 2 [ (gogoproto.nullable) = false ]; + repeated BandPriceState band_price_states = 3; + repeated BandOracleRequest band_oracle_requests = 4; + uint64 band_latest_client_id = 5; + repeated CalldataRecord calldata_records = 6; + uint64 band_latest_request_id = 7; + BandOracleRequestParams band_oracle_request_params = 8 [ (gogoproto.nullable) = false ]; +} + +message BandOracleRequestParams { + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + uint64 ask_count = 1; + + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + uint64 min_count = 2; + + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + repeated cosmos.base.v1beta1.Coin fee_limit = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // PrepareGas is amount of gas to pay to prepare raw requests + uint64 prepare_gas = 4; + // ExecuteGas is amount of gas to reserve for executing + uint64 execute_gas = 5; + // MinSourceCount is the minimum number of data sources that must be used by + // each validator + uint64 min_source_count = 6; +} + +message BandPriceState { + string symbol = 1; + string rate = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + uint64 resolve_time = 3; + uint64 request_ID = 4; + PriceState price_state = 5 [ (gogoproto.nullable) = false ]; +} + +message PriceState { + string price = 1 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + int64 timestamp = 2; +} + +message CalldataRecord { + uint64 client_id = 1; + bytes calldata = 2; } diff --git a/proto/reserve/oracle/module/module.pb.go b/proto/reserve/oracle/module/module.pb.go new file mode 100644 index 00000000..23cda5ec --- /dev/null +++ b/proto/reserve/oracle/module/module.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/oracle/module/module.proto + +package reserve_oracle_module + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +// Module is the config object for the module. +type Module struct { + // authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_d8b3976a0ef7f013, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "reserve.oracle.module.Module") +} + +func init() { + proto.RegisterFile("reserve/oracle/module/module.proto", fileDescriptor_d8b3976a0ef7f013) +} + +var fileDescriptor_d8b3976a0ef7f013 = []byte{ + // 185 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0xcf, 0xcd, 0x4f, 0x29, 0x85, + 0x53, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xa2, 0x50, 0x35, 0x7a, 0x10, 0x35, 0x7a, 0x10, + 0x49, 0x29, 0x85, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, 0xfd, 0xc4, 0x82, 0x02, 0xfd, 0x32, 0xc3, + 0xc4, 0x9c, 0x82, 0x8c, 0x44, 0x43, 0x14, 0x8d, 0x4a, 0x91, 0x5c, 0x6c, 0xbe, 0x60, 0xbe, 0x90, + 0x0c, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, + 0x06, 0x67, 0x10, 0x42, 0xc0, 0xca, 0x70, 0xd7, 0x81, 0x69, 0xb7, 0x18, 0xb5, 0xb9, 0x34, 0xd3, + 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf3, 0xf2, 0x73, 0x2b, 0xc1, + 0xc6, 0x24, 0xe7, 0xe7, 0xe8, 0xc3, 0x5c, 0x59, 0x01, 0x75, 0xa7, 0x93, 0xc4, 0x89, 0x47, 0x72, + 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, + 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x35, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0xb3, 0x0d, 0x1b, 0x7a, 0xda, 0x00, 0x00, 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/reserve/oracle/packet.proto b/proto/reserve/oracle/packet.proto index 5d68eaec..938efca2 100644 --- a/proto/reserve/oracle/packet.proto +++ b/proto/reserve/oracle/packet.proto @@ -3,8 +3,82 @@ package reserve.oracle; option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; -message OraclePacketData { - oneof packet { NoData noData = 1; } +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// ResolveStatus encodes the status of an oracle request. +enum ResolveStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // Open - the request is not yet resolved. + RESOLVE_STATUS_OPEN_UNSPECIFIED = 0 + [ (gogoproto.enumvalue_customname) = "RESOLVE_STATUS_OPEN" ]; + // Success - the request has been resolved successfully with no errors. + RESOLVE_STATUS_SUCCESS = 1 + [ (gogoproto.enumvalue_customname) = "RESOLVE_STATUS_SUCCESS" ]; + // Failure - an error occured during the request's resolve call. + RESOLVE_STATUS_FAILURE = 2 + [ (gogoproto.enumvalue_customname) = "RESOLVE_STATUS_FAILURE" ]; + // Expired - the request does not get enough reports from validator within the + // timeframe. + RESOLVE_STATUS_EXPIRED = 3 + [ (gogoproto.enumvalue_customname) = "RESOLVE_STATUS_EXPIRED" ]; } -message NoData {} +message OracleRequestPacketData { + option (gogoproto.equal) = true; + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + string client_id = 1 [ (gogoproto.customname) = "ClientID" ]; + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + uint64 oracle_script_id = 2 [ (gogoproto.customname) = "OracleScriptID" ]; + // Calldata is the OBI-encoded calldata bytes available for oracle executor to + // read. + bytes calldata = 3; + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + uint64 ask_count = 4; + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + uint64 min_count = 5; + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + repeated cosmos.base.v1beta1.Coin fee_limit = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // PrepareGas is amount of gas to pay to prepare raw requests + uint64 prepare_gas = 7; + // ExecuteGas is amount of gas to reserve for executing + uint64 execute_gas = 8; +} + +// OracleResponsePacketData encodes an oracle response from BandChain to the +// requester. +message OracleResponsePacketData { + option (gogoproto.equal) = true; + // ClientID is the unique identifier matched with that of the oracle request + // packet. + string client_id = 1 [ (gogoproto.customname) = "ClientID" ]; + // RequestID is BandChain's unique identifier for this oracle request. + uint64 request_id = 2 [ (gogoproto.customname) = "RequestID" ]; + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + uint64 ans_count = 3; + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + int64 request_time = 4; + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + int64 resolve_time = 5; + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus resolve_status = 6; + // Result is the final aggregated value encoded in OBI format. Only available + // if status if OK. + bytes result = 7; +} diff --git a/proto/reserve/oracle/params.proto b/proto/reserve/oracle/params.proto index e438e6eb..6b8880c0 100644 --- a/proto/reserve/oracle/params.proto +++ b/proto/reserve/oracle/params.proto @@ -10,4 +10,4 @@ option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; message Params { option (amino.name) = "reserve/x/oracle/Params"; option (gogoproto.equal) = true; -} \ No newline at end of file +} diff --git a/proto/reserve/oracle/proposal.proto b/proto/reserve/oracle/proposal.proto new file mode 100644 index 00000000..12a98f58 --- /dev/null +++ b/proto/reserve/oracle/proposal.proto @@ -0,0 +1,89 @@ +syntax = "proto3"; +package reserve.oracle; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; + +message UpdateBandParamsProposal { + option (amino.name) = "oracle/UpdateBandParamsProposal"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + + string title = 1; + string description = 2; + + BandParams band_params = 3 [ (gogoproto.nullable) = false ]; +} + +message UpdateBandOracleRequestProposal { + option (amino.name) = "oracle/UpdateBandOracleRequestProposal"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + + string title = 1; + string description = 2; + BandOracleRequest update_oracle_request = 4; +} + +message DeleteBandOracleRequestProposal { + option (amino.name) = "oracle/UpdateBandOracleRequestProposal"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + + string title = 1; + string description = 2; + repeated uint64 delete_request_ids = 3; +} + +message BandParams { + // block request interval to send Band IBC prices + int64 ibc_request_interval = 1; + // band IBC source channel + string ibc_source_channel = 2; + // band IBC version + string ibc_version = 3; + // band IBC portID + string ibc_port_id = 4; + // legacy oracle scheme ids + repeated int64 legacy_oracle_ids = 5; +} + +message BandOracleRequest { + // Unique Identifier for band ibc oracle request + uint64 request_id = 1; + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + int64 oracle_script_id = 2; + // Symbols is the list of symbols to prepare in the calldata + repeated string symbols = 3; + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + uint64 ask_count = 4; + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + uint64 min_count = 5; + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + repeated cosmos.base.v1beta1.Coin fee_limit = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // PrepareGas is amount of gas to pay to prepare raw requests + uint64 prepare_gas = 7; + // ExecuteGas is amount of gas to reserve for executing + uint64 execute_gas = 8; + // MinSourceCount is the minimum number of data sources that must be used by + // each validator + uint64 min_source_count = 9; +} \ No newline at end of file diff --git a/proto/reserve/oracle/query.proto b/proto/reserve/oracle/query.proto index bbc5e36a..b264f68f 100644 --- a/proto/reserve/oracle/query.proto +++ b/proto/reserve/oracle/query.proto @@ -4,8 +4,8 @@ package reserve.oracle; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "reserve/oracle/params.proto"; +import "reserve/oracle/genesis.proto"; option go_package = "github.com/onomyprotocol/reserve/x/oracle/types"; @@ -15,6 +15,12 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/reserve/oracle/params"; } + // Retrieves the state for all band price feeds + rpc BandPriceStates(QueryBandPriceStatesRequest) + returns (QueryBandPriceStatesResponse) { + option (google.api.http).get = + "/reserve/oracle/band_price_states"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -25,4 +31,14 @@ message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; -} \ No newline at end of file +} + +// QueryBandPriceStatesRequest is the request type for the +// Query/BandPriceStates RPC method. +message QueryBandPriceStatesRequest {} + +// QueryBandPriceStatesResponse is the response type for the +// Query/BandPriceStates RPC method. +message QueryBandPriceStatesResponse { + repeated BandPriceState price_states = 1; +} diff --git a/proto/reserve/oracle/tx.proto b/proto/reserve/oracle/tx.proto index 78587a50..ae46bce4 100644 --- a/proto/reserve/oracle/tx.proto +++ b/proto/reserve/oracle/tx.proto @@ -16,6 +16,8 @@ service Msg { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + rpc RequestBandRates(MsgRequestBandRates) returns (MsgRequestBandRatesResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -36,4 +38,19 @@ message MsgUpdateParams { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +// MsgRequestBandRates defines a SDK message for requesting data from +// BandChain using IBC. +message MsgRequestBandRates { + option (amino.name) = "oracle/MsgRequestBandRates"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + uint64 request_id = 2; +} + +// MsgRequestBandRatesResponse defines the Msg/RequestBandRates response type. +message MsgRequestBandRatesResponse {} diff --git a/proto/reserve/psm/module/v1/module.proto b/proto/reserve/psm/module/v1/module.proto new file mode 100644 index 00000000..498a8b28 --- /dev/null +++ b/proto/reserve/psm/module/v1/module.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package reserve.psm.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/onomyprotocol/reserve/x/psm" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; + +} \ No newline at end of file diff --git a/proto/reserve/psm/v1/genesis.proto b/proto/reserve/psm/v1/genesis.proto new file mode 100644 index 00000000..67ea474a --- /dev/null +++ b/proto/reserve/psm/v1/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package reserve.psm.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "reserve/psm/v1/params.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +// GenesisState defines the psm module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/reserve/psm/v1/params.proto b/proto/reserve/psm/v1/params.proto new file mode 100644 index 00000000..572c5a6b --- /dev/null +++ b/proto/reserve/psm/v1/params.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package reserve.psm.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +message Params { + // total $nomUSD can mint + bytes limit_total = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + // The price cannot be exactly 1, an acceptable such as 0.9999 (AcceptablePriceRatio = 0.0001) + bytes acceptable_price_ratio = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // feeIn adjustment factor + int64 adjustment_fee = 3; + +} \ No newline at end of file diff --git a/proto/reserve/psm/v1/psm.proto b/proto/reserve/psm/v1/psm.proto new file mode 100644 index 00000000..3770b6e4 --- /dev/null +++ b/proto/reserve/psm/v1/psm.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package reserve.psm.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +message Stablecoin { + string denom = 1; + // limit total stablecoin module support + bytes limit_total = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + bytes fee_in = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + bytes fee_out = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +// message LockCoin { +// string address = 1; +// cosmos.base.v1beta1.Coin coin = 2; +// int64 time = 3; +// } diff --git a/proto/reserve/psm/v1/query.proto b/proto/reserve/psm/v1/query.proto new file mode 100644 index 00000000..e90691d9 --- /dev/null +++ b/proto/reserve/psm/v1/query.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; +package reserve.psm.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "reserve/psm/v1/params.proto"; +import "reserve/psm/v1/psm.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/onomyprotocol/reserve/psm/v1/params"; + } + + rpc Stablecoin(QueryStablecoinRequest) returns (QueryStablecoinResponse) { + option (google.api.http).get = "/onomyprotocol/psm/v1/psm"; + } + + rpc AllStablecoin(QueryAllStablecoinRequest) returns (QueryAllStablecoinResponse) { + option (google.api.http).get = "/onomyprotocol/psm/v1/psm"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + + +message QueryStablecoinRequest { + string denom = 1; +} + +message QueryStablecoinResponse { + Stablecoin stablecoin = 1 [(gogoproto.nullable) = false]; + bytes current_total = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + bytes swapable_quantity = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +message QueryAllStablecoinRequest { +} + +message QueryAllStablecoinResponse { + repeated StablecoinResponse all_stablecoin_response = 1 ; +} + +message StablecoinResponse { + Stablecoin stablecoin = 1 [(gogoproto.nullable) = false]; + bytes current_total = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + bytes swapable_quantity = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/reserve/psm/v1/tx.proto b/proto/reserve/psm/v1/tx.proto new file mode 100644 index 00000000..f9e283e0 --- /dev/null +++ b/proto/reserve/psm/v1/tx.proto @@ -0,0 +1,125 @@ +syntax = "proto3"; +package reserve.psm.v1; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "reserve/psm/v1/params.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/psm/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc AddStableCoinProposal(MsgAddStableCoin) returns (MsgAddStableCoinResponse); + rpc UpdatesStableCoinProposal(MsgUpdatesStableCoin) returns (MsgUpdatesStableCoinResponse); + rpc SwapTonomUSD(MsgSwapTonomUSD) returns (MsgSwapTonomUSDResponse); + rpc SwapToStablecoin(MsgSwapToStablecoin) returns (MsgSwapToStablecoinResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/psm/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +message MsgSwapTonomUSD { + option (cosmos.msg.v1.signer) = "address"; + + string address = 1; + cosmos.base.v1beta1.Coin coin = 2; +} +message MsgSwapTonomUSDResponse {} + +message MsgSwapToStablecoin { + option (cosmos.msg.v1.signer) = "address"; + + string address = 1; + string to_denom = 2; + bytes amount = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} +message MsgSwapToStablecoinResponse {} + +message MsgAddStableCoin { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/psm/MsgAddStableCoin"; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + string denom = 2; + + bytes limit_total = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + bytes fee_in = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + bytes fee_out = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +message MsgAddStableCoinResponse {} + +message MsgUpdatesStableCoin { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/psm/MsgUpdatesStableCoin"; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + string denom = 2; + + bytes limit_total = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + bytes fee_in = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + bytes fee_out = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +message MsgUpdatesStableCoinResponse {} \ No newline at end of file diff --git a/proto/reserve/vaults/genesis.proto b/proto/reserve/vaults/genesis.proto new file mode 100644 index 00000000..eb1829f8 --- /dev/null +++ b/proto/reserve/vaults/genesis.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package reserve.vaults; + +import "gogoproto/gogo.proto"; +import "reserve/vaults/params.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + +// GenesisState defines the oracle module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + repeated VaultMamager vault_managers = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + repeated Vault vaults = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + LastUpdate last_update = 4; + + string shortfall_amount = 5 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/reserve/vaults/module/module.pb.go b/proto/reserve/vaults/module/module.pb.go new file mode 100644 index 00000000..c5a66889 --- /dev/null +++ b/proto/reserve/vaults/module/module.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/module/module.proto + +package reserve_vaults_module + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +// Module is the config object for the module. +type Module struct { + // authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_e8d435ea76ee76d0, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "reserve.vaults.module.Module") +} + +func init() { + proto.RegisterFile("reserve/vaults/module/module.proto", fileDescriptor_e8d435ea76ee76d0) +} + +var fileDescriptor_e8d435ea76ee76d0 = []byte{ + // 187 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0x29, 0xd6, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, + 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xa2, 0x50, 0x35, 0x7a, 0x10, 0x35, + 0x7a, 0x10, 0x49, 0x29, 0x85, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, 0xfd, 0xc4, 0x82, 0x02, 0xfd, + 0x32, 0xc3, 0xc4, 0x9c, 0x82, 0x8c, 0x44, 0x43, 0x14, 0x8d, 0x4a, 0x91, 0x5c, 0x6c, 0xbe, 0x60, + 0xbe, 0x90, 0x0c, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, + 0x02, 0xa3, 0x06, 0x67, 0x10, 0x42, 0xc0, 0xca, 0x70, 0xd7, 0x81, 0x69, 0xb7, 0x18, 0xb5, 0xb9, + 0x34, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf3, 0xf2, 0x73, + 0x2b, 0xc1, 0xc6, 0x24, 0xe7, 0xe7, 0xe8, 0xc3, 0x5c, 0x59, 0x01, 0x75, 0xa7, 0x93, 0xc4, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x35, 0x19, 0x03, 0x02, 0x00, + 0x00, 0xff, 0xff, 0xeb, 0x66, 0x5a, 0x3e, 0xda, 0x00, 0x00, 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/reserve/vaults/module/module.proto b/proto/reserve/vaults/module/module.proto new file mode 100644 index 00000000..0c6f3104 --- /dev/null +++ b/proto/reserve/vaults/module/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package reserve.vaults.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import : "github.com/onomyprotocol/reserve/x/vaults" + }; + + // authority defines the custom module authority. If not set, defaults to the + // governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/reserve/vaults/params.proto b/proto/reserve/vaults/params.proto new file mode 100644 index 00000000..63253ad9 --- /dev/null +++ b/proto/reserve/vaults/params.proto @@ -0,0 +1,164 @@ +syntax = "proto3"; +package reserve.vaults; + +import "gogoproto/gogo.proto"; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "reserve/x/vaults/Params"; + option (gogoproto.equal) = true; + + string min_initial_debt = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string mint_denom = 2; + + google.protobuf.Duration charging_period = 3 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + google.protobuf.Duration liquidate_period = 4 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// VaultParams defines the parameters for each collateral vault type. +message VaultMamagerParams { + string min_collateral_ratio = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_ratio = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string max_debt = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string stability_fee = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_penalty = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string minting_fee = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; +} + +// VaultMamager defines the manager of each collateral vault type. +message VaultMamager { + VaultMamagerParams params = 1 + [ (amino.dont_omitempty) = true, (gogoproto.nullable) = false ]; + + string denom = 2; + + string mint_available = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; +} + +// VaultStatus is the status of a vault. +enum VaultStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // ACTIVE - vault is in use and can be changed + ACTIVE = 0 [ (gogoproto.enumvalue_customname) = "ACTIVE" ]; + // LIQUIDATING - vault is being liquidated by the vault manager, and cannot be + // changed by the user. If liquidation fails, vaults may remain in this state. + // An upgrade might be able to recover them. + LIQUIDATING = 1 [ (gogoproto.enumvalue_customname) = "LIQUIDATING" ]; + // TRANSFER - vault is able to be transferred (payments and debits frozen + // until it has a new owner) + TRANSFER = 2 [ (gogoproto.enumvalue_customname) = "TRANSFER" ]; + // CLOSED - vault was closed by the user and all assets have been paid out + CLOSED = 3 [ (gogoproto.enumvalue_customname) = "CLOSED" ]; + // LIQUIDATED - vault was closed by the manager, with remaining assets paid to + // owner + LIQUIDATED = 4 [ (gogoproto.enumvalue_customname) = "LIQUIDATED" ]; +} + +message Vault { + uint64 id = 1; + string owner = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin debt = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + cosmos.base.v1beta1.Coin collateral_locked = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + VaultStatus status = 5; + + string liquidation_price = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string address = 7 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +message VaultLiquidationStatus { + cosmos.base.v1beta1.Coin sold = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + cosmos.base.v1beta1.Coin remain_collateral = 5 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +message Liquidation { + string denom = 1; + + repeated Vault liquidating_vaults = 3; + + map vault_liquidation_status = 4; +} + +message LastUpdate { + google.protobuf.Timestamp time = 1 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} \ No newline at end of file diff --git a/proto/reserve/vaults/proposal.proto b/proto/reserve/vaults/proposal.proto new file mode 100644 index 00000000..b1d0289d --- /dev/null +++ b/proto/reserve/vaults/proposal.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package reserve.vaults; + +import "gogoproto/gogo.proto"; +import "reserve/vaults/tx.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; + + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + + +message ActiveCollateralProposal { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "reserve/ActiveCollateralProposal"; + + string title = 1; + string description = 2; + MsgActiveCollateral active_collateral = 3 [(gogoproto.nullable) = false]; +} + +message UpdatesCollateralProposal { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "reserve/UpdatesCollateralProposal"; + + string title = 1; + string description = 2; + MsgUpdatesCollateral updates_collateral = 3 [(gogoproto.nullable) = false]; +} diff --git a/proto/reserve/vaults/query.proto b/proto/reserve/vaults/query.proto new file mode 100644 index 00000000..fc0bad8f --- /dev/null +++ b/proto/reserve/vaults/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package reserve.vaults; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "reserve/vaults/params.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/reserve/vaults/params"; + } + + rpc QueryAllCollateral(QueryAllCollateralRequest) returns (QueryAllCollateralResponse){ + option (google.api.http).get = "/reserve/vaults/params"; + } + + rpc QueryAllVaults(QueryAllVaultsRequest) returns (QueryAllVaultsResponse){ + option (google.api.http).get = "/reserve/vaults/params"; + } + + rpc QueryVaults(QueryVaultIdRequest) returns (QueryVaultIdResponse){ + option (google.api.http).get = "/reserve/vaults/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +message QueryVaultIdRequest { + uint64 vault_id = 1; +} + +message QueryVaultIdResponse{ + Vault vault = 1; +} + +message QueryAllVaultsRequest { +} + +message QueryAllVaultsResponse{ + repeated Vault all_vault = 1; +} + +message QueryAllCollateralRequest {} + +message QueryAllCollateralResponse{ + repeated VaultMamager all_vault_mamager = 1; +} \ No newline at end of file diff --git a/proto/reserve/vaults/tx.proto b/proto/reserve/vaults/tx.proto new file mode 100644 index 00000000..fa8a7592 --- /dev/null +++ b/proto/reserve/vaults/tx.proto @@ -0,0 +1,283 @@ +syntax = "proto3"; +package reserve.vaults; + +import "gogoproto/gogo.proto"; +import "reserve/vaults/params.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + +// Msg defines the vaults Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // ActiveCollateral defines a method for enable a collateral asset + rpc ActiveCollateral(MsgActiveCollateral) + returns (MsgActiveCollateralResponse); + + // UpdatesCollateral defines a method for update a collateral asset + rpc UpdatesCollateral(MsgUpdatesCollateral) + returns (MsgUpdatesCollateralResponse); + + // CreateVault defines a method for creating a new vault and mint token + rpc CreateVault(MsgCreateVault) returns (MsgCreateVaultResponse); + + // Deposit defines a method for depositing collateral assets to vault + rpc Deposit(MsgDeposit) returns (MsgDepositResponse); + + // Withdraw defines a method for withdrawing collateral assets out of the + // vault + rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse); + + // Mint defines a method for minting more tokens + rpc Mint(MsgMint) returns (MsgMintResponse); + + // Repay defines a method for reducing debt by burning tokens + rpc Repay(MsgRepay) returns (MsgRepayResponse); + + // Close defines a method for close vault + rpc Close(MsgClose) returns (MsgCloseResponse); +} + +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/oracle/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgActiveCollateral { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + string denom = 1; + + string min_collateral_ratio = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_ratio = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string max_debt = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string stability_fee = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_penalty = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string minting_fee = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + uint64 oracl_script = 8; + + string authority = 9 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +message MsgActiveCollateralResponse {} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgUpdatesCollateral { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + string denom = 1; + + string min_collateral_ratio = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_ratio = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string max_debt = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string stability_fee = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_penalty = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string minting_fee = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + uint64 oracl_script = 8; + + string authority = 9 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +message MsgUpdatesCollateralResponse {} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgCreateVault { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "owner"; + + string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin collateral = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + cosmos.base.v1beta1.Coin minted = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgCreateVaultResponse defines the Msg/CreateVault response type. +message MsgCreateVaultResponse {} + +// MsgDeposit defines a SDK message for depositing collateral assets to the +// vault. +message MsgDeposit { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + uint64 vault_id = 1; + + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgDepositResponse defines the Msg/Deposit response type. +message MsgDepositResponse {} + +// MsgWithdraw defines a SDK message for withdrawing collateral assets out of +// the vault. +message MsgWithdraw { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + uint64 vault_id = 1; + + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgWithdrawResponse defines the Msg/Withdraw response type. +message MsgWithdrawResponse {} + +// MsgMint defines a SDK message for minting more tokens. +message MsgMint { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + uint64 vault_id = 1; + + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgMintResponse defines the Msg/Mint response type. +message MsgMintResponse {} + +// MsgRepay defines a SDK message for repay debt. +message MsgRepay { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + uint64 vault_id = 1; + + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgRepayResponse defines the Msg/Mint response type. +message MsgRepayResponse {} + +// MsgClose defines a SDK message for closing vault. +message MsgClose { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "sender"; + + uint64 vault_id = 1; + + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgRepayResponse defines the Msg/Mint response type. +message MsgCloseResponse {} diff --git a/proto/scripts/protocgen-pulsar.sh b/proto/scripts/protocgen-pulsar.sh new file mode 100644 index 00000000..93198eec --- /dev/null +++ b/proto/scripts/protocgen-pulsar.sh @@ -0,0 +1,8 @@ +# this script is for generating protobuf files for the new google.golang.org/protobuf API +set -eo pipefail + +echo "Cleaning API directory" +(cd api; find ./ -type f \( -iname \*.pulsar.go -o -iname \*.pb.go -o -iname \*.cosmos_orm.go -o -iname \*.pb.gw.go \) -delete; find . -empty -type d -delete; cd ..) + +echo "Generating API module" +(cd proto; buf generate --template buf.gen.pulsar.yaml) diff --git a/script/proposal-1.json b/script/proposal-1.json new file mode 100644 index 00000000..7f7fc6ee --- /dev/null +++ b/script/proposal-1.json @@ -0,0 +1,13 @@ +{ + "messages": [{ + "@type": "/reserve.vaults.MsgActiveCollateral", + "denom": "atom", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "min_collateral_ratio": "0.5", + "liquidation_ratio":"0.5", + "max_debt":"10000" + }], + "deposit": "100000000stake", + "title": "My proposal", + "summary": "A short summary of my proposal" + } \ No newline at end of file diff --git a/script/proposal-2.json b/script/proposal-2.json new file mode 100644 index 00000000..27fbb9ec --- /dev/null +++ b/script/proposal-2.json @@ -0,0 +1,14 @@ +{ + "messages": [{ + "@type": "/reserve.psm.v1.MsgAddStableCoin", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "denom": "usdt", + "limit_total": "100000000000000000000000000000", + "fee_in": "0.001000000000000000", + "fee_out": "0.001000000000000000" + + }], + "deposit": "100000000stake", + "title": "My proposal", + "summary": "A short summary of my proposal" + } \ No newline at end of file diff --git a/script/psm-test.sh b/script/psm-test.sh new file mode 100755 index 00000000..12d3d40f --- /dev/null +++ b/script/psm-test.sh @@ -0,0 +1,151 @@ +#!/bin/bash +set -xeu + +# always returns true so set -e doesn't exit if it is not running. +killall reserved || true +rm -rf $HOME/.reserved/ + +mkdir $HOME/.reserved +mkdir $HOME/.reserved/validator1 +mkdir $HOME/.reserved/validator2 +mkdir $HOME/.reserved/validator3 + +# init all three validators +reserved init --chain-id=testing-1 validator1 --home=$HOME/.reserved/validator1 +reserved init --chain-id=testing-1 validator2 --home=$HOME/.reserved/validator2 +reserved init --chain-id=testing-1 validator3 --home=$HOME/.reserved/validator3 + +# create keys for all three validators +mnemonic1="top toddler wrist parade hobby supply odor ginger resource copy square tell vanish pride volcano effort planet style transfer pipe wise bus tuition luxury" +mnemonic2="panther giant oyster hand song region chunk coil laundry glance ball denial void ramp palm fiscal pizza soccer before upset diet valid story cement" +mnemonic3="gap track crop knee galaxy square case resemble subway math moon mom casino trade finish exotic author comic gap margin elegant claw fire business" + +echo $mnemonic1| reserved keys add validator1 --recover --keyring-backend=test --home=$HOME/.reserved/validator1 +echo $mnemonic2| reserved keys add validator2 --recover --keyring-backend=test --home=$HOME/.reserved/validator2 +echo $mnemonic3| reserved keys add validator3 --recover --keyring-backend=test --home=$HOME/.reserved/validator3 + +# create validator node with tokens to transfer to the three other nodes +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis gentx validator1 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --chain-id=testing-1 +reserved genesis gentx validator2 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator2 --chain-id=testing-1 +reserved genesis gentx validator3 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator3 --chain-id=testing-1 + +# cp validator2/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +# cp validator3/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +reserved genesis collect-gentxs --home=$HOME/.reserved/validator1 + +# change app.toml values +VALIDATOR1_APP_TOML=$HOME/.reserved/validator1/config/app.toml +VALIDATOR2_APP_TOML=$HOME/.reserved/validator2/config/app.toml +VALIDATOR3_APP_TOML=$HOME/.reserved/validator3/config/app.toml + +# validator1 +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|127.0.0.1:9090|127.0.0.1:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR1_APP_TOML + +# validator2 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1316|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9088|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9089|g' $VALIDATOR2_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR2_APP_TOML + +# validator3 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1315|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9086|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9087|g' $VALIDATOR3_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR3_APP_TOML + +# change config.toml values +VALIDATOR1_CONFIG=$HOME/.reserved/validator1/config/config.toml +VALIDATOR2_CONFIG=$HOME/.reserved/validator2/config/config.toml +VALIDATOR3_CONFIG=$HOME/.reserved/validator3/config/config.toml + + +# validator1 +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR1_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR1_CONFIG + + +# validator2 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26655|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26654|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26653|g' $VALIDATOR2_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26630"|g' $VALIDATOR2_CONFIG + +# validator3 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26652|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26651|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26650|g' $VALIDATOR3_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26620"|g' $VALIDATOR3_CONFIG + +# copy, update validator1 genesis file to validator2-3 +update_test_genesis () { + cat $HOME/.reserved/validator1/config/genesis.json | jq "$1" > tmp.json && mv tmp.json $HOME/.reserved/validator1/config/genesis.json +} + +update_test_genesis '.app_state["gov"]["params"]["voting_period"] = "15s"' +update_test_genesis '.app_state["gov"]["params"]["expedited_voting_period"] = "10s"' + +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator2/config/genesis.json +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator3/config/genesis.json + +# copy tendermint node id of validator1 to persistent peers of validator2-3 +node1=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator1) +node2=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator2) +node3=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator3) +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator1/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator2/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator3/config/config.toml + + +# # start all three validators +screen -S onomy1 -t onomy1 -d -m reserved start --home=$HOME/.reserved/validator1 +screen -S onomy2 -t onomy2 -d -m reserved start --home=$HOME/.reserved/validator2 +screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator3 + +# submit proposal add usdt +sleep 7 +reserved tx gov submit-proposal ./script/proposal-2.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y + +# # vote +sleep 7 +reserved tx gov vote 1 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake + +# wait voting_perio=15s +sleep 15 +echo "========sleep==========" + +# check add usdt, balances +reserved q psm all-stablecoin +reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) + +# tx swap usdt to nomUSD +echo "========swap===========" +reserved tx psm swap-to-nomUSD 100000000000000000000000000000usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +sleep 7 +# Check account after swap +reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) + +# tx swap nomUSD to usdt +reserved tx psm swap-to-stablecoin usdt 1000nomUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +sleep 7 +# Check account after swap +reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) +# killall reserved || true \ No newline at end of file diff --git a/script/vaults-gov-test.sh b/script/vaults-gov-test.sh new file mode 100755 index 00000000..3231dc8c --- /dev/null +++ b/script/vaults-gov-test.sh @@ -0,0 +1,137 @@ +#!/bin/bash +set -xeu + +# always returns true so set -e doesn't exit if it is not running. +killall reserved || true +rm -rf $HOME/.reserved/ + +mkdir $HOME/.reserved +mkdir $HOME/.reserved/validator1 +mkdir $HOME/.reserved/validator2 +mkdir $HOME/.reserved/validator3 + +# init all three validators +reserved init --chain-id=testing-1 validator1 --home=$HOME/.reserved/validator1 +reserved init --chain-id=testing-1 validator2 --home=$HOME/.reserved/validator2 +reserved init --chain-id=testing-1 validator3 --home=$HOME/.reserved/validator3 + +# create keys for all three validators +mnemonic1="top toddler wrist parade hobby supply odor ginger resource copy square tell vanish pride volcano effort planet style transfer pipe wise bus tuition luxury" +mnemonic2="panther giant oyster hand song region chunk coil laundry glance ball denial void ramp palm fiscal pizza soccer before upset diet valid story cement" +mnemonic3="gap track crop knee galaxy square case resemble subway math moon mom casino trade finish exotic author comic gap margin elegant claw fire business" + +echo $mnemonic1| reserved keys add validator1 --recover --keyring-backend=test --home=$HOME/.reserved/validator1 +echo $mnemonic2| reserved keys add validator2 --recover --keyring-backend=test --home=$HOME/.reserved/validator2 +echo $mnemonic3| reserved keys add validator3 --recover --keyring-backend=test --home=$HOME/.reserved/validator3 + +# create validator node with tokens to transfer to the three other nodes +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis gentx validator1 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --chain-id=testing-1 +reserved genesis gentx validator2 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator2 --chain-id=testing-1 +reserved genesis gentx validator3 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator3 --chain-id=testing-1 + +# cp validator2/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +# cp validator3/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +reserved genesis collect-gentxs --home=$HOME/.reserved/validator1 + +# change app.toml values +VALIDATOR1_APP_TOML=$HOME/.reserved/validator1/config/app.toml +VALIDATOR2_APP_TOML=$HOME/.reserved/validator2/config/app.toml +VALIDATOR3_APP_TOML=$HOME/.reserved/validator3/config/app.toml + +# validator1 +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|127.0.0.1:9090|127.0.0.1:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR1_APP_TOML + +# validator2 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1316|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9088|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9089|g' $VALIDATOR2_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR2_APP_TOML + +# validator3 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1315|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9086|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9087|g' $VALIDATOR3_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR3_APP_TOML + +# change config.toml values +VALIDATOR1_CONFIG=$HOME/.reserved/validator1/config/config.toml +VALIDATOR2_CONFIG=$HOME/.reserved/validator2/config/config.toml +VALIDATOR3_CONFIG=$HOME/.reserved/validator3/config/config.toml + + +# validator1 +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR1_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR1_CONFIG + + +# validator2 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26655|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26654|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26653|g' $VALIDATOR2_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26630"|g' $VALIDATOR2_CONFIG + +# validator3 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26652|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26651|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26650|g' $VALIDATOR3_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26620"|g' $VALIDATOR3_CONFIG + +# copy, update validator1 genesis file to validator2-3 +update_test_genesis () { + cat $HOME/.reserved/validator1/config/genesis.json | jq "$1" > tmp.json && mv tmp.json $HOME/.reserved/validator1/config/genesis.json +} + +update_test_genesis '.app_state["gov"]["params"]["voting_period"] = "15s"' +update_test_genesis '.app_state["gov"]["params"]["expedited_voting_period"] = "10s"' + +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator2/config/genesis.json +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator3/config/genesis.json + +# copy tendermint node id of validator1 to persistent peers of validator2-3 +node1=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator1) +node2=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator2) +node3=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator3) +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator1/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator2/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator3/config/config.toml + + +# # start all three validators +screen -S onomy1 -t onomy1 -d -m reserved start --home=$HOME/.reserved/validator1 +screen -S onomy2 -t onomy2 -d -m reserved start --home=$HOME/.reserved/validator2 +screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator3 + +# submit proposal add usdt +sleep 7 +reserved q gov proposals +# reserved tx gov submit-legacy-proposal active-collateral "title" "description" "atom" "10" "0.1" "10000" 10000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --from validator1 -y --chain-id testing-1 --fees 20stake + +reserved tx gov submit-proposal ./script/proposal-1.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y + +# # vote +sleep 7 +reserved tx gov vote 1 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake + +# wait voting_perio=15s +echo "========sleep==========" +sleep 15 +reserved q gov proposals + +killall reserved || true \ No newline at end of file diff --git a/testutil/keeper/oracle.go b/testutil/keeper/oracle.go index 472c498d..ca8b0fca 100644 --- a/testutil/keeper/oracle.go +++ b/testutil/keeper/oracle.go @@ -57,6 +57,7 @@ func OracleKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { func(string) capabilitykeeper.ScopedKeeper { return scopeModule }, + // scopedKeeper, ) ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) diff --git a/x/.DS_Store b/x/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/x/.DS_Store differ diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go new file mode 100644 index 00000000..403dfedd --- /dev/null +++ b/x/auction/client/cli/query.go @@ -0,0 +1,47 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, // nolint:gomnd + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryAllAuctions()) + return cmd +} + +func CmdQueryAllAuctions() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-auction", + Short: "show all auctions", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryAllAuction(context.Background(), &types.QueryAllAuctionRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go new file mode 100644 index 00000000..a09a9db4 --- /dev/null +++ b/x/auction/client/cli/tx.go @@ -0,0 +1,100 @@ +package cli + +import ( + "fmt" + "strconv" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/auction/types" +) + +// GetTxCmd returns the transaction commands for this module. +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(NewBidCmd()) + cmd.AddCommand(NewCancelBidCmd()) + + return cmd +} + +func NewBidCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "bid [auction-id] [amount] [recive_rate]", + Args: cobra.ExactArgs(3), + Short: "create vaults ", + Long: `create vaults. + + Example: + $ onomyd tx bid 0 1000nomUSD 0.8 --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + auctionID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + msg := types.NewMsgBid(addr.String(), auctionID, amount, args[2]) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewCancelBidCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "cancel-bid [bid-id] [auction_id]", + Args: cobra.ExactArgs(2), + Short: "create vaults ", + Long: `create vaults. + + Example: + $ onomyd tx cancel-bid 1 0 --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + auctionID, err := strconv.ParseUint(args[1], 10, 64) + if err != nil { + return err + } + + bidID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + msg := types.NewMsgCancelBid(addr.String(), bidID, auctionID) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/auction/keeper/abci.go b/x/auction/keeper/abci.go new file mode 100644 index 00000000..37a1a4d6 --- /dev/null +++ b/x/auction/keeper/abci.go @@ -0,0 +1,296 @@ +package keeper + +import ( + "context" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/auction/types" + vaultstypes "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func (k *Keeper) BeginBlocker(ctx context.Context) error { + params := k.GetParams(ctx) + + currentTime := sdk.UnwrapSDKContext(ctx).BlockHeader().Time + lastAuctionPeriods_unix, err := k.lastestAuctionPeriod.Get(ctx) + if err != nil { + return err + } + lastAuctionPeriods := time.Unix(lastAuctionPeriods_unix, 0) + // check if has reached the next auction periods + if lastAuctionPeriods.Add(params.AuctionPeriods).Before(currentTime) { + // update latest auction period + err := k.lastestAuctionPeriod.Set(ctx, lastAuctionPeriods.Add(params.AuctionPeriods).Unix()) + if err != nil { + return err + } + + liquidations, err := k.vaultKeeper.GetLiquidations(ctx) + if err != nil { + return err + } + + liquidatedVaults := make([]*vaultstypes.Vault, 0) + for _, liq := range liquidations { + liquidatedVaults = append(liquidatedVaults, liq.LiquidatingVaults...) + } + + // create new auction for this vault + for _, vault := range liquidatedVaults { + //calcualte initial price and target price + auction, isCreate, err := k.GetNewAuction(ctx, currentTime, vault.LiquidationPrice, vault.CollateralLocked, vault.Debt, vault.Id) + if err != nil { + return err + } + + if isCreate { + err = k.Auctions.Set(ctx, auction.AuctionId, *auction) + if err != nil { + return err + } + err = k.Bids.Set(ctx, auction.AuctionId, types.BidQueue{AuctionId: auction.AuctionId, Bids: []*types.Bid{}}) + if err != nil { + return err + } + err = k.BidIdSeq.Set(ctx, auction.AuctionId, 0) + if err != nil { + return err + } + } + if err != nil { + return err + } + } + } + + // loop through all auctions + // get liquidations data then distribute debt & collateral remain + liquidationMap := make(map[string]*vaultstypes.Liquidation) + err = k.Auctions.Walk(ctx, nil, func(auctionId uint64, auction types.Auction) (bool, error) { + bidQueue, err := k.Bids.Get(ctx, auction.AuctionId) + if err != nil { + return true, err + } + vault, err := k.vaultKeeper.GetVault(ctx, auction.VaultId) + if err != nil { + return true, err + } + + needCleanup := false + if auction.Status == types.AuctionStatus_AUCTION_STATUS_FINISHED || + auction.Status == types.AuctionStatus_AUCTION_STATUS_OUT_OF_COLLATHERAL || + auction.EndTime.Before(currentTime) { + liquidation_tmp, ok := liquidationMap[auction.Item.Denom] + if ok && liquidation_tmp != nil { + liquidation_tmp.Denom = auction.Item.Denom + liquidation_tmp.LiquidatingVaults = append(liquidation_tmp.LiquidatingVaults, &vault) + liquidation_tmp.VaultLiquidationStatus[vault.Id].Sold = liquidation_tmp.VaultLiquidationStatus[vault.Id].Sold.Add(auction.TokenRaised) + liquidation_tmp.VaultLiquidationStatus[vault.Id].RemainCollateral = liquidation_tmp.VaultLiquidationStatus[vault.Id].RemainCollateral.Add(auction.Item) + } else { + liquidation_tmp = &vaultstypes.Liquidation{ + Denom: auction.Item.Denom, + LiquidatingVaults: []*vaultstypes.Vault{&vault}, + VaultLiquidationStatus: make(map[uint64]*vaultstypes.VaultLiquidationStatus), + } + + liquidation_tmp.VaultLiquidationStatus[vault.Id] = &vaultstypes.VaultLiquidationStatus{ + Sold: auction.TokenRaised, + RemainCollateral: auction.Item, + } + liquidationMap[auction.Item.Denom] = liquidation_tmp + } + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, vaultstypes.ModuleName, sdk.NewCoins(liquidationMap[auction.Item.Denom].VaultLiquidationStatus[vault.Id].Sold)) + if err != nil { + return true, err + } + + needCleanup = true + // skip other logic + } + + if needCleanup { + k.refundBidders(ctx, bidQueue) + + // clear the auction afterward + err = k.DeleteAuction(ctx, auction.AuctionId) + if err != nil { + return true, err + } + + return false, nil + } + + // check if reach next reduce step + if auction.LastDiscountTime.Add(params.ReduceStep).Before(currentTime) { + // get new discount rate + newRate, err := k.discountRate(auction, params) + if err != nil { + return true, err + } + + // apply new changes + auction.CurrentRate = newRate + auction.LastDiscountTime = auction.LastDiscountTime.Add(params.ReduceStep) + + // update new rate and last discount time + err = k.Auctions.Set(ctx, auctionId, auction) + if err != nil { + return true, err + } + } + + err = k.fillBids(ctx, auction, bidQueue) + if err != nil { + return true, err + } + + return false, nil + }) + + // Loop through liquidationMap and liquidate + for _, liq := range liquidationMap { + err := k.vaultKeeper.Liquidate(ctx, *liq) + if err != nil { + return err + } + } + if err != nil { + return err + } + + return nil +} + +func (k Keeper) fillBids(ctx context.Context, auction types.Auction, bidQueue types.BidQueue) error { + itemDenom := auction.Item.Denom + + currentRate, err := math.LegacyNewDecFromStr(auction.CurrentRate) + if err != nil { + return err + } + + vault, err := k.vaultKeeper.GetVault(ctx, auction.VaultId) + if err != nil { + return err + } + + for i, bid := range bidQueue.Bids { + if bid.IsHandle { + continue + } + + initPrices, err := math.LegacyNewDecFromStr(auction.InitialPrice) + if err != nil { + continue + } + + receivePrice, err := math.LegacyNewDecFromStr(bid.RecivePrice) + if err != nil { + continue + } + + // Only handle bid if: (rate * init price) <= receive price + if currentRate.Mul(initPrices).LTE(receivePrice) { + bidderAddr, err := k.authKeeper.AddressCodec().StringToBytes(bid.Bidder) + if err != nil { + continue + } + + receiveAmt := bid.Amount.Amount.ToLegacyDec().Quo(receivePrice).TruncateInt() + receiveCoin := sdk.NewCoin(itemDenom, receiveAmt) + // if out of collatheral + if auction.Item.Amount.LT(receiveAmt) { + auction.Status = types.AuctionStatus_AUCTION_STATUS_OUT_OF_COLLATHERAL + + amountBuy := auction.Item.Amount.ToLegacyDec().Mul(receivePrice).TruncateInt() + + amountRefund := bid.Amount.Amount.Sub(amountBuy) + // send all auction item + err = k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(vault.Address), bidderAddr, sdk.NewCoins(auction.Item)) + if err != nil { + continue + } + + err = k.refundToken(ctx, sdk.NewCoins(sdk.NewCoin(bid.Amount.Denom, amountRefund)), bid.Bidder) + if err != nil { + continue + } + + auction.Item = sdk.NewCoin(auction.Item.Denom, math.ZeroInt()) + auction.TokenRaised = auction.TokenRaised.Add(sdk.NewCoin(bid.Amount.Denom, amountBuy)) + } else { + err = k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(vault.Address), bidderAddr, sdk.NewCoins(receiveCoin)) + if err != nil { + continue + } + + // update auction collatheral + auction.Item = auction.Item.Sub(receiveCoin) + + auction.TokenRaised = auction.TokenRaised.Add(bid.Amount) + } + + if auction.TokenRaised.IsGTE(auction.TargetGoal) { + auction.Status = types.AuctionStatus_AUCTION_STATUS_FINISHED + } + + bidQueue.Bids[i].IsHandle = true + } + + // update auction status + err = k.Auctions.Set(ctx, auction.AuctionId, auction) + if err != nil { + return err + } + } + + // update bid queue + err = k.Bids.Set(ctx, auction.AuctionId, bidQueue) + if err != nil { + return err + } + + return nil + +} + +func (k Keeper) refundBidders(ctx context.Context, bidQueue types.BidQueue) error { + for _, bid := range bidQueue.Bids { + if bid.IsHandle { + continue + } + + err := k.refundToken(ctx, sdk.NewCoins(bid.Amount), bid.Bidder) + if err != nil { + return err + } + } + return nil +} + +func (k Keeper) discountRate(auction types.Auction, params types.Params) (string, error) { + lowestRate, err := math.LegacyNewDecFromStr(params.LowestRate) + if err != nil { + return math.LegacyZeroDec().String(), err + } + + discountRate, err := math.LegacyNewDecFromStr(params.DiscountRate) + if err != nil { + return math.LegacyZeroDec().String(), err + } + + currentRate, err := math.LegacyNewDecFromStr(auction.CurrentRate) + if err != nil { + return math.LegacyZeroDec().String(), err + } + + if currentRate.LT(lowestRate) || currentRate.Sub(discountRate).LT(lowestRate) { + return currentRate.String(), nil + } + + newCurrentRate := currentRate.Sub(discountRate) + + return newCurrentRate.String(), nil +} diff --git a/x/auction/keeper/auction.go b/x/auction/keeper/auction.go new file mode 100644 index 00000000..15fceac0 --- /dev/null +++ b/x/auction/keeper/auction.go @@ -0,0 +1,78 @@ +package keeper + +import ( + "context" + "fmt" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/auction/types" + vaultstypes "github.com/onomyprotocol/reserve/x/vaults/types" +) + +// return aution, is create, error +func (k Keeper) GetNewAuction(ctx context.Context, + startTime time.Time, + initialPrice math.LegacyDec, + item, targetGoal sdk.Coin, + vaultId uint64, +) (*types.Auction, bool, error) { + var newAuction *types.Auction + k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { + if value.VaultId == vaultId { + newAuction = &value + return true, nil + } + return false, nil + }) + if newAuction != nil { + return newAuction, false, nil + } + newAuction, err := k.NewAuction(ctx, startTime, initialPrice, item, targetGoal, vaultId) + if err != nil { + return newAuction, true, err + } + return newAuction, true, nil +} + +func (k Keeper) NewAuction(ctx context.Context, + startTime time.Time, + initialPrice math.LegacyDec, + item, targetGoal sdk.Coin, + vaultId uint64, +) (*types.Auction, error) { + auctionId, err := k.AuctionIdSeq.Next(ctx) + if err != nil { + return nil, err + } + params := k.GetParams(ctx) + + startingRate, err := math.LegacyNewDecFromStr(params.StartingRate) + if err != nil { + return nil, fmt.Errorf("invalid starting rate params: %v", err) + } + lowestRate, err := math.LegacyNewDecFromStr(params.LowestRate) + if err != nil { + return nil, fmt.Errorf("invalid lowest rate params: %v", err) + } + discountRate, err := math.LegacyNewDecFromStr(params.DiscountRate) + if err != nil { + return nil, fmt.Errorf("invalid discount rate params: %v", err) + } + endTime := startTime.Add(time.Duration(startingRate.Sub(lowestRate).Quo(discountRate).Ceil().RoundInt64() * int64(params.ReduceStep))) + + return &types.Auction{ + StartTime: startTime, + EndTime: endTime, + AuctionId: auctionId, + InitialPrice: initialPrice.String(), + Item: item, + CurrentRate: params.StartingRate, + LastDiscountTime: startTime, + Status: types.AuctionStatus_AUCTION_STATUS_ACTIVE, + TargetGoal: targetGoal, + TokenRaised: sdk.NewCoin(vaultstypes.DefaultMintDenom, math.ZeroInt()), + VaultId: vaultId, + }, nil +} diff --git a/x/auction/keeper/genesis.go b/x/auction/keeper/genesis.go new file mode 100644 index 00000000..c1c4ce82 --- /dev/null +++ b/x/auction/keeper/genesis.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +func (k Keeper) InitGennesis(ctx sdk.Context, genState types.GenesisState) { + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } + k.lastestAuctionPeriod.Set(ctx, ctx.BlockTime().Unix()) +} + +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + return genesis +} diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go new file mode 100644 index 00000000..dad13b22 --- /dev/null +++ b/x/auction/keeper/grpc_query.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +var _ types.QueryServer = Querier{} + +type Querier struct { + k Keeper +} + +func NewQueryServerImpl(k Keeper) types.QueryServer { + return Querier{k: k} +} + +func (k Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.k.GetParams(ctx)}, nil +} + +func (k Querier) QueryAllAuction(ctx context.Context, req *types.QueryAllAuctionRequest) (*types.QueryAllAuctionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + t, _ := k.k.Auctions.Has(ctx, 0) + fmt.Println() + fmt.Println(t) + + allAuction := []types.Auction{} + + k.k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { + fmt.Println("----1----") + allAuction = append(allAuction, value) + return false, nil + }) + + return &types.QueryAllAuctionResponse{ + Auctions: allAuction, + }, nil +} diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go new file mode 100644 index 00000000..0979c077 --- /dev/null +++ b/x/auction/keeper/grpc_query_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/onomyprotocol/reserve/testutil/keeper" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.OracleKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go new file mode 100644 index 00000000..c6206f23 --- /dev/null +++ b/x/auction/keeper/keeper.go @@ -0,0 +1,228 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/collections" + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // keepers + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + vaultKeeper types.VaultKeeper + OracleKeeper types.OracleKeeper + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + // timestamp of lastest auction period (Unix timestamp) + lastestAuctionPeriod collections.Item[int64] + + AuctionIdSeq collections.Sequence + + // bid id seq by auction id + BidIdSeq collections.Map[uint64, uint64] + + // Auctions maps auction id with auction struct + Auctions collections.Map[uint64, types.Auction] + + // Bids maps auction id with bids queue + Bids collections.Map[uint64, types.BidQueue] + + // BidByAddress maps bidder auction id + address to a bid entry + BidByAddress collections.Map[collections.Pair[uint64, sdk.AccAddress], types.Bids] + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + ak types.AccountKeeper, + bk types.BankKeeper, + vk types.VaultKeeper, + ok types.OracleKeeper, + logger log.Logger, + authority string, + +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + sb := collections.NewSchemaBuilder(storeService) + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + authKeeper: ak, + bankKeeper: bk, + vaultKeeper: vk, + OracleKeeper: ok, + lastestAuctionPeriod: collections.NewItem(sb, types.LastestAuctionPeriodPrefix, "lastest_auction_period", collections.Int64Value), + AuctionIdSeq: collections.NewSequence(sb, types.AuctionIdSeqPrefix, "auction_id_sequence"), + BidIdSeq: collections.NewMap(sb, types.BidIdSeqPrefix, "bid_id_sequence", collections.Uint64Key, collections.Uint64Value), + Auctions: collections.NewMap(sb, types.AuctionsPrefix, "auctions", collections.Uint64Key, codec.CollValue[types.Auction](cdc)), + Bids: collections.NewMap(sb, types.BidsPrefix, "bids", collections.Uint64Key, codec.CollValue[types.BidQueue](cdc)), + BidByAddress: collections.NewMap(sb, types.BidByAddressPrefix, "bids_by_address", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[types.Bids](cdc)), + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// clear all state of the given auction id +func (k Keeper) DeleteAuction(ctx context.Context, auctionId uint64) error { + err := k.Auctions.Remove(ctx, auctionId) + if err != nil { + return fmt.Errorf("failed to remove auction: %s", err) + } + + // clear the bid queue + err = k.Bids.Remove(ctx, auctionId) + if err != nil { + return fmt.Errorf("failed to remove bid queue: %s", err) + } + + // clear the bid seq tracking + err = k.BidIdSeq.Remove(ctx, auctionId) + if err != nil { + return fmt.Errorf("failed to remove bid queue: %s", err) + } + + // clear all bids for that auction id + rng := collections.NewPrefixedPairRange[uint64, sdk.AccAddress](auctionId) + return k.BidByAddress.Clear(ctx, rng) +} + +// AddBidEntry adds new bid entry for the given auction id +func (k Keeper) AddBidEntry(ctx context.Context, auctionId uint64, bidderAddr sdk.AccAddress, bid types.Bid) error { + has, err := k.Auctions.Has(ctx, auctionId) + if err != nil { + return err + } + if !has { + return fmt.Errorf("cannot bid for non-existing/expired auction with id: %v", auctionId) + } + + has = k.authKeeper.HasAccount(ctx, bidderAddr) + if !has { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address %s: account does not exist", bid.Bidder) + } + bidQueue, err := k.Bids.Get(ctx, auctionId) + if err != nil { + return err + } + + bid.Index = uint64(len(bidQueue.Bids)) + + bidQueue.Bids = append(bidQueue.Bids, &bid) + err = k.Bids.Set(ctx, auctionId, bidQueue) + if err != nil { + return err + } + + found, err := k.BidByAddress.Has(ctx, collections.Join(auctionId, bidderAddr)) + if found { + bids, err := k.BidByAddress.Get(ctx, collections.Join(auctionId, bidderAddr)) + if err != nil { + return err + } + bids.Bids = append(bids.Bids, &bid) + err = k.BidByAddress.Set(ctx, collections.Join(auctionId, bidderAddr), bids) + if err != nil { + return err + } + } else { + bids := types.Bids{ + Bids: []*types.Bid{&bid}, + } + err = k.BidByAddress.Set(ctx, collections.Join(auctionId, bidderAddr), bids) + if err != nil { + return err + } + } + if err != nil { + return err + } + return k.lockedToken(ctx, sdk.NewCoins(bid.Amount), bid.Bidder) +} + +// CancelBidEntry cancel existing bid entry for the given auction id +func (k Keeper) CancelBidEntry(ctx context.Context, auctionId, bidId uint64) error { + has, err := k.Auctions.Has(ctx, auctionId) + if err != nil { + return err + } + if !has { + return fmt.Errorf("cannot bid for non-existing/expired auction with id: %v", auctionId) + } + + bidQueue, err := k.Bids.Get(ctx, auctionId) + if err != nil { + return err + } + + var refundAddr string + var refundAmt sdk.Coin + for i, bid := range bidQueue.Bids { + if bid.BidId == bidId { + bid.IsHandle = true + bidQueue.Bids[i] = bid + refundAddr = bid.Bidder + refundAmt = bid.Amount + break + } + } + + err = k.Bids.Set(ctx, auctionId, bidQueue) + if err != nil { + return err + } + + if refundAddr == "" || refundAmt.IsNil() { + return fmt.Errorf("cannot find bid entry with id %v for auction %v", bidId, auctionId) + } + + return k.refundToken(ctx, sdk.NewCoins(refundAmt), refundAddr) +} + +func (k Keeper) lockedToken(ctx context.Context, amt sdk.Coins, bidderAdrr string) error { + bidderAcc, err := k.authKeeper.AddressCodec().StringToBytes(bidderAdrr) + if err != nil { + return err + } + + return k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidderAcc, types.ModuleName, amt) +} + +func (k Keeper) refundToken(ctx context.Context, amt sdk.Coins, bidderAdrr string) error { + bidderAcc, err := k.authKeeper.AddressCodec().StringToBytes(bidderAdrr) + if err != nil { + return err + } + + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidderAcc, amt) +} diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go new file mode 100644 index 00000000..deca5731 --- /dev/null +++ b/x/auction/keeper/keeper_test.go @@ -0,0 +1,85 @@ +package keeper_test + +import ( + "context" + "testing" + + "cosmossdk.io/math" + + "github.com/stretchr/testify/suite" + + "github.com/onomyprotocol/reserve/app/apptesting" + "github.com/onomyprotocol/reserve/x/auction/keeper" + "github.com/onomyprotocol/reserve/x/auction/types" +) + +type KeeperTestSuite struct { + apptesting.KeeperTestHelper + + k keeper.Keeper + msgServer types.MsgServer + mockOracleKeeper *MockOracleKeeper +} + +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + + mockOracleKeeper := MockOracleKeeper{ + prices: make(map[string]math.LegacyDec), + } + mockOracleKeeper.SetPrice(s.Ctx, "nomUSD", math.LegacyMustNewDecFromStr("1")) + + s.App.PSMKeeper.OracleKeeper = mockOracleKeeper + s.mockOracleKeeper = &mockOracleKeeper + + s.k = s.App.AuctionKeeper + s.msgServer = keeper.NewMsgServerImpl(s.k) + // s.queryServer = keeper.NewQueryServerImpl(s.k) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) TestParams() { + s.SetupTest() + + err := s.k.SetParams(s.Ctx, types.DefaultParams()) + s.Require().NoError(err) + + s.k.GetParams(s.Ctx) + s.Require().NoError(err) + // s.Require().Equal(p.LimitTotal, types.DefaultLimitTotal) + // s.Require().Equal(p.AcceptablePriceRatio, types.DefaultAcceptablePriceRatio) +} + +type MockOracleKeeper struct { + prices map[string]math.LegacyDec +} + +func (m MockOracleKeeper) SetPrice(ctx context.Context, denom string, price math.LegacyDec) { + m.prices[denom] = price +} + +func (s MockOracleKeeper) GetPrice(ctx context.Context, denom1 string, denom2 string) *math.LegacyDec { + price1, ok := s.prices[denom1] + + if !ok { + panic("not found price " + denom1) + } + price2, ok := s.prices[denom2] + if !ok { + panic("not found price " + denom2) + } + p := price1.Quo(price2) + return &p +} + +func (s MockOracleKeeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + _, ok := s.prices[symbol] + + if !ok { + s.SetPrice(ctx, symbol, math.LegacyMustNewDecFromStr("1")) + } + return nil +} diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go new file mode 100644 index 00000000..fa0f50da --- /dev/null +++ b/x/auction/keeper/msg_server.go @@ -0,0 +1,90 @@ +package keeper + +import ( + "context" + "fmt" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/auction/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + +func (k msgServer) Bid(ctx context.Context, msg *types.MsgBid) (*types.MsgBidResponse, error) { + bidderAddr, err := k.authKeeper.AddressCodec().StringToBytes(msg.Bidder) + if err != nil { + return &types.MsgBidResponse{ + Response: "Failed to submit bid", + }, err + } + bidIdSeq, err := k.BidIdSeq.Get(ctx, msg.AuctionId) + if err != nil { + return nil, err + } + + newBidId := bidIdSeq + 1 + err = k.BidIdSeq.Set(ctx, msg.AuctionId, newBidId) + if err != nil { + return nil, err + } + + bid := types.Bid{ + BidId: newBidId, + Bidder: msg.Bidder, + Amount: msg.Amount, + RecivePrice: msg.RecivePrice, + IsHandle: false, + } + err = k.AddBidEntry(ctx, msg.AuctionId, bidderAddr, bid) + if err != nil { + return nil, err + } + + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(sdk.NewEvent( + types.EventAddBid, + sdk.NewAttribute(types.AttributeKeyBidEntry, fmt.Sprintf("bidder %s has submit an entry with amount: %s", msg.Bidder, msg.Amount.String())), + )) + + return &types.MsgBidResponse{ + Response: "Bid Accepted", + BidId: newBidId, + }, nil +} + +func (k msgServer) CancelBid(ctx context.Context, msg *types.MsgCancelBid) (*types.MsgCancelBidResponse, error) { + + err := k.CancelBidEntry(ctx, msg.AuctionId, msg.BidId) + if err != nil { + return nil, err + } + + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(sdk.NewEvent( + types.EventUpdateBid, + sdk.NewAttribute(types.AttributeKeyBidEntry, fmt.Sprintf("cancel bid id %v for auction %v", msg.BidId, msg.AuctionId)), + )) + + return &types.MsgCancelBidResponse{}, nil +} diff --git a/x/auction/keeper/msg_server_test.go b/x/auction/keeper/msg_server_test.go new file mode 100644 index 00000000..31d44c1c --- /dev/null +++ b/x/auction/keeper/msg_server_test.go @@ -0,0 +1,79 @@ +package keeper_test + +import ( + "context" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/onomyprotocol/reserve/testutil/keeper" + "github.com/onomyprotocol/reserve/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.OracleKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go new file mode 100644 index 00000000..92db535c --- /dev/null +++ b/x/auction/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/auction/keeper/params_test.go b/x/auction/keeper/params_test.go new file mode 100644 index 00000000..f433b5e0 --- /dev/null +++ b/x/auction/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/onomyprotocol/reserve/testutil/keeper" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.OracleKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/auction/module/autocli.go b/x/auction/module/autocli.go new file mode 100644 index 00000000..37fb0502 --- /dev/null +++ b/x/auction/module/autocli.go @@ -0,0 +1,35 @@ +package auction + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + "github.com/onomyprotocol/reserve/x/auction/types" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: types.Query_serviceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: types.Msg_serviceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/auction/module/genesis.go b/x/auction/module/genesis.go new file mode 100644 index 00000000..22894ed5 --- /dev/null +++ b/x/auction/module/genesis.go @@ -0,0 +1,18 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/auction/keeper" + "github.com/onomyprotocol/reserve/x/auction/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.InitGennesis(ctx, genState) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return k.ExportGenesis(ctx) +} diff --git a/x/auction/module/genesis_test.go b/x/auction/module/genesis_test.go new file mode 100644 index 00000000..cd6a9e2e --- /dev/null +++ b/x/auction/module/genesis_test.go @@ -0,0 +1,29 @@ +package auction_test + +import ( + "testing" + + keepertest "github.com/onomyprotocol/reserve/testutil/keeper" + "github.com/onomyprotocol/reserve/testutil/nullify" + oracle "github.com/onomyprotocol/reserve/x/oracle/module" + "github.com/onomyprotocol/reserve/x/oracle/types" + + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.OracleKeeper(t) + oracle.InitGenesis(ctx, k, genesisState) + got := oracle.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/auction/module/module.go b/x/auction/module/module.go new file mode 100644 index 00000000..d7019c72 --- /dev/null +++ b/x/auction/module/module.go @@ -0,0 +1,221 @@ +package auction + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + modulev1 "github.com/onomyprotocol/reserve/api/reserve/auction/module" + "github.com/onomyprotocol/reserve/x/auction/client/cli" + "github.com/onomyprotocol/reserve/x/auction/keeper" + "github.com/onomyprotocol/reserve/x/auction/types" + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" + vaultskeeper "github.com/onomyprotocol/reserve/x/vaults/keeper" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the root Tx command for the module. +// These commands enrich the AutoCLI tx commands. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns no root query command for the oracle module. +func (a AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(ctx context.Context) error { + return am.keeper.BeginBlocker(ctx) +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + OracleKeeper oraclekeeper.Keeper + VaultKeeper vaultskeeper.Keeper +} + +type ModuleOutputs struct { + depinject.Out + + AuctionKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.AccountKeeper, + in.BankKeeper, + &in.VaultKeeper, + &in.OracleKeeper, + in.Logger, + authority.String(), + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{AuctionKeeper: k, Module: m} +} diff --git a/x/oracle/module/simulation.go b/x/auction/module/simulation.go similarity index 86% rename from x/oracle/module/simulation.go rename to x/auction/module/simulation.go index b5c5a658..1619d3a4 100644 --- a/x/oracle/module/simulation.go +++ b/x/auction/module/simulation.go @@ -1,4 +1,4 @@ -package oracle +package auction import ( "math/rand" @@ -9,13 +9,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/onomyprotocol/reserve/testutil/sample" - oraclesimulation "github.com/onomyprotocol/reserve/x/oracle/simulation" - "github.com/onomyprotocol/reserve/x/oracle/types" + "github.com/onomyprotocol/reserve/x/auction/types" ) // avoid unused import issue var ( - _ = oraclesimulation.FindAccount _ = rand.Rand{} _ = sample.AccAddress _ = sdk.AccAddress{} @@ -32,12 +30,11 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { for i, acc := range simState.Accounts { accs[i] = acc.Address.String() } - oracleGenesis := types.GenesisState{ + auctionGenesis := types.GenesisState{ Params: types.DefaultParams(), - PortId: types.PortID, // this line is used by starport scaffolding # simapp/module/genesisState } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&oracleGenesis) + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&auctionGenesis) } // RegisterStoreDecoder registers a decoder. diff --git a/x/oracle/simulation/helpers.go b/x/auction/simulation/helpers.go similarity index 100% rename from x/oracle/simulation/helpers.go rename to x/auction/simulation/helpers.go diff --git a/x/auction/types/auction.pb.go b/x/auction/types/auction.pb.go new file mode 100644 index 00000000..f89e978e --- /dev/null +++ b/x/auction/types/auction.pb.go @@ -0,0 +1,1729 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/v1/auction.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// AuctionStatus enumerates the valid auction status. +type AuctionStatus int32 + +const ( + // AUCTION_STATUS_UNSPECIFIED defines unknow auction status default is active. + AuctionStatus_AUCTION_STATUS_UNSPECIFIED AuctionStatus = 0 + // AUCTION_STATUS_ACTIVE defines auction active status. + AuctionStatus_AUCTION_STATUS_ACTIVE AuctionStatus = 1 + // AUCTION_STATUS_FINISHED defines auction finished reaching target goal. + AuctionStatus_AUCTION_STATUS_FINISHED AuctionStatus = 2 + // AUCTION_STATUS_EXPIRED defines auction reach end time without reaching target goal. + AuctionStatus_AUCTION_STATUS_EXPIRED AuctionStatus = 3 + // AUCTION_STATUS_OUT_OF_COLLATHERAL defines auction out of collatheral. + AuctionStatus_AUCTION_STATUS_OUT_OF_COLLATHERAL AuctionStatus = 4 +) + +var AuctionStatus_name = map[int32]string{ + 0: "AUCTION_STATUS_UNSPECIFIED", + 1: "AUCTION_STATUS_ACTIVE", + 2: "AUCTION_STATUS_FINISHED", + 3: "AUCTION_STATUS_EXPIRED", + 4: "AUCTION_STATUS_OUT_OF_COLLATHERAL", +} + +var AuctionStatus_value = map[string]int32{ + "AUCTION_STATUS_UNSPECIFIED": 0, + "AUCTION_STATUS_ACTIVE": 1, + "AUCTION_STATUS_FINISHED": 2, + "AUCTION_STATUS_EXPIRED": 3, + "AUCTION_STATUS_OUT_OF_COLLATHERAL": 4, +} + +func (x AuctionStatus) String() string { + return proto.EnumName(AuctionStatus_name, int32(x)) +} + +func (AuctionStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8758264ed04201a2, []int{0} +} + +// Auction struct +type Auction struct { + // start_time defines auction's start time + StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` + // end_time defines where the auction ended when there are no winning bid + EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` + // for simplicity, will use vault id that start the auction as auction id + AuctionId uint64 `protobuf:"varint,3,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // starting price (currently only support usd stable token) + InitialPrice string `protobuf:"bytes,4,opt,name=initial_price,json=initialPrice,proto3" json:"initial_price,omitempty"` + // items defines liquidate assets + Item types.Coin `protobuf:"bytes,5,opt,name=item,proto3" json:"item"` + // current_rate defines the rate compare with the initial price + CurrentRate string `protobuf:"bytes,6,opt,name=current_rate,json=currentRate,proto3" json:"current_rate,omitempty"` + // last_discount_time defines the last time a discount has been apply + LastDiscountTime time.Time `protobuf:"bytes,7,opt,name=last_discount_time,json=lastDiscountTime,proto3,stdtime" json:"last_discount_time"` + TokenRaised types.Coin `protobuf:"bytes,8,opt,name=token_raised,json=tokenRaised,proto3" json:"token_raised"` + // status defines auction current status + Status AuctionStatus `protobuf:"varint,9,opt,name=status,proto3,enum=reserve.auction.v1.AuctionStatus" json:"status,omitempty"` + // target_goal defines the debt the auction is trying to recover + TargetGoal types.Coin `protobuf:"bytes,10,opt,name=target_goal,json=targetGoal,proto3" json:"target_goal"` + // vault_id defines id of auction vault + VaultId uint64 `protobuf:"varint,11,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` +} + +func (m *Auction) Reset() { *m = Auction{} } +func (m *Auction) String() string { return proto.CompactTextString(m) } +func (*Auction) ProtoMessage() {} +func (*Auction) Descriptor() ([]byte, []int) { + return fileDescriptor_8758264ed04201a2, []int{0} +} +func (m *Auction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auction.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 *Auction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auction.Merge(m, src) +} +func (m *Auction) XXX_Size() int { + return m.Size() +} +func (m *Auction) XXX_DiscardUnknown() { + xxx_messageInfo_Auction.DiscardUnknown(m) +} + +var xxx_messageInfo_Auction proto.InternalMessageInfo + +func (m *Auction) GetStartTime() time.Time { + if m != nil { + return m.StartTime + } + return time.Time{} +} + +func (m *Auction) GetEndTime() time.Time { + if m != nil { + return m.EndTime + } + return time.Time{} +} + +func (m *Auction) GetAuctionId() uint64 { + if m != nil { + return m.AuctionId + } + return 0 +} + +func (m *Auction) GetInitialPrice() string { + if m != nil { + return m.InitialPrice + } + return "" +} + +func (m *Auction) GetItem() types.Coin { + if m != nil { + return m.Item + } + return types.Coin{} +} + +func (m *Auction) GetCurrentRate() string { + if m != nil { + return m.CurrentRate + } + return "" +} + +func (m *Auction) GetLastDiscountTime() time.Time { + if m != nil { + return m.LastDiscountTime + } + return time.Time{} +} + +func (m *Auction) GetTokenRaised() types.Coin { + if m != nil { + return m.TokenRaised + } + return types.Coin{} +} + +func (m *Auction) GetStatus() AuctionStatus { + if m != nil { + return m.Status + } + return AuctionStatus_AUCTION_STATUS_UNSPECIFIED +} + +func (m *Auction) GetTargetGoal() types.Coin { + if m != nil { + return m.TargetGoal + } + return types.Coin{} +} + +func (m *Auction) GetVaultId() uint64 { + if m != nil { + return m.VaultId + } + return 0 +} + +// Bid defines bid entry +type Bid struct { + // id of bid + BidId uint64 `protobuf:"varint,1,opt,name=bid_id,json=bidId,proto3" json:"bid_id,omitempty"` + // bidder address + Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` + // bidding amount + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + // recive_price defines the price that the bid is willing to pay + RecivePrice string `protobuf:"bytes,4,opt,name=recive_price,json=recivePrice,proto3" json:"recive_price,omitempty"` + // maxReceive maximum receive-able amount + MaxReceive types.Coin `protobuf:"bytes,5,opt,name=max_receive,json=maxReceive,proto3" json:"max_receive"` + IsHandle bool `protobuf:"varint,6,opt,name=is_handle,json=isHandle,proto3" json:"is_handle,omitempty"` + // index in auction bid_queue + Index uint64 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *Bid) Reset() { *m = Bid{} } +func (m *Bid) String() string { return proto.CompactTextString(m) } +func (*Bid) ProtoMessage() {} +func (*Bid) Descriptor() ([]byte, []int) { + return fileDescriptor_8758264ed04201a2, []int{1} +} +func (m *Bid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bid.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 *Bid) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bid.Merge(m, src) +} +func (m *Bid) XXX_Size() int { + return m.Size() +} +func (m *Bid) XXX_DiscardUnknown() { + xxx_messageInfo_Bid.DiscardUnknown(m) +} + +var xxx_messageInfo_Bid proto.InternalMessageInfo + +func (m *Bid) GetBidId() uint64 { + if m != nil { + return m.BidId + } + return 0 +} + +func (m *Bid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *Bid) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *Bid) GetRecivePrice() string { + if m != nil { + return m.RecivePrice + } + return "" +} + +func (m *Bid) GetMaxReceive() types.Coin { + if m != nil { + return m.MaxReceive + } + return types.Coin{} +} + +func (m *Bid) GetIsHandle() bool { + if m != nil { + return m.IsHandle + } + return false +} + +func (m *Bid) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +// BidQueue defines a list of bid entries for a single auction sorted by insertion time +type BidQueue struct { + // bidder address + AuctionId uint64 `protobuf:"varint,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // array of bid entries with bidder address + Bids []*Bid `protobuf:"bytes,2,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (m *BidQueue) Reset() { *m = BidQueue{} } +func (m *BidQueue) String() string { return proto.CompactTextString(m) } +func (*BidQueue) ProtoMessage() {} +func (*BidQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_8758264ed04201a2, []int{2} +} +func (m *BidQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidQueue.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 *BidQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidQueue.Merge(m, src) +} +func (m *BidQueue) XXX_Size() int { + return m.Size() +} +func (m *BidQueue) XXX_DiscardUnknown() { + xxx_messageInfo_BidQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_BidQueue proto.InternalMessageInfo + +func (m *BidQueue) GetAuctionId() uint64 { + if m != nil { + return m.AuctionId + } + return 0 +} + +func (m *BidQueue) GetBids() []*Bid { + if m != nil { + return m.Bids + } + return nil +} + +// Bids defines a list of bid entries +type Bids struct { + // array of bid entries with bidder address + Bids []*Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (m *Bids) Reset() { *m = Bids{} } +func (m *Bids) String() string { return proto.CompactTextString(m) } +func (*Bids) ProtoMessage() {} +func (*Bids) Descriptor() ([]byte, []int) { + return fileDescriptor_8758264ed04201a2, []int{3} +} +func (m *Bids) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bids) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bids.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 *Bids) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bids.Merge(m, src) +} +func (m *Bids) XXX_Size() int { + return m.Size() +} +func (m *Bids) XXX_DiscardUnknown() { + xxx_messageInfo_Bids.DiscardUnknown(m) +} + +var xxx_messageInfo_Bids proto.InternalMessageInfo + +func (m *Bids) GetBids() []*Bid { + if m != nil { + return m.Bids + } + return nil +} + +func init() { + proto.RegisterEnum("reserve.auction.v1.AuctionStatus", AuctionStatus_name, AuctionStatus_value) + proto.RegisterType((*Auction)(nil), "reserve.auction.v1.Auction") + proto.RegisterType((*Bid)(nil), "reserve.auction.v1.Bid") + proto.RegisterType((*BidQueue)(nil), "reserve.auction.v1.BidQueue") + proto.RegisterType((*Bids)(nil), "reserve.auction.v1.Bids") +} + +func init() { proto.RegisterFile("reserve/auction/v1/auction.proto", fileDescriptor_8758264ed04201a2) } + +var fileDescriptor_8758264ed04201a2 = []byte{ + // 799 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xc1, 0x6e, 0xdb, 0x46, + 0x10, 0x15, 0x6d, 0x59, 0x96, 0x46, 0x76, 0xa0, 0x2e, 0x9c, 0x86, 0x56, 0x50, 0x59, 0x31, 0x50, + 0x40, 0x48, 0x11, 0x32, 0xb2, 0x2f, 0x2d, 0xd0, 0x8b, 0x28, 0xd1, 0x31, 0x0b, 0xc3, 0x76, 0x29, + 0x39, 0x2d, 0x7a, 0x21, 0x96, 0xdc, 0x2d, 0xb3, 0x28, 0xc9, 0x35, 0xb8, 0x4b, 0x41, 0xf9, 0x8b, + 0x5c, 0xfb, 0x07, 0x45, 0x4f, 0x3d, 0xe4, 0xd2, 0x3f, 0xc8, 0x31, 0xc8, 0xa9, 0xa7, 0xb6, 0xb0, + 0x0f, 0xfd, 0x8d, 0x82, 0xcb, 0x55, 0x80, 0xaa, 0x41, 0x60, 0x5d, 0x84, 0x9d, 0x99, 0xf7, 0x66, + 0x46, 0x6f, 0xdf, 0x4a, 0xd0, 0xcf, 0xa9, 0xa0, 0xf9, 0x9c, 0xda, 0xb8, 0x88, 0x24, 0xe3, 0x99, + 0x3d, 0x1f, 0x2e, 0x8f, 0xd6, 0x75, 0xce, 0x25, 0x47, 0x48, 0x23, 0xac, 0x65, 0x7a, 0x3e, 0xec, + 0x7e, 0x82, 0x53, 0x96, 0x71, 0x5b, 0x7d, 0x56, 0xb0, 0xee, 0x5e, 0xcc, 0x63, 0xae, 0x8e, 0x76, + 0x79, 0xd2, 0xd9, 0xfd, 0x88, 0x8b, 0x94, 0x8b, 0xa0, 0x2a, 0x54, 0x81, 0x2e, 0x1d, 0xc4, 0x9c, + 0xc7, 0x09, 0xb5, 0x55, 0x14, 0x16, 0x3f, 0xda, 0x92, 0xa5, 0x54, 0x48, 0x9c, 0x5e, 0x6b, 0x40, + 0xaf, 0x82, 0xdb, 0x21, 0x16, 0xd4, 0x9e, 0x0f, 0x43, 0x2a, 0xf1, 0xd0, 0x8e, 0x38, 0xd3, 0x8b, + 0x1d, 0xfe, 0xbc, 0x05, 0xdb, 0xa3, 0x6a, 0x27, 0x74, 0x0a, 0x20, 0x24, 0xce, 0x65, 0x50, 0x36, + 0x31, 0x8d, 0xbe, 0x31, 0x68, 0x1f, 0x75, 0xad, 0x6a, 0x82, 0xb5, 0x9c, 0x60, 0xcd, 0x96, 0x13, + 0x9c, 0xdd, 0x37, 0x7f, 0x1e, 0xd4, 0x5e, 0xfd, 0x75, 0x60, 0xfc, 0xf2, 0xcf, 0x6f, 0x8f, 0x0d, + 0xbf, 0xa5, 0xc8, 0x65, 0x19, 0x4d, 0xa0, 0x49, 0x33, 0x52, 0xf5, 0xd9, 0x58, 0xb7, 0xcf, 0x36, + 0xcd, 0x88, 0xea, 0xf2, 0x19, 0x80, 0x96, 0x2b, 0x60, 0xc4, 0xdc, 0xec, 0x1b, 0x83, 0xba, 0xdf, + 0xd2, 0x19, 0x8f, 0xa0, 0x63, 0xd8, 0x65, 0x19, 0x93, 0x0c, 0x27, 0xc1, 0x75, 0xce, 0x22, 0x6a, + 0xd6, 0xfb, 0xc6, 0xa0, 0xe5, 0xdc, 0x7b, 0xf7, 0xfa, 0x09, 0x68, 0x91, 0x26, 0x34, 0xf2, 0x77, + 0x34, 0xe8, 0xb2, 0xc4, 0xa0, 0x2f, 0xa1, 0xce, 0x24, 0x4d, 0xcd, 0x2d, 0xb5, 0xd5, 0xbe, 0xa5, + 0x81, 0xa5, 0x3c, 0x96, 0x96, 0xc7, 0x1a, 0x73, 0x96, 0x39, 0xad, 0x72, 0xa9, 0x6a, 0x21, 0xc5, + 0x40, 0x43, 0xd8, 0x89, 0x8a, 0x3c, 0xa7, 0x99, 0x0c, 0x72, 0x2c, 0xa9, 0xd9, 0xf8, 0xe0, 0xb4, + 0xb6, 0xc6, 0xf8, 0x58, 0x52, 0xf4, 0x1d, 0xa0, 0x04, 0x0b, 0x19, 0x10, 0x26, 0x22, 0x5e, 0x64, + 0x5a, 0xd8, 0xed, 0x75, 0x05, 0xe9, 0x94, 0x4d, 0x26, 0xba, 0x87, 0x52, 0xe6, 0x19, 0xec, 0x48, + 0xfe, 0x13, 0xcd, 0x82, 0x1c, 0x33, 0x41, 0x89, 0xd9, 0x5c, 0xe3, 0xdb, 0xb4, 0x15, 0xd3, 0x57, + 0x44, 0xf4, 0x15, 0x34, 0x84, 0xc4, 0xb2, 0x10, 0x66, 0xab, 0x6f, 0x0c, 0xee, 0x1d, 0x3d, 0xb2, + 0xfe, 0x6f, 0x54, 0x4b, 0xfb, 0x63, 0xaa, 0x80, 0xbe, 0x26, 0x20, 0x17, 0xda, 0x12, 0xe7, 0x31, + 0x95, 0x41, 0xcc, 0x71, 0x62, 0xc2, 0x1a, 0x2b, 0x40, 0x45, 0x7c, 0xc6, 0x71, 0x82, 0xf6, 0xa1, + 0x39, 0xc7, 0x45, 0x22, 0xcb, 0x2b, 0x6e, 0xab, 0x2b, 0xde, 0x56, 0xb1, 0x47, 0x0e, 0x7f, 0xdf, + 0x80, 0x4d, 0x87, 0x11, 0x74, 0x1f, 0x1a, 0x21, 0x23, 0x25, 0xc0, 0x50, 0x80, 0xad, 0x90, 0x11, + 0x8f, 0xa0, 0xa7, 0x2a, 0x4d, 0x68, 0xae, 0x2c, 0xd6, 0x72, 0xcc, 0x77, 0xaf, 0x9f, 0xec, 0xe9, + 0xf1, 0x23, 0x42, 0x72, 0x2a, 0xc4, 0x54, 0xe6, 0x2c, 0x8b, 0x7d, 0x8d, 0x43, 0x5f, 0x43, 0x03, + 0xa7, 0xa5, 0x88, 0xca, 0x4c, 0x77, 0xdd, 0x56, 0x73, 0x4a, 0x03, 0xe4, 0x34, 0x62, 0x73, 0xfa, + 0x51, 0xbb, 0xb5, 0x2b, 0x4c, 0xe5, 0x36, 0x17, 0xda, 0x29, 0x5e, 0x04, 0x39, 0x8d, 0x28, 0x9b, + 0xd3, 0xb5, 0x4c, 0x07, 0x29, 0x5e, 0xf8, 0x15, 0x0f, 0x3d, 0x84, 0x16, 0x13, 0xc1, 0x0b, 0x9c, + 0x91, 0xa4, 0xf2, 0x5d, 0xd3, 0x6f, 0x32, 0x71, 0xaa, 0x62, 0xb4, 0x07, 0x5b, 0x2c, 0x23, 0x74, + 0xa1, 0x7c, 0x55, 0xf7, 0xab, 0xe0, 0xf0, 0x39, 0x34, 0x1d, 0x46, 0xbe, 0x2d, 0x68, 0xb1, 0xfa, + 0x8e, 0x8c, 0xd5, 0x77, 0xf4, 0x05, 0xd4, 0x43, 0x46, 0x84, 0xb9, 0xd1, 0xdf, 0x1c, 0xb4, 0x8f, + 0x1e, 0x7c, 0xc8, 0x01, 0x0e, 0x23, 0xbe, 0x02, 0x1d, 0x1e, 0x43, 0xdd, 0x61, 0x44, 0xbc, 0x27, + 0x19, 0x77, 0x20, 0x3d, 0xfe, 0xd5, 0x80, 0xdd, 0xff, 0x98, 0x08, 0xf5, 0xa0, 0x3b, 0xba, 0x1a, + 0xcf, 0xbc, 0x8b, 0xf3, 0x60, 0x3a, 0x1b, 0xcd, 0xae, 0xa6, 0xc1, 0xd5, 0xf9, 0xf4, 0xd2, 0x1d, + 0x7b, 0x27, 0x9e, 0x3b, 0xe9, 0xd4, 0xd0, 0x3e, 0xdc, 0x5f, 0xa9, 0x8f, 0xc6, 0x33, 0xef, 0xb9, + 0xdb, 0x31, 0xd0, 0x43, 0x78, 0xb0, 0x52, 0x3a, 0xf1, 0xce, 0xbd, 0xe9, 0xa9, 0x3b, 0xe9, 0x6c, + 0xa0, 0x2e, 0x7c, 0xba, 0x52, 0x74, 0xbf, 0xbf, 0xf4, 0x7c, 0x77, 0xd2, 0xd9, 0x44, 0x9f, 0xc3, + 0xa3, 0x95, 0xda, 0xc5, 0xd5, 0x2c, 0xb8, 0x38, 0x09, 0xc6, 0x17, 0x67, 0x67, 0xa3, 0xd9, 0xa9, + 0xeb, 0x8f, 0xce, 0x3a, 0x75, 0xe7, 0x9b, 0x37, 0x37, 0x3d, 0xe3, 0xed, 0x4d, 0xcf, 0xf8, 0xfb, + 0xa6, 0x67, 0xbc, 0xba, 0xed, 0xd5, 0xde, 0xde, 0xf6, 0x6a, 0x7f, 0xdc, 0xf6, 0x6a, 0x3f, 0x3c, + 0x8d, 0x99, 0x7c, 0x51, 0x84, 0x56, 0xc4, 0x53, 0x9b, 0x67, 0x3c, 0x7d, 0xa9, 0x9e, 0x6e, 0xc4, + 0x13, 0x7b, 0xf9, 0xfb, 0xbf, 0x78, 0xff, 0x0f, 0x20, 0x5f, 0x5e, 0x53, 0x11, 0x36, 0x14, 0xe2, + 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x7e, 0xd9, 0xcf, 0x21, 0x06, 0x00, 0x00, +} + +func (m *Auction) 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 *Auction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VaultId != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x58 + } + { + size, err := m.TargetGoal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + if m.Status != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x48 + } + { + size, err := m.TokenRaised.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastDiscountTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastDiscountTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintAuction(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x3a + if len(m.CurrentRate) > 0 { + i -= len(m.CurrentRate) + copy(dAtA[i:], m.CurrentRate) + i = encodeVarintAuction(dAtA, i, uint64(len(m.CurrentRate))) + i-- + dAtA[i] = 0x32 + } + { + size, err := m.Item.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.InitialPrice) > 0 { + i -= len(m.InitialPrice) + copy(dAtA[i:], m.InitialPrice) + i = encodeVarintAuction(dAtA, i, uint64(len(m.InitialPrice))) + i-- + dAtA[i] = 0x22 + } + if m.AuctionId != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.AuctionId)) + i-- + dAtA[i] = 0x18 + } + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintAuction(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x12 + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintAuction(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Bid) 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 *Bid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x38 + } + if m.IsHandle { + i-- + if m.IsHandle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + { + size, err := m.MaxReceive.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.RecivePrice) > 0 { + i -= len(m.RecivePrice) + copy(dAtA[i:], m.RecivePrice) + i = encodeVarintAuction(dAtA, i, uint64(len(m.RecivePrice))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0x12 + } + if m.BidId != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.BidId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BidQueue) 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 *BidQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bids) > 0 { + for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.AuctionId != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.AuctionId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Bids) 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 *Bids) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bids) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bids) > 0 { + for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintAuction(dAtA []byte, offset int, v uint64) int { + offset -= sovAuction(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Auction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovAuction(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovAuction(uint64(l)) + if m.AuctionId != 0 { + n += 1 + sovAuction(uint64(m.AuctionId)) + } + l = len(m.InitialPrice) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = m.Item.Size() + n += 1 + l + sovAuction(uint64(l)) + l = len(m.CurrentRate) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastDiscountTime) + n += 1 + l + sovAuction(uint64(l)) + l = m.TokenRaised.Size() + n += 1 + l + sovAuction(uint64(l)) + if m.Status != 0 { + n += 1 + sovAuction(uint64(m.Status)) + } + l = m.TargetGoal.Size() + n += 1 + l + sovAuction(uint64(l)) + if m.VaultId != 0 { + n += 1 + sovAuction(uint64(m.VaultId)) + } + return n +} + +func (m *Bid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BidId != 0 { + n += 1 + sovAuction(uint64(m.BidId)) + } + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovAuction(uint64(l)) + l = len(m.RecivePrice) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = m.MaxReceive.Size() + n += 1 + l + sovAuction(uint64(l)) + if m.IsHandle { + n += 2 + } + if m.Index != 0 { + n += 1 + sovAuction(uint64(m.Index)) + } + return n +} + +func (m *BidQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AuctionId != 0 { + n += 1 + sovAuction(uint64(m.AuctionId)) + } + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovAuction(uint64(l)) + } + } + return n +} + +func (m *Bids) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovAuction(uint64(l)) + } + } + return n +} + +func sovAuction(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAuction(x uint64) (n int) { + return sovAuction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Auction) 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 ErrIntOverflowAuction + } + 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: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + m.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + 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 ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialPrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Item", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Item.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + 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 ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastDiscountTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastDiscountTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenRaised", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenRaised.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= AuctionStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetGoal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TargetGoal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bid) 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 ErrIntOverflowAuction + } + 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: Bid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BidId", wireType) + } + m.BidId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BidId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + 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 ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecivePrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + 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 ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RecivePrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxReceive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxReceive.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsHandle", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsHandle = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BidQueue) 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 ErrIntOverflowAuction + } + 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: BidQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + m.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bids = append(m.Bids, &Bid{}) + if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bids) 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 ErrIntOverflowAuction + } + 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: Bids: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bids: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bids = append(m.Bids, &Bid{}) + if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAuction(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, ErrIntOverflowAuction + } + 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, ErrIntOverflowAuction + } + 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, ErrIntOverflowAuction + } + 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, ErrInvalidLengthAuction + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAuction + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAuction + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAuction = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAuction = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAuction = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go new file mode 100644 index 00000000..6b0ae493 --- /dev/null +++ b/x/auction/types/codec.go @@ -0,0 +1,27 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgBid{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCancelBid{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/auction/types/errors.go b/x/auction/types/errors.go new file mode 100644 index 00000000..60d7929e --- /dev/null +++ b/x/auction/types/errors.go @@ -0,0 +1,15 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/auction module sentinel errors +var ( + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrInvalidPacketTimeout = sdkerrors.Register(ModuleName, 1500, "invalid packet timeout") + ErrInvalidVersion = sdkerrors.Register(ModuleName, 1501, "invalid version") +) diff --git a/x/auction/types/events.go b/x/auction/types/events.go new file mode 100644 index 00000000..4f1cd9a7 --- /dev/null +++ b/x/auction/types/events.go @@ -0,0 +1,8 @@ +package types + +const ( + EventAddBid = "submit_bid" + EventUpdateBid = "update_bid" + + AttributeKeyBidEntry = "bid_entry" +) diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go new file mode 100644 index 00000000..994ceebe --- /dev/null +++ b/x/auction/types/expected_keepers.go @@ -0,0 +1,53 @@ +package types + +import ( + "context" + + "cosmossdk.io/math" + + addresscodec "cosmossdk.io/core/address" + sdk "github.com/cosmos/cosmos-sdk/types" + vaulttypes "github.com/onomyprotocol/reserve/x/vaults/types" +) + +type LiquidateVaults struct { + VaultId uint64 + TargetGoal sdk.Coin + Collatheral sdk.Coin + InitialPrice sdk.Coin +} + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + AddressCodec() addresscodec.Codec + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI + HasAccount(ctx context.Context, addr sdk.AccAddress) bool +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} + +type VaultKeeper interface { + GetLiquidations(ctx context.Context) ([]*vaulttypes.Liquidation, error) + Liquidate(ctx context.Context, liquidation vaulttypes.Liquidation) error + GetVault(ctx context.Context, vaultId uint64) (vaulttypes.Vault, error) +} + +type OracleKeeper interface { + GetPrice(ctx context.Context, base, quote string) *math.LegacyDec +} diff --git a/x/auction/types/genesis.go b/x/auction/types/genesis.go new file mode 100644 index 00000000..d420337a --- /dev/null +++ b/x/auction/types/genesis.go @@ -0,0 +1,22 @@ +package types + +// this line is used by starport scaffolding # genesis/types/import + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + Auctions: []*Auction{}, + BidEntries: []*Bid{}, + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go new file mode 100644 index 00000000..4e1670aa --- /dev/null +++ b/x/auction/types/genesis.pb.go @@ -0,0 +1,454 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// GenesisState defines the auction module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // list of auctions + Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty"` + // list of all bid entries + BidEntries []*Bid `protobuf:"bytes,3,rep,name=bid_entries,json=bidEntries,proto3" json:"bid_entries,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_3e716c21f756a4f6, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetAuctions() []*Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func (m *GenesisState) GetBidEntries() []*Bid { + if m != nil { + return m.BidEntries + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "reserve.auction.v1.GenesisState") +} + +func init() { proto.RegisterFile("reserve/auction/v1/genesis.proto", fileDescriptor_3e716c21f756a4f6) } + +var fileDescriptor_3e716c21f756a4f6 = []byte{ + // 283 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, + 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, + 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, + 0x10, 0x65, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x15, 0x95, 0xc7, + 0x62, 0x7c, 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x74, 0x29, 0x6c, 0xf6, 0xc3, 0x2c, 0x02, 0xab, + 0x50, 0x3a, 0xc0, 0xc8, 0xc5, 0xe3, 0x0e, 0x71, 0x51, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x2d, + 0x17, 0x1b, 0xc4, 0x08, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x29, 0x3d, 0x4c, 0x17, 0xea, + 0x05, 0x80, 0x55, 0x38, 0x71, 0x9e, 0xb8, 0x27, 0xcf, 0xb0, 0xe2, 0xf9, 0x06, 0x2d, 0xc6, 0x20, + 0xa8, 0x26, 0x21, 0x73, 0x2e, 0x0e, 0xa8, 0xba, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, + 0x69, 0x6c, 0x06, 0x38, 0x42, 0x98, 0x41, 0x70, 0xc5, 0x42, 0x16, 0x5c, 0xdc, 0x49, 0x99, 0x29, + 0xf1, 0xa9, 0x79, 0x25, 0x45, 0x99, 0xa9, 0xc5, 0x12, 0xcc, 0x60, 0xbd, 0xe2, 0xd8, 0xf4, 0x3a, + 0x65, 0xa6, 0x04, 0x71, 0x25, 0x65, 0xa6, 0xb8, 0x42, 0x94, 0x3a, 0x79, 0x9d, 0x78, 0x24, 0xc7, + 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, + 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, + 0x7e, 0xae, 0x7e, 0x7e, 0x5e, 0x7e, 0x6e, 0x25, 0xd8, 0xcf, 0xc9, 0xf9, 0x39, 0xfa, 0xb0, 0x70, + 0xa9, 0x80, 0x87, 0x4c, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x58, 0x85, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0x11, 0x7f, 0x93, 0xbb, 0xb9, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BidEntries) > 0 { + for iNdEx := len(m.BidEntries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BidEntries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BidEntries) > 0 { + for _, e := range m.BidEntries { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, &Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidEntries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidEntries = append(m.BidEntries, &Bid{}) + if err := m.BidEntries[len(m.BidEntries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/genesis_test.go b/x/auction/types/genesis_test.go new file mode 100644 index 00000000..766c333e --- /dev/null +++ b/x/auction/types/genesis_test.go @@ -0,0 +1,32 @@ +package types_test + +import ( + "testing" + + "github.com/onomyprotocol/reserve/x/auction/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/auction/types/keys.go b/x/auction/types/keys.go new file mode 100644 index 00000000..6ed33ff8 --- /dev/null +++ b/x/auction/types/keys.go @@ -0,0 +1,31 @@ +package types + +import "cosmossdk.io/collections" + +const ( + // ModuleName defines the module name + ModuleName = "auction" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_auction" +) + +var ( + ParamsKey = []byte("p_auction") +) + +var ( + AuctionIdSeqPrefix = collections.NewPrefix(1) + BidIdSeqPrefix = collections.NewPrefix(2) + AuctionsPrefix = collections.NewPrefix(3) + BidsPrefix = collections.NewPrefix(4) + BidByAddressPrefix = collections.NewPrefix(5) + LastestAuctionPeriodPrefix = collections.NewPrefix(6) +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/oracle/types/msg_update_params.go b/x/auction/types/msg_update_params.go similarity index 100% rename from x/oracle/types/msg_update_params.go rename to x/auction/types/msg_update_params.go diff --git a/x/auction/types/msgs.go b/x/auction/types/msgs.go new file mode 100644 index 00000000..44f33a65 --- /dev/null +++ b/x/auction/types/msgs.go @@ -0,0 +1,25 @@ +package types + +import sdk "github.com/cosmos/cosmos-sdk/types" + +var ( + Query_serviceDesc = _Query_serviceDesc + Msg_serviceDesc = _Msg_serviceDesc +) + +func NewMsgBid(addr string, auctionID uint64, amount sdk.Coin, RecivePrice string) MsgBid { + return MsgBid{ + Bidder: addr, + AuctionId: auctionID, + RecivePrice: RecivePrice, + Amount: amount, + } +} + +func NewMsgCancelBid(bider string, bidID, auctionID uint64) MsgCancelBid { + return MsgCancelBid{ + Bidder: bider, + BidId: bidID, + AuctionId: auctionID, + } +} diff --git a/x/auction/types/params.go b/x/auction/types/params.go new file mode 100644 index 00000000..a2623e69 --- /dev/null +++ b/x/auction/types/params.go @@ -0,0 +1,40 @@ +package types + +import ( + "time" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return Params{ + AuctionPeriods: time.Second * 30, + ReduceStep: time.Second * 30, + StartingRate: "1.5", + LowestRate: "0.9", + DiscountRate: "0.1", + } +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/auction/types/params.pb.go b/x/auction/types/params.pb.go new file mode 100644 index 00000000..7e95927f --- /dev/null +++ b/x/auction/types/params.pb.go @@ -0,0 +1,584 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// Params defines the parameters for the module. +type Params struct { + // defines how long (either in blocktime or blockheight) + // between each auction + AuctionPeriods time.Duration `protobuf:"bytes,1,opt,name=auction_periods,json=auctionPeriods,proto3,stdduration" json:"auction_periods"` + // duration between each price reduction + ReduceStep time.Duration `protobuf:"bytes,2,opt,name=reduce_step,json=reduceStep,proto3,stdduration" json:"reduce_step"` + // rate compared with the collaterals price from the + // oracle at which the auction will start with + StartingRate string `protobuf:"bytes,3,opt,name=starting_rate,json=startingRate,proto3" json:"starting_rate,omitempty"` + // rate compared with the initial price that the price + // can drop to + LowestRate string `protobuf:"bytes,4,opt,name=lowest_rate,json=lowestRate,proto3" json:"lowest_rate,omitempty"` + // rate that are decrease every reduce_step + DiscountRate string `protobuf:"bytes,5,opt,name=discount_rate,json=discountRate,proto3" json:"discount_rate,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_7e77e58d36f40199, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetAuctionPeriods() time.Duration { + if m != nil { + return m.AuctionPeriods + } + return 0 +} + +func (m *Params) GetReduceStep() time.Duration { + if m != nil { + return m.ReduceStep + } + return 0 +} + +func (m *Params) GetStartingRate() string { + if m != nil { + return m.StartingRate + } + return "" +} + +func (m *Params) GetLowestRate() string { + if m != nil { + return m.LowestRate + } + return "" +} + +func (m *Params) GetDiscountRate() string { + if m != nil { + return m.DiscountRate + } + return "" +} + +func init() { + proto.RegisterType((*Params)(nil), "reserve.auction.v1.Params") +} + +func init() { proto.RegisterFile("reserve/auction/v1/params.proto", fileDescriptor_7e77e58d36f40199) } + +var fileDescriptor_7e77e58d36f40199 = []byte{ + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xbf, 0x6f, 0xda, 0x40, + 0x14, 0xc7, 0x7d, 0xb4, 0x45, 0xea, 0x51, 0xa8, 0x6a, 0x75, 0x30, 0x0c, 0x36, 0xed, 0x84, 0x90, + 0xea, 0x2b, 0x65, 0xeb, 0x88, 0x58, 0xda, 0x89, 0x90, 0x2d, 0x8b, 0x75, 0xd8, 0x17, 0xc7, 0x12, + 0xf6, 0xb3, 0xee, 0xce, 0x24, 0xfc, 0x0b, 0x99, 0x32, 0x66, 0xcc, 0x98, 0x91, 0x21, 0x7f, 0x04, + 0x23, 0xca, 0x94, 0x29, 0x89, 0x20, 0x12, 0xf9, 0x33, 0x22, 0xee, 0xce, 0x59, 0xc2, 0x92, 0xc5, + 0x7a, 0x3f, 0xbe, 0x9f, 0xef, 0xf3, 0xbd, 0x87, 0x3d, 0xce, 0x04, 0xe3, 0x33, 0x46, 0x68, 0x11, + 0xca, 0x04, 0x32, 0x32, 0xeb, 0x91, 0x9c, 0x72, 0x9a, 0x0a, 0x3f, 0xe7, 0x20, 0xc1, 0xb6, 0x8d, + 0xc0, 0x37, 0x02, 0x7f, 0xd6, 0x6b, 0x7d, 0xa3, 0x69, 0x92, 0x01, 0x51, 0x5f, 0x2d, 0x6b, 0x7d, + 0x8f, 0x21, 0x06, 0x15, 0x92, 0x5d, 0x64, 0xaa, 0xcd, 0x10, 0x44, 0x0a, 0x22, 0xd0, 0x0d, 0x9d, + 0x98, 0x96, 0x1b, 0x03, 0xc4, 0x53, 0x46, 0x54, 0x36, 0x29, 0x8e, 0x49, 0x54, 0x70, 0xaa, 0x06, + 0xa8, 0xca, 0xcf, 0xa7, 0x0a, 0xae, 0x8e, 0xd4, 0x8f, 0xd8, 0x07, 0xf8, 0xab, 0x19, 0x1e, 0xe4, + 0x8c, 0x27, 0x10, 0x09, 0x07, 0xb5, 0x51, 0xa7, 0xf6, 0xa7, 0xe9, 0x6b, 0x13, 0xbf, 0x34, 0xf1, + 0x87, 0xc6, 0x64, 0x50, 0x5f, 0xde, 0x7b, 0xd6, 0xe5, 0x83, 0x87, 0xae, 0xb7, 0x8b, 0x2e, 0x1a, + 0x37, 0x8c, 0xc1, 0x48, 0xf3, 0xf6, 0x3f, 0x5c, 0xe3, 0x2c, 0x2a, 0x42, 0x16, 0x08, 0xc9, 0x72, + 0xa7, 0xf2, 0x4e, 0x3b, 0xac, 0xe1, 0x43, 0xc9, 0x72, 0xbb, 0x8f, 0xeb, 0x42, 0x52, 0x2e, 0x93, + 0x2c, 0x0e, 0x38, 0x95, 0xcc, 0xf9, 0xd0, 0x46, 0x9d, 0xcf, 0x83, 0xc6, 0xed, 0xcd, 0x2f, 0x6c, + 0x5e, 0x3c, 0x64, 0xe1, 0xf8, 0x4b, 0x29, 0x1a, 0x53, 0xc9, 0x6c, 0x82, 0x6b, 0x53, 0x38, 0x65, + 0x42, 0x6a, 0xe4, 0xe3, 0x5e, 0x04, 0x6b, 0x89, 0x02, 0xfa, 0xb8, 0x1e, 0x25, 0x22, 0x84, 0x22, + 0x33, 0xc8, 0xa7, 0xfd, 0x53, 0x4a, 0xd1, 0x0e, 0xfa, 0xfb, 0xe3, 0xf9, 0xca, 0x43, 0xe7, 0xdb, + 0x45, 0xd7, 0x29, 0xaf, 0x7c, 0xf6, 0x7a, 0x67, 0xbd, 0xdb, 0xc1, 0xff, 0xe5, 0xda, 0x45, 0xab, + 0xb5, 0x8b, 0x1e, 0xd7, 0x2e, 0xba, 0xd8, 0xb8, 0xd6, 0x6a, 0xe3, 0x5a, 0x77, 0x1b, 0xd7, 0x3a, + 0xfa, 0x1d, 0x27, 0xf2, 0xa4, 0x98, 0xf8, 0x21, 0xa4, 0x04, 0x32, 0x48, 0xe7, 0x6a, 0x2b, 0x21, + 0x4c, 0xc9, 0x5b, 0x33, 0x39, 0xcf, 0x99, 0x98, 0x54, 0x95, 0xa2, 0xff, 0x12, 0x00, 0x00, 0xff, + 0xff, 0x28, 0x94, 0xe8, 0xfc, 0x54, 0x02, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.AuctionPeriods != that1.AuctionPeriods { + return false + } + if this.ReduceStep != that1.ReduceStep { + return false + } + if this.StartingRate != that1.StartingRate { + return false + } + if this.LowestRate != that1.LowestRate { + return false + } + if this.DiscountRate != that1.DiscountRate { + return false + } + return true +} +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DiscountRate) > 0 { + i -= len(m.DiscountRate) + copy(dAtA[i:], m.DiscountRate) + i = encodeVarintParams(dAtA, i, uint64(len(m.DiscountRate))) + i-- + dAtA[i] = 0x2a + } + if len(m.LowestRate) > 0 { + i -= len(m.LowestRate) + copy(dAtA[i:], m.LowestRate) + i = encodeVarintParams(dAtA, i, uint64(len(m.LowestRate))) + i-- + dAtA[i] = 0x22 + } + if len(m.StartingRate) > 0 { + i -= len(m.StartingRate) + copy(dAtA[i:], m.StartingRate) + i = encodeVarintParams(dAtA, i, uint64(len(m.StartingRate))) + i-- + dAtA[i] = 0x1a + } + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.ReduceStep, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ReduceStep):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintParams(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.AuctionPeriods, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AuctionPeriods):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintParams(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AuctionPeriods) + n += 1 + l + sovParams(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ReduceStep) + n += 1 + l + sovParams(uint64(l)) + l = len(m.StartingRate) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = len(m.LowestRate) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = len(m.DiscountRate) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.AuctionPeriods, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReduceStep", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.ReduceStep, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartingRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartingRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LowestRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LowestRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DiscountRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DiscountRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go new file mode 100644 index 00000000..dab8e08d --- /dev/null +++ b/x/auction/types/query.pb.go @@ -0,0 +1,881 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryAllAuctionRequest struct { +} + +func (m *QueryAllAuctionRequest) Reset() { *m = QueryAllAuctionRequest{} } +func (m *QueryAllAuctionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllAuctionRequest) ProtoMessage() {} +func (*QueryAllAuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{2} +} +func (m *QueryAllAuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAuctionRequest.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 *QueryAllAuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAuctionRequest.Merge(m, src) +} +func (m *QueryAllAuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAuctionRequest proto.InternalMessageInfo + +type QueryAllAuctionResponse struct { + // params holds all the parameters of this module. + Auctions []Auction `protobuf:"bytes,1,rep,name=auctions,proto3" json:"auctions"` +} + +func (m *QueryAllAuctionResponse) Reset() { *m = QueryAllAuctionResponse{} } +func (m *QueryAllAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllAuctionResponse) ProtoMessage() {} +func (*QueryAllAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{3} +} +func (m *QueryAllAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAuctionResponse.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 *QueryAllAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAuctionResponse.Merge(m, src) +} +func (m *QueryAllAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAuctionResponse proto.InternalMessageInfo + +func (m *QueryAllAuctionResponse) GetAuctions() []Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "reserve.auction.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "reserve.auction.v1.QueryParamsResponse") + proto.RegisterType((*QueryAllAuctionRequest)(nil), "reserve.auction.v1.QueryAllAuctionRequest") + proto.RegisterType((*QueryAllAuctionResponse)(nil), "reserve.auction.v1.QueryAllAuctionResponse") +} + +func init() { proto.RegisterFile("reserve/auction/v1/query.proto", fileDescriptor_c0d0f2ec58bf1126) } + +var fileDescriptor_c0d0f2ec58bf1126 = []byte{ + // 392 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, + 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xeb, 0x41, + 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x99, + 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0x65, 0xd2, 0xf3, 0xf3, + 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x41, 0x46, + 0x14, 0x43, 0x65, 0xe5, 0xb1, 0x58, 0x5d, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x53, 0xa0, 0x80, 0x45, + 0x01, 0xcc, 0x19, 0x10, 0x15, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x9b, 0x21, + 0x1c, 0x88, 0x94, 0x92, 0x08, 0x97, 0x50, 0x20, 0xc8, 0x1f, 0x01, 0x60, 0x13, 0x83, 0x52, 0x0b, + 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x42, 0xb8, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, + 0x85, 0x6c, 0xb9, 0xd8, 0x20, 0x36, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xe9, 0x61, + 0x7a, 0x5b, 0x0f, 0xa2, 0xc7, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, + 0x06, 0x41, 0x35, 0x29, 0x49, 0x70, 0x89, 0x81, 0x4d, 0x75, 0xcc, 0xc9, 0x71, 0x84, 0xa8, 0x87, + 0xd9, 0x17, 0xcb, 0x25, 0x8e, 0x21, 0x03, 0xb5, 0xd3, 0x89, 0x8b, 0x03, 0x6a, 0x38, 0xc8, 0x56, + 0x66, 0x0d, 0x6e, 0x23, 0x69, 0x6c, 0xb6, 0x42, 0xb5, 0x21, 0x5b, 0x0b, 0xd7, 0x67, 0x34, 0x89, + 0x89, 0x8b, 0x15, 0x6c, 0xbe, 0x50, 0x15, 0x17, 0x1b, 0xc4, 0x7d, 0x42, 0x6a, 0xd8, 0x4c, 0xc1, + 0x0c, 0x0a, 0x29, 0x75, 0x82, 0xea, 0x20, 0x0e, 0x55, 0x92, 0x6f, 0xba, 0xfc, 0x64, 0x32, 0x93, + 0xa4, 0x90, 0xb8, 0x3e, 0x7a, 0x7c, 0x40, 0xbc, 0x2f, 0xd4, 0xc3, 0xc8, 0xc5, 0x8f, 0xe6, 0x4b, + 0x21, 0x2d, 0x9c, 0xa6, 0x63, 0x04, 0x92, 0x94, 0x36, 0x51, 0x6a, 0xa1, 0xae, 0x51, 0x00, 0xbb, + 0x46, 0x4a, 0x48, 0x02, 0xc3, 0x35, 0x50, 0xda, 0xc9, 0xeb, 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, 0x0c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, + 0xf3, 0xf3, 0xf2, 0x73, 0x2b, 0xc1, 0x49, 0x25, 0x39, 0x3f, 0x07, 0x6e, 0x56, 0x05, 0xdc, 0xb4, + 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xf2, 0x86, 0x6b, 0x57, 0x27, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + QueryAllAuction(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllAuction(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) { + out := new(QueryAllAuctionResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Query/QueryAllAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + QueryAllAuction(context.Context, *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) QueryAllAuction(ctx context.Context, req *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllAuction not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllAuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Query/QueryAllAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllAuction(ctx, req.(*QueryAllAuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.auction.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "QueryAllAuction", + Handler: _Query_QueryAllAuction_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/auction/v1/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllAuctionRequest) 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 *QueryAllAuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllAuctionResponse) 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 *QueryAllAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllAuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAuctionRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllAuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAuctionResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go new file mode 100644 index 00000000..c47d9454 --- /dev/null +++ b/x/auction/types/query.pb.gw.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: reserve/auction/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryAllAuction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAuctionRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryAllAuction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllAuction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAuctionRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryAllAuction(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllAuction_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllAuction_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "auction", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllAuction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"reserve", "auction"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllAuction_0 = runtime.ForwardResponseMessage +) diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go new file mode 100644 index 00000000..6f7e034d --- /dev/null +++ b/x/auction/types/tx.pb.go @@ -0,0 +1,1578 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/auction/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +// MsgBid is the Msg/Bid request type. +type MsgBid struct { + // bidder is the address that submitting the bid entry. + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + // bidding auction id + AuctionId uint64 `protobuf:"varint,2,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // amount defines the amount that the bidder willing to pay. + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + // recive_price defines the price that the bid is willing to pay + RecivePrice string `protobuf:"bytes,4,opt,name=recive_price,json=recivePrice,proto3" json:"recive_price,omitempty"` +} + +func (m *MsgBid) Reset() { *m = MsgBid{} } +func (m *MsgBid) String() string { return proto.CompactTextString(m) } +func (*MsgBid) ProtoMessage() {} +func (*MsgBid) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{2} +} +func (m *MsgBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBid.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 *MsgBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBid.Merge(m, src) +} +func (m *MsgBid) XXX_Size() int { + return m.Size() +} +func (m *MsgBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBid proto.InternalMessageInfo + +func (m *MsgBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *MsgBid) GetAuctionId() uint64 { + if m != nil { + return m.AuctionId + } + return 0 +} + +func (m *MsgBid) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *MsgBid) GetRecivePrice() string { + if m != nil { + return m.RecivePrice + } + return "" +} + +// MsgBidResponse defines the response structure for executing a +// MsgBid message. +type MsgBidResponse struct { + Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + BidId uint64 `protobuf:"varint,2,opt,name=bid_id,json=bidId,proto3" json:"bid_id,omitempty"` +} + +func (m *MsgBidResponse) Reset() { *m = MsgBidResponse{} } +func (m *MsgBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBidResponse) ProtoMessage() {} +func (*MsgBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{3} +} +func (m *MsgBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBidResponse.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 *MsgBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBidResponse.Merge(m, src) +} +func (m *MsgBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBidResponse proto.InternalMessageInfo + +func (m *MsgBidResponse) GetResponse() string { + if m != nil { + return m.Response + } + return "" +} + +func (m *MsgBidResponse) GetBidId() uint64 { + if m != nil { + return m.BidId + } + return 0 +} + +// MsgCancelBid is the Msg/CancelBid request type. +type MsgCancelBid struct { + // bidder is the address that submitting the bid entry. + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + // bid_id is the unique id. + BidId uint64 `protobuf:"varint,2,opt,name=bid_id,json=bidId,proto3" json:"bid_id,omitempty"` + // bidding auction id + AuctionId uint64 `protobuf:"varint,3,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` +} + +func (m *MsgCancelBid) Reset() { *m = MsgCancelBid{} } +func (m *MsgCancelBid) String() string { return proto.CompactTextString(m) } +func (*MsgCancelBid) ProtoMessage() {} +func (*MsgCancelBid) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{4} +} +func (m *MsgCancelBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelBid.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 *MsgCancelBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelBid.Merge(m, src) +} +func (m *MsgCancelBid) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelBid proto.InternalMessageInfo + +func (m *MsgCancelBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *MsgCancelBid) GetBidId() uint64 { + if m != nil { + return m.BidId + } + return 0 +} + +func (m *MsgCancelBid) GetAuctionId() uint64 { + if m != nil { + return m.AuctionId + } + return 0 +} + +// MsgCancelBidResponse defines the response structure for executing a +// MsgCancelBid message. +type MsgCancelBidResponse struct { +} + +func (m *MsgCancelBidResponse) Reset() { *m = MsgCancelBidResponse{} } +func (m *MsgCancelBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelBidResponse) ProtoMessage() {} +func (*MsgCancelBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18d11acb13497546, []int{5} +} +func (m *MsgCancelBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelBidResponse.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 *MsgCancelBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelBidResponse.Merge(m, src) +} +func (m *MsgCancelBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelBidResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "reserve.auction.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.auction.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgBid)(nil), "reserve.auction.v1.MsgBid") + proto.RegisterType((*MsgBidResponse)(nil), "reserve.auction.v1.MsgBidResponse") + proto.RegisterType((*MsgCancelBid)(nil), "reserve.auction.v1.MsgCancelBid") + proto.RegisterType((*MsgCancelBidResponse)(nil), "reserve.auction.v1.MsgCancelBidResponse") +} + +func init() { proto.RegisterFile("reserve/auction/v1/tx.proto", fileDescriptor_18d11acb13497546) } + +var fileDescriptor_18d11acb13497546 = []byte{ + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xb1, 0x6f, 0xd3, 0x4e, + 0x18, 0x8d, 0x9b, 0x36, 0xfa, 0xe5, 0x5a, 0xf5, 0x27, 0xac, 0x42, 0x5d, 0x23, 0xdc, 0x60, 0x96, + 0x28, 0xa8, 0xbe, 0xa6, 0x20, 0x86, 0x08, 0x06, 0x1c, 0x18, 0x8a, 0x14, 0x09, 0x19, 0x21, 0x24, + 0x96, 0x70, 0xf6, 0x9d, 0xdc, 0x93, 0x6a, 0x5f, 0x74, 0x77, 0x89, 0x9a, 0x0d, 0x31, 0x32, 0x20, + 0xfe, 0x0a, 0xc4, 0x98, 0xa1, 0x33, 0x73, 0xc7, 0xaa, 0x13, 0x13, 0x42, 0xc9, 0x90, 0x9d, 0xbf, + 0x00, 0xd9, 0xbe, 0x38, 0xd4, 0x4d, 0x54, 0xc4, 0x12, 0xdd, 0x77, 0xef, 0x7d, 0xef, 0xbe, 0xf7, + 0xfc, 0x29, 0xe0, 0x36, 0x27, 0x82, 0xf0, 0x01, 0x81, 0xa8, 0x1f, 0x48, 0xca, 0x62, 0x38, 0x68, + 0x42, 0x79, 0xe2, 0xf4, 0x38, 0x93, 0x4c, 0xd7, 0x15, 0xe8, 0x28, 0xd0, 0x19, 0x34, 0xcd, 0x1b, + 0x28, 0xa2, 0x31, 0x83, 0xe9, 0x6f, 0x46, 0x33, 0xb7, 0x42, 0x16, 0xb2, 0xf4, 0x08, 0x93, 0x93, + 0xba, 0xdd, 0x09, 0x98, 0x88, 0x98, 0xe8, 0x66, 0x40, 0x56, 0x28, 0x68, 0x3b, 0xab, 0x60, 0x24, + 0xc2, 0xe4, 0xbd, 0x48, 0x84, 0x0a, 0xb0, 0x14, 0xe0, 0x23, 0x41, 0xe0, 0xa0, 0xe9, 0x13, 0x89, + 0x9a, 0x30, 0x60, 0x34, 0x56, 0xf8, 0xee, 0x82, 0x69, 0x7b, 0x88, 0xa3, 0x48, 0x29, 0xdb, 0xdf, + 0x34, 0xf0, 0x7f, 0x47, 0x84, 0xaf, 0x7b, 0x18, 0x49, 0xf2, 0x32, 0x45, 0xf4, 0x47, 0xa0, 0x8a, + 0xfa, 0xf2, 0x88, 0x71, 0x2a, 0x87, 0x86, 0x56, 0xd3, 0xea, 0x55, 0xd7, 0xb8, 0x38, 0xdd, 0xdb, + 0x52, 0x23, 0x3d, 0xc5, 0x98, 0x13, 0x21, 0x5e, 0x49, 0x4e, 0xe3, 0xd0, 0x9b, 0x53, 0xf5, 0x27, + 0xa0, 0x92, 0x69, 0x1b, 0x2b, 0x35, 0xad, 0xbe, 0x7e, 0x60, 0x3a, 0x57, 0xe3, 0x70, 0xb2, 0x37, + 0xdc, 0xea, 0xd9, 0x8f, 0xdd, 0xd2, 0xd7, 0xe9, 0xa8, 0xa1, 0x79, 0xaa, 0xa9, 0xf5, 0xf0, 0xc3, + 0x74, 0xd4, 0x98, 0xcb, 0x7d, 0x9c, 0x8e, 0x1a, 0x77, 0x67, 0xe3, 0x9f, 0xe4, 0x06, 0x0a, 0xc3, + 0xda, 0x3b, 0x60, 0xbb, 0x70, 0xe5, 0x11, 0xd1, 0x63, 0xb1, 0x20, 0xf6, 0x2f, 0x0d, 0x54, 0x3a, + 0x22, 0x74, 0x29, 0xd6, 0xf7, 0x41, 0xc5, 0xa7, 0x18, 0x13, 0x7e, 0xad, 0x1f, 0xc5, 0xd3, 0xef, + 0x00, 0xa0, 0x9e, 0xec, 0x52, 0x9c, 0x1a, 0x5a, 0x4d, 0xbc, 0xa6, 0x37, 0x87, 0x58, 0x7f, 0x0c, + 0x2a, 0x28, 0x62, 0xfd, 0x58, 0x1a, 0xe5, 0xd4, 0xeb, 0x8e, 0xa3, 0xd4, 0x92, 0x2f, 0xe1, 0xa8, + 0x2f, 0xe1, 0xb4, 0x19, 0x8d, 0x2f, 0x59, 0xcd, 0x7a, 0x74, 0x08, 0xd6, 0x39, 0x09, 0xe8, 0x80, + 0x74, 0x39, 0x92, 0xc4, 0x58, 0x4d, 0x67, 0xda, 0xbc, 0x38, 0xdd, 0x03, 0x4a, 0xe5, 0x19, 0x09, + 0x3c, 0x90, 0x51, 0x3c, 0x24, 0x49, 0xab, 0x9e, 0x64, 0xa3, 0x46, 0x4b, 0x82, 0x31, 0x16, 0x06, + 0xe3, 0x52, 0x6c, 0xb7, 0xc1, 0x66, 0x76, 0x9a, 0xc5, 0xa0, 0x9b, 0xe0, 0x3f, 0xae, 0xce, 0x99, + 0x7b, 0x2f, 0xaf, 0xf5, 0x9b, 0x69, 0x2e, 0x73, 0x87, 0x6b, 0x3e, 0xc5, 0x87, 0xd8, 0xfe, 0xa2, + 0x81, 0x8d, 0x8e, 0x08, 0xdb, 0x28, 0x0e, 0xc8, 0xf1, 0xbf, 0xe5, 0xb7, 0x58, 0xb9, 0x10, 0x6b, + 0xb9, 0x10, 0x6b, 0xcb, 0x29, 0xf8, 0xb4, 0x16, 0xfa, 0xcc, 0xe7, 0xb2, 0x6f, 0x81, 0xad, 0x3f, + 0xeb, 0x99, 0xe7, 0x83, 0x4f, 0x2b, 0xa0, 0xdc, 0x11, 0xa1, 0xfe, 0x0e, 0x6c, 0x5c, 0x5a, 0xed, + 0x7b, 0x8b, 0x56, 0xb2, 0xb0, 0x3f, 0xe6, 0xfd, 0xbf, 0x20, 0xe5, 0xe9, 0x3e, 0x07, 0xe5, 0x24, + 0x20, 0x73, 0x49, 0x8f, 0x4b, 0xb1, 0x69, 0x2f, 0xc7, 0x72, 0x99, 0x37, 0xa0, 0x3a, 0x4f, 0xbb, + 0xb6, 0xa4, 0x21, 0x67, 0x98, 0xf5, 0xeb, 0x18, 0x33, 0x61, 0x73, 0xed, 0x7d, 0xb2, 0x79, 0xee, + 0x8b, 0xb3, 0xb1, 0xa5, 0x9d, 0x8f, 0x2d, 0xed, 0xe7, 0xd8, 0xd2, 0x3e, 0x4f, 0xac, 0xd2, 0xf9, + 0xc4, 0x2a, 0x7d, 0x9f, 0x58, 0xa5, 0xb7, 0xfb, 0x21, 0x95, 0x47, 0x7d, 0xdf, 0x09, 0x58, 0x04, + 0x59, 0xcc, 0xa2, 0x61, 0xfa, 0xc7, 0x10, 0xb0, 0x63, 0x78, 0x35, 0x7b, 0x39, 0xec, 0x11, 0xe1, + 0x57, 0x52, 0xc6, 0x83, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x88, 0x73, 0xa7, 0x8e, 0x0b, 0x05, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // Bid defines an operation for submit a bid entry. + Bid(ctx context.Context, in *MsgBid, opts ...grpc.CallOption) (*MsgBidResponse, error) + // CancelBid defines an operation for cancel an existing bid entry. + CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Bid(ctx context.Context, in *MsgBid, opts ...grpc.CallOption) (*MsgBidResponse, error) { + out := new(MsgBidResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Msg/Bid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) { + out := new(MsgCancelBidResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Msg/CancelBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // Bid defines an operation for submit a bid entry. + Bid(context.Context, *MsgBid) (*MsgBidResponse, error) + // CancelBid defines an operation for cancel an existing bid entry. + CancelBid(context.Context, *MsgCancelBid) (*MsgCancelBidResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) Bid(ctx context.Context, req *MsgBid) (*MsgBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bid not implemented") +} +func (*UnimplementedMsgServer) CancelBid(ctx context.Context, req *MsgCancelBid) (*MsgCancelBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelBid not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Bid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Bid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Msg/Bid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Bid(ctx, req.(*MsgBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CancelBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Msg/CancelBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelBid(ctx, req.(*MsgCancelBid)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.auction.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "Bid", + Handler: _Msg_Bid_Handler, + }, + { + MethodName: "CancelBid", + Handler: _Msg_CancelBid_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/auction/v1/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgBid) 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 *MsgBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecivePrice) > 0 { + i -= len(m.RecivePrice) + copy(dAtA[i:], m.RecivePrice) + i = encodeVarintTx(dAtA, i, uint64(len(m.RecivePrice))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.AuctionId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AuctionId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBidResponse) 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 *MsgBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BidId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BidId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Response) > 0 { + i -= len(m.Response) + copy(dAtA[i:], m.Response) + i = encodeVarintTx(dAtA, i, uint64(len(m.Response))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelBid) 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 *MsgCancelBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AuctionId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AuctionId)) + i-- + dAtA[i] = 0x18 + } + if m.BidId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BidId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelBidResponse) 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 *MsgCancelBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AuctionId != 0 { + n += 1 + sovTx(uint64(m.AuctionId)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.RecivePrice) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Response) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BidId != 0 { + n += 1 + sovTx(uint64(m.BidId)) + } + return n +} + +func (m *MsgCancelBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BidId != 0 { + n += 1 + sovTx(uint64(m.BidId)) + } + if m.AuctionId != 0 { + n += 1 + sovTx(uint64(m.AuctionId)) + } + return n +} + +func (m *MsgCancelBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 + } + if err := m.Params.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 (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgBid) 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: MsgBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + m.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecivePrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RecivePrice = string(dAtA[iNdEx:postIndex]) + 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 (m *MsgBidResponse) 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: MsgBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Response = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BidId", wireType) + } + m.BidId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BidId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 (m *MsgCancelBid) 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: MsgCancelBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BidId", wireType) + } + m.BidId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BidId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + m.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 (m *MsgCancelBidResponse) 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: MsgCancelBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/.DS_Store b/x/oracle/.DS_Store new file mode 100644 index 00000000..9efb7099 Binary files /dev/null and b/x/oracle/.DS_Store differ diff --git a/x/oracle/bandchain/oracle/types/error.go b/x/oracle/bandchain/oracle/types/error.go new file mode 100644 index 00000000..df4885ca --- /dev/null +++ b/x/oracle/bandchain/oracle/types/error.go @@ -0,0 +1,59 @@ +package types + +import ( + "cosmossdk.io/errors" +) + +var ( + ErrOwasmCompilation = errors.Register(ModuleName, 1, "owasm compilation failed") + ErrBadWasmExecution = errors.Register(ModuleName, 2, "bad wasm execution") + ErrDataSourceNotFound = errors.Register(ModuleName, 3, "data source not found") + ErrOracleScriptNotFound = errors.Register(ModuleName, 4, "oracle script not found") + ErrRequestNotFound = errors.Register(ModuleName, 5, "request not found") + ErrRawRequestNotFound = errors.Register(ModuleName, 6, "raw request not found") + ErrReporterNotFound = errors.Register(ModuleName, 7, "reporter not found") + ErrResultNotFound = errors.Register(ModuleName, 8, "result not found") + ErrReporterAlreadyExists = errors.Register(ModuleName, 9, "reporter already exists") + ErrValidatorNotRequested = errors.Register(ModuleName, 10, "validator not requested") + ErrValidatorAlreadyReported = errors.Register(ModuleName, 11, "validator already reported") + ErrInvalidReportSize = errors.Register(ModuleName, 12, "invalid report size") + ErrReporterNotAuthorized = errors.Register(ModuleName, 13, "reporter not authorized") + ErrEditorNotAuthorized = errors.Register(ModuleName, 14, "editor not authorized") + ErrValidatorAlreadyActive = errors.Register(ModuleName, 16, "validator already active") + ErrTooSoonToActivate = errors.Register(ModuleName, 17, "too soon to activate") + ErrTooLongName = errors.Register(ModuleName, 18, "too long name") + ErrTooLongDescription = errors.Register(ModuleName, 19, "too long description") + ErrEmptyExecutable = errors.Register(ModuleName, 20, "empty executable") + ErrEmptyWasmCode = errors.Register(ModuleName, 21, "empty wasm code") + ErrTooLargeExecutable = errors.Register(ModuleName, 22, "too large executable") + ErrTooLargeWasmCode = errors.Register(ModuleName, 23, "too large wasm code") + ErrInvalidMinCount = errors.Register(ModuleName, 24, "invalid min count") + ErrInvalidAskCount = errors.Register(ModuleName, 25, "invalid ask count") + ErrTooLargeCalldata = errors.Register(ModuleName, 26, "too large calldata") + ErrTooLongClientID = errors.Register(ModuleName, 27, "too long client id") + ErrEmptyRawRequests = errors.Register(ModuleName, 28, "empty raw requests") + ErrEmptyReport = errors.Register(ModuleName, 29, "empty report") + ErrDuplicateExternalID = errors.Register(ModuleName, 30, "duplicate external id") + ErrTooLongSchema = errors.Register(ModuleName, 31, "too long schema") + ErrTooLongURL = errors.Register(ModuleName, 32, "too long url") + ErrTooLargeRawReportData = errors.Register(ModuleName, 33, "too large raw report data") + ErrInsufficientValidators = errors.Register(ModuleName, 34, "insufficient available validators") + ErrCreateWithDoNotModify = errors.Register(ModuleName, 35, "cannot create with [do-not-modify] content") + ErrSelfReferenceAsReporter = errors.Register(ModuleName, 36, "cannot reference self as reporter") + ErrOBIDecode = errors.Register(ModuleName, 37, "obi decode failed") + ErrUncompressionFailed = errors.Register(ModuleName, 38, "uncompression failed") + ErrRequestAlreadyExpired = errors.Register(ModuleName, 39, "request already expired") + ErrBadDrbgInitialization = errors.Register(ModuleName, 40, "bad drbg initialization") + ErrMaxOracleChannels = errors.Register(ModuleName, 41, "max oracle channels") + ErrInvalidVersion = errors.Register(ModuleName, 42, "invalid ICS20 version") + ErrNotEnoughFee = errors.Register(ModuleName, 43, "not enough fee") + ErrInvalidOwasmGas = errors.Register(ModuleName, 44, "invalid owasm gas") + ErrIBCRequestDisabled = errors.Register(ModuleName, 45, "sending oracle request via IBC is disabled") + ErrInvalidRequestKey = errors.Register(ModuleName, 46, "invalid request key") + ErrTooLongRequestKey = errors.Register(ModuleName, 47, "too long request key") +) + +// WrapMaxError wraps an error message with additional info of the current and max values. +func WrapMaxError(err error, got, maximum int) error { + return errors.Wrapf(err, "got: %d, maximum: %d", got, maximum) +} diff --git a/x/oracle/bandchain/oracle/types/id.go b/x/oracle/bandchain/oracle/types/id.go new file mode 100644 index 00000000..84a427d9 --- /dev/null +++ b/x/oracle/bandchain/oracle/types/id.go @@ -0,0 +1,13 @@ +package types + +// DataSourceID is the type-safe unique identifier type for data sources. +type DataSourceID int64 + +// OracleScriptID is the type-safe unique identifier type for oracle scripts. +type OracleScriptID int64 + +// RequestID is the type-safe unique identifier type for data requests. +type RequestID int64 + +// ExternalID is the type-safe unique identifier type for raw data requests. +type ExternalID int64 diff --git a/x/oracle/bandchain/oracle/types/keys.go b/x/oracle/bandchain/oracle/types/keys.go new file mode 100644 index 00000000..404b6841 --- /dev/null +++ b/x/oracle/bandchain/oracle/types/keys.go @@ -0,0 +1,124 @@ +package types + +import ( + "crypto/sha256" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // ModuleName is the name of the module. + ModuleName = "bandoracle" + + // Version defines the current version the IBC oracle module supports + Version = "bandchain-1" + + // StoreKey to be used when creating the KVStore. + StoreKey = ModuleName + + // QuerierRoute is the querier route for the oracle module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the oracle module + RouterKey = ModuleName + + // PortID is the default port id that oracle module binds to. + PortID = ModuleName +) + +var ( + // RollingSeedSizeInBytes is the size of rolling block hash for random seed. + RollingSeedSizeInBytes = 32 + // GlobalStoreKeyPrefix is the prefix for global primitive state variables. + GlobalStoreKeyPrefix = []byte{0x00} + // RollingSeedStoreKey is the key that keeps the seed based on the first 8-bit of the most recent 32 block hashes. + RollingSeedStoreKey = append(GlobalStoreKeyPrefix, []byte("RollingSeed")...) + // RequestCountStoreKey is the key that keeps the total request count. + RequestCountStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestCount")...) + // RequestLastExpiredStoreKey is the key that keeps the ID of the last expired request, or 0 if none. + RequestLastExpiredStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestLastExpired")...) + // PendingResolveListStoreKey is the key that keeps the list of pending-resolve requests. + PendingResolveListStoreKey = append(GlobalStoreKeyPrefix, []byte("PendingList")...) + // DataSourceCountStoreKey is the key that keeps the total data source count. + DataSourceCountStoreKey = append(GlobalStoreKeyPrefix, []byte("DataSourceCount")...) + // OracleScriptCountStoreKey is the key that keeps the total oracle sciprt count. + OracleScriptCountStoreKey = append(GlobalStoreKeyPrefix, []byte("OracleScriptCount")...) + + // RequestStoreKeyPrefix is the prefix for request store. + RequestStoreKeyPrefix = []byte{0x01} + // ReportStoreKeyPrefix is the prefix for report store. + ReportStoreKeyPrefix = []byte{0x02} + // DataSourceStoreKeyPrefix is the prefix for data source store. + DataSourceStoreKeyPrefix = []byte{0x03} + // OracleScriptStoreKeyPrefix is the prefix for oracle script store. + OracleScriptStoreKeyPrefix = []byte{0x04} + // ReporterStoreKeyPrefix is the prefix for reporter store. + ReporterStoreKeyPrefix = []byte{0x05} + // ValidatorStatusKeyPrefix is the prefix for validator status store. + ValidatorStatusKeyPrefix = []byte{0x06} + // ResultStoreKeyPrefix is the prefix for request result store. + ResultStoreKeyPrefix = []byte{0xff} + + // PortKey defines the key to store the port ID in store + PortKey = []byte{0xf0} +) + +// RequestStoreKey returns the key to retrieve a specific request from the store. +func RequestStoreKey(requestID RequestID) []byte { + return append(RequestStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// ReportStoreKey returns the key to retrieve all data reports for a request. +func ReportStoreKey(requestID RequestID) []byte { + return append(ReportStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// DataSourceStoreKey returns the key to retrieve a specific data source from the store. +func DataSourceStoreKey(dataSourceID DataSourceID) []byte { + return append(DataSourceStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(dataSourceID))...) +} + +// OracleScriptStoreKey returns the key to retrieve a specific oracle script from the store. +func OracleScriptStoreKey(oracleScriptID OracleScriptID) []byte { + return append(OracleScriptStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(oracleScriptID))...) +} + +// ReporterStoreKey returns the key to check whether an address is a reporter of a validator. +func ReporterStoreKey(validatorAddress sdk.ValAddress, reporterAddress sdk.AccAddress) []byte { + return append(append(ReporterStoreKeyPrefix, []byte(validatorAddress)...), []byte(reporterAddress)...) +} + +// ValidatorStatusStoreKey returns the key to a validator's status. +func ValidatorStatusStoreKey(v sdk.ValAddress) []byte { + return append(ValidatorStatusKeyPrefix, v.Bytes()...) +} + +// ResultStoreKey returns the key to a request result in the store. +func ResultStoreKey(requestID RequestID) []byte { + return append(ResultStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// ReportsOfValidatorPrefixKey returns the prefix key to get all reports for a request from a validator. +func ReportsOfValidatorPrefixKey(reqID RequestID, val sdk.ValAddress) []byte { + return append(append(ReportStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(reqID))...), val.Bytes()...) +} + +// ReportersOfValidatorPrefixKey returns the prefix key to get all reporters of a validator. +func ReportersOfValidatorPrefixKey(val sdk.ValAddress) []byte { + return append(ReporterStoreKeyPrefix, val.Bytes()...) +} + +// GetEscrowAddress returns the escrow address for the specified channel and request key. +// The escrow address follows the format as outlined in ADR 028: +// https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md +func GetEscrowAddress(requestKey, portID, channelID string) sdk.AccAddress { + contents := fmt.Sprintf("%s/%s/%s", requestKey, portID, channelID) + + // ADR 028 AddressHash construction + preImage := []byte(Version) + preImage = append(preImage, 0) + preImage = append(preImage, contents...) + hash := sha256.Sum256(preImage) + return hash[:20] +} diff --git a/x/oracle/bandtesting/.DS_Store b/x/oracle/bandtesting/.DS_Store new file mode 100644 index 00000000..defd879a Binary files /dev/null and b/x/oracle/bandtesting/.DS_Store differ diff --git a/x/oracle/bandtesting/app/app.go b/x/oracle/bandtesting/app/app.go new file mode 100644 index 00000000..62325aec --- /dev/null +++ b/x/oracle/bandtesting/app/app.go @@ -0,0 +1,795 @@ +package band + +import ( + "encoding/json" + "github.com/cosmos/cosmos-sdk/runtime" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "io" + "net/http" + "os" + "path/filepath" + + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + + reserverapp "github.com/onomyprotocol/reserve/app" + + storetypes "cosmossdk.io/store/types" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" + + "cosmossdk.io/log" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" + abci "github.com/cometbft/cometbft/abci/types" + tmos "github.com/cometbft/cometbft/libs/os" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + + "github.com/gorilla/mux" + "github.com/rakyll/statik/fs" + "github.com/spf13/cast" + + "cosmossdk.io/x/evidence" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/mint" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + + // unnamed import of statik for swagger UI support + // "github.com/cosmos/cosmos-sdk/client/docs/statik" + + bandoracletypes "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle" + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/keeper" +) + +const appName = "BandApp" + +var ( + // DefaultNodeHome default home directories for the application daemon + DefaultNodeHome string + + // ModuleBasics defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration + // and genesis verification. + ModuleBasics = module.NewBasicManager( + auth.AppModuleBasic{}, + genutil.AppModuleBasic{}, + bank.AppModuleBasic{}, + capability.AppModuleBasic{}, + staking.AppModuleBasic{}, + mint.AppModuleBasic{}, + distr.AppModuleBasic{}, + gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + // upgradeclient.LegacyProposalHandler, + // upgradeclient.LegacyCancelProposalHandler, + }, + ), + params.AppModuleBasic{}, + crisis.AppModuleBasic{}, + slashing.AppModuleBasic{}, + ibc.AppModuleBasic{}, + ibctm.AppModuleBasic{}, + upgrade.AppModuleBasic{}, + evidence.AppModuleBasic{}, + vesting.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, + transfer.AppModuleBasic{}, + oracle.AppModuleBasic{}, + ) + // module account permissions + maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + } +) + +var ( + _ runtime.AppI = (*BandApp)(nil) +) + +// BandApp is the application of BandChain, extended base ABCI application. +type BandApp struct { + *baseapp.BaseApp + legacyAmino *codec.LegacyAmino + appCodec codec.Codec + interfaceRegistry types.InterfaceRegistry + + invCheckPeriod uint + // keys to access the substores. + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey + + // keepers + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + EvidenceKeeper evidencekeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + AuthzKeeper authzkeeper.Keeper + OracleKeeper oraclekeeper.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedOracleKeeper capabilitykeeper.ScopedKeeper + + // the module manager + mm *module.Manager + BasicModuleManager module.BasicManager + + sm *module.SimulationManager + + // module configurator + configurator module.Configurator +} + +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } + + DefaultNodeHome = filepath.Join(userHomeDir, ".band") +} + +// NewBandApp returns a reference to an initialized BandApp. +func NewBandApp( + logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, + homePath string, invCheckPeriod uint, encodingConfig EncodingConfig, + appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), +) *BandApp { + + appCodec := encodingConfig.Marshaler + legacyAmino := encodingConfig.Amino + interfaceRegistry := encodingConfig.InterfaceRegistry + + bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + bApp.SetCommitMultiStoreTracer(traceStore) + bApp.SetVersion(version.Version) + bApp.SetInterfaceRegistry(interfaceRegistry) + + keys := storetypes.NewKVStoreKeys( + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, + evidencetypes.StoreKey, capabilitytypes.StoreKey, + feegrant.StoreKey, + authzkeeper.StoreKey, + bandoracletypes.StoreKey, + ibcexported.StoreKey, + ibctransfertypes.ModuleName, + crisistypes.StoreKey, + consensustypes.StoreKey, + ) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + + authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + app := &BandApp{ + BaseApp: bApp, + legacyAmino: legacyAmino, + appCodec: appCodec, + interfaceRegistry: interfaceRegistry, + invCheckPeriod: invCheckPeriod, + keys: keys, + tkeys: tkeys, + memKeys: memKeys, + } + + app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) + + // todo put in app + consensusParamsKeeper := consensusparamkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[consensustypes.StoreKey]), + authority, + runtime.EventService{}, + ) + // set the BaseApp's parameter store + bApp.SetParamStore(consensusParamsKeeper.ParamsStore) + + app.UpgradeKeeper = upgradekeeper.NewKeeper( + skipUpgradeHeights, + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), + appCodec, + homePath, + app.BaseApp, + authority, + ) + + app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedOracleKeeper := app.CapabilityKeeper.ScopeToModule(bandoracletypes.ModuleName) + + app.CapabilityKeeper.Seal() + + // add keepers + app.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, + runtime.NewKVStoreService(keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + maccPerms, + authcodec.NewBech32Codec(reserverapp.AccountAddressPrefix), + reserverapp.AccountAddressPrefix, + authority, + ) + + blockedAddresses := make(map[string]bool) + app.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, + runtime.NewKVStoreService(keys[banktypes.StoreKey]), + app.AccountKeeper, + blockedAddresses, + authority, + logger, + ) + + stakingKeeper := stakingkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), + app.AccountKeeper, + app.BankKeeper, + authority, + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + ) + + app.MintKeeper = mintkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[minttypes.StoreKey]), + stakingKeeper, + app.AccountKeeper, + app.BankKeeper, + authtypes.FeeCollectorName, + authority, + ) + + app.DistrKeeper = distrkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[distrtypes.StoreKey]), + app.AccountKeeper, + app.BankKeeper, + stakingKeeper, + authtypes.FeeCollectorName, + authority, + ) + + app.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, + encodingConfig.Amino, + runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), + stakingKeeper, + authority, + ) + + app.CrisisKeeper = crisiskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[crisistypes.StoreKey]), + invCheckPeriod, + app.BankKeeper, + authtypes.FeeCollectorName, + authority, + app.AccountKeeper.AddressCodec(), + ) + + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + stakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), + ) + + app.StakingKeeper = *stakingKeeper + + // create IBC Keeper + app.IBCKeeper = ibckeeper.NewKeeper( + appCodec, + keys[ibcexported.StoreKey], + app.GetSubspace(ibcexported.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, + scopedIBCKeeper, + authority, + ) + + // create evidence keeper with router + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), + app.StakingKeeper, + app.SlashingKeeper, + app.AccountKeeper.AddressCodec(), + runtime.ProvideCometInfoService(), + ) + // If evidence needs to be handled for the app, set routes in router here and seal + app.EvidenceKeeper = *evidenceKeeper + + feegrantKeeper := feegrantkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), &app.AccountKeeper, + ) + app.FeeGrantKeeper = feegrantKeeper + + authzKeeper := authzkeeper.NewKeeper( + runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper, + ) + app.AuthzKeeper = authzKeeper + + // register the proposal types + govRouter := govv1beta1.NewRouter(). + AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) + + govKeeper := govkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[govtypes.StoreKey]), + app.AccountKeeper, + app.BankKeeper, + stakingKeeper, + app.DistrKeeper, + app.MsgServiceRouter(), + govtypes.DefaultConfig(), + authority, + ) + + govKeeper.SetLegacyRouter(govRouter) + + app.GovKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks( + // register the governance hooks + ), + ) + + // TODO: "the IBC transfer module account has not been set" + // Create Transfer Keepers + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, + keys[ibctransfertypes.StoreKey], + app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + app.AccountKeeper, + app.BankKeeper, + scopedTransferKeeper, + authority, + ) + transferModule := transfer.NewAppModule(app.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) + + app.OracleKeeper = oraclekeeper.NewKeeper( + appCodec, + keys[bandoracletypes.StoreKey], + app.GetSubspace(bandoracletypes.ModuleName), + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + scopedOracleKeeper, + ) + + oracleModule := oracle.NewAppModule(app.OracleKeeper) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter() + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) + ibcRouter.AddRoute(bandoracletypes.ModuleName, oracleModule) + + // Setting Router will finalize all routes by sealing router + // No more routes can be added + app.IBCKeeper.SetRouter(ibcRouter) + + /**** Module Options ****/ + + // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment + // we prefer to be more strict in what arguments the modules expect. + var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. + app.mm = module.NewManager( + genutil.NewAppModule( + app.AccountKeeper, app.StakingKeeper, app, + encodingConfig.TxConfig, + ), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), + gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), + evidence.NewAppModule(app.EvidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + staking.NewAppModule(appCodec, &app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + ibc.NewAppModule(app.IBCKeeper), + params.NewAppModule(app.ParamsKeeper), + transferModule, + oracleModule, + ) + + app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // NOTE: upgrade module is required to be prioritized + app.mm.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + app.mm.SetOrderBeginBlockers( + evidencetypes.ModuleName, feegrant.ModuleName, + capabilitytypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authtypes.ModuleName, govtypes.ModuleName, + paramstypes.ModuleName, vestingtypes.ModuleName, banktypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + minttypes.ModuleName, bandoracletypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, + stakingtypes.ModuleName, ibcexported.ModuleName, + ) + app.mm.SetOrderEndBlockers( + crisistypes.ModuleName, + genutiltypes.ModuleName, vestingtypes.ModuleName, + paramstypes.ModuleName, authtypes.ModuleName, + feegrant.ModuleName, banktypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + minttypes.ModuleName, slashingtypes.ModuleName, ibctransfertypes.ModuleName, evidencetypes.ModuleName, + capabilitytypes.ModuleName, distrtypes.ModuleName, ibcexported.ModuleName, upgradetypes.ModuleName, + + govtypes.ModuleName, stakingtypes.ModuleName, bandoracletypes.ModuleName, + ) + app.mm.SetOrderMigrations( + crisistypes.ModuleName, + genutiltypes.ModuleName, + paramstypes.ModuleName, authtypes.ModuleName, + banktypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + minttypes.ModuleName, slashingtypes.ModuleName, ibctransfertypes.ModuleName, evidencetypes.ModuleName, + capabilitytypes.ModuleName, distrtypes.ModuleName, ibcexported.ModuleName, upgradetypes.ModuleName, + govtypes.ModuleName, stakingtypes.ModuleName, bandoracletypes.ModuleName, feegrant.ModuleName, vestingtypes.ModuleName, + ) + + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + app.mm.SetOrderInitGenesis( + capabilitytypes.ModuleName, + upgradetypes.ModuleName, + evidencetypes.ModuleName, feegrant.ModuleName, + authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, + slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, bandoracletypes.ModuleName, crisistypes.ModuleName, + genutiltypes.ModuleName, authz.ModuleName, vestingtypes.ModuleName, paramstypes.ModuleName, + ) + + app.mm.RegisterInvariants(app.CrisisKeeper) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + err := app.mm.RegisterServices(app.configurator) + if err != nil { + panic(err) + } + + // add test gRPC service for testing gRPC queries in isolation + testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) + + overrideModules := map[string]module.AppModuleSimulation{ + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + } + app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) + app.sm.RegisterStoreDecoders() + + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tkeys) + app.MountMemoryStores(memKeys) + + // initialize BaseApp + app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) + app.SetBeginBlocker(app.BeginBlocker) + + anteHandler, err := ante.NewAnteHandler( + ante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + }, + ) + + if err != nil { + panic(err) + } + app.SetAnteHandler(anteHandler) + app.SetEndBlocker(app.EndBlocker) + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + tmos.Exit(err.Error()) + } + } + + // app.CapabilityKeeper.Seal() + + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedOracleKeeper = scopedOracleKeeper + + return app +} + +func (app *BandApp) SimulationManager() *module.SimulationManager { + return app.sm +} + +func (app *BandApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { + return servertypes.ExportedApp{}, nil +} + +func (app *BandApp) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } + +func (app *BandApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { return app.StakingKeeper } + +func (app *BandApp) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } + +func (app *BandApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +func (app *BandApp) GetTxConfig() client.TxConfig { return MakeEncodingConfig().TxConfig } + +// Name returns the name of the App +func (app *BandApp) Name() string { return app.BaseApp.Name() } + +// BeginBlocker application updates every begin block +func (app *BandApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.mm.BeginBlock(ctx) +} + +// PreBlocker application updates every pre block +func (app *BandApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) +} + +// EndBlocker application updates every end block +func (app *BandApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.mm.EndBlock(ctx) +} + +// InitChainer application update at chain initialization +func (app *BandApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + var genesisState GenesisState + if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + panic(err) + } + return app.mm.InitGenesis(ctx, app.appCodec, genesisState) +} + +// LoadHeight loads a particular height +func (app *BandApp) LoadHeight(height int64) error { + return app.LoadVersion(height) +} + +// ModuleAccountAddrs returns all the app's module account addresses. +func (app *BandApp) ModuleAccountAddrs() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range maccPerms { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + return modAccAddrs +} + +// LegacyAmino returns BandApp's amino codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *BandApp) LegacyAmino() *codec.LegacyAmino { + return app.legacyAmino +} + +// AppCodec returns BandApp's app codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *BandApp) AppCodec() codec.Codec { + return app.appCodec +} + +// InterfaceRegistry returns BandApp's InterfaceRegistry +func (app *BandApp) InterfaceRegistry() types.InterfaceRegistry { + return app.interfaceRegistry +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *BandApp) GetKey(storeKey string) *storetypes.KVStoreKey { + return app.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *BandApp) GetTKey(storeKey string) *storetypes.TransientStoreKey { + return app.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (app *BandApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return app.memKeys[storeKey] +} + +// GetSubspace returns a param subspace for a given module name. +// +// NOTE: This is solely to be used for testing purposes. +func (app *BandApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +func (app *BandApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *BandApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + clientCtx := apiSvr.ClientCtx + + // Register new tx routes from grpc-gateway. + authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new tendermint queries routes from grpc-gateway. + cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register grpc-gateway routes for all modules. + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // register swagger API from root so that other applications can override easily + if apiConfig.Swagger { + RegisterSwaggerAPI(clientCtx, apiSvr.Router) + } +} + +// RegisterTxService implements the Application.RegisterTxService method. +func (app *BandApp) RegisterTxService(clientCtx client.Context) { + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +} + +// RegisterTendermintService implements the Application.RegisterTendermintService method. +func (app *BandApp) RegisterTendermintService(clientCtx client.Context) { + cmtservice.RegisterTendermintService( + clientCtx, + app.BaseApp.GRPCQueryRouter(), + app.interfaceRegistry, + app.Query, + ) +} + +// RegisterSwaggerAPI registers swagger route with API Server +func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { + statikFS, err := fs.New() + if err != nil { + panic(err) + } + + staticServer := http.FileServer(statikFS) + rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) +} + +// GetMaccPerms returns a mapping of the application's module account permissions. +func GetMaccPerms() map[string][]string { + modAccPerms := make(map[string][]string) + for k, v := range maccPerms { + modAccPerms[k] = v + } + return modAccPerms +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName) + paramsKeeper.Subspace(ibcexported.ModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(bandoracletypes.ModuleName) + + return paramsKeeper +} diff --git a/x/oracle/bandtesting/app/encoding.go b/x/oracle/bandtesting/app/encoding.go new file mode 100644 index 00000000..b52952d8 --- /dev/null +++ b/x/oracle/bandtesting/app/encoding.go @@ -0,0 +1,61 @@ +package band + +import ( + "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + sdkcodec "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + "github.com/cosmos/gogoproto/proto" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +// MakeEncodingConfig creates an EncodingConfig for testing +func MakeEncodingConfig() EncodingConfig { + interfaceRegistry := NewInterfaceRegistry() + marshaler := sdkcodec.NewProtoCodec(interfaceRegistry) + + encodingConfig := EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), + Amino: sdkcodec.NewLegacyAmino(), + } + + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} + +// NewInterfaceRegistry returns a new InterfaceRegistry +func NewInterfaceRegistry() types.InterfaceRegistry { + registry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } + return registry +} \ No newline at end of file diff --git a/x/oracle/bandtesting/app/genesis.go b/x/oracle/bandtesting/app/genesis.go new file mode 100644 index 00000000..4a8ae852 --- /dev/null +++ b/x/oracle/bandtesting/app/genesis.go @@ -0,0 +1,14 @@ +package band + +import ( + "encoding/json" +) + +// GenesisState defines a type alias for the Band genesis application state. +type GenesisState map[string]json.RawMessage + +// NewDefaultGenesisState generates the default state for the application. +func NewDefaultGenesisState() GenesisState { + encCfg := MakeEncodingConfig() + return ModuleBasics.DefaultGenesis(encCfg.Marshaler) +} diff --git a/x/oracle/bandtesting/x/oracle/abci.go b/x/oracle/bandtesting/x/oracle/abci.go new file mode 100644 index 00000000..1eb2640b --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/abci.go @@ -0,0 +1,17 @@ +package oracle + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/keeper" +) + +// handleEndBlock cleans up the state during end block. See comment in the implementation! +func handleEndBlock(ctx sdk.Context, k keeper.Keeper) { + // Loops through all requests to resolve all of them! + requests := k.GetAllRequests(ctx) + for i := range requests { + k.ProcessRequest(ctx, requests[i]) + } + k.DeleteAllRequests(ctx) +} diff --git a/x/oracle/bandtesting/x/oracle/genesis.go b/x/oracle/bandtesting/x/oracle/genesis.go new file mode 100644 index 00000000..d2097585 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/genesis.go @@ -0,0 +1,30 @@ +package oracle + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +// InitGenesis performs genesis initialization for the oracle module. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, data *types.GenesisState) { + k.SetPort(ctx, types.PortID) + // Only try to bind to port if it is not already bound, since we may already own + // port capability from capability InitGenesis + if !k.IsBound(ctx, types.PortID) { + // transfer module binds to the transfer port on InitChain + // and claims the returned capability + err := k.BindPort(ctx, types.PortID) + if err != nil { + panic(fmt.Sprintf("could not claim port capability: %v", err)) + } + } +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return &types.GenesisState{} +} diff --git a/x/oracle/bandtesting/x/oracle/keeper/keeper.go b/x/oracle/bandtesting/x/oracle/keeper/keeper.go new file mode 100644 index 00000000..0339ee0f --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/keeper/keeper.go @@ -0,0 +1,86 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +type Keeper struct { + storeKey storetypes.StoreKey + cdc codec.BinaryCodec + paramstore paramtypes.Subspace + + channelKeeper types.ChannelKeeper + portKeeper types.PortKeeper + scopedKeeper capabilitykeeper.ScopedKeeper +} + +// NewKeeper creates a new oracle Keeper instance. +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + ps paramtypes.Subspace, + channelKeeper types.ChannelKeeper, + portKeeper types.PortKeeper, + scopeKeeper capabilitykeeper.ScopedKeeper, +) Keeper { + return Keeper{ + storeKey: key, + cdc: cdc, + paramstore: ps, + channelKeeper: channelKeeper, + portKeeper: portKeeper, + scopedKeeper: scopeKeeper, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// IsBound checks if the transfer module is already bound to the desired port +func (k Keeper) IsBound(ctx sdk.Context, portID string) bool { + _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) + return ok +} + +// BindPort defines a wrapper function for the ort Keeper's function in +// order to expose it to module's InitGenesis function +func (k Keeper) BindPort(ctx sdk.Context, portID string) error { + capability := k.portKeeper.BindPort(ctx, portID) + return k.ClaimCapability(ctx, capability, host.PortPath(portID)) +} + +// GetPort returns the portID for the transfer module. Used in ExportGenesis +func (k Keeper) GetPort(ctx sdk.Context) string { + store := ctx.KVStore(k.storeKey) + return string(store.Get(types.PortKey)) +} + +// SetPort sets the portID for the transfer module. Used in InitGenesis +func (k Keeper) SetPort(ctx sdk.Context, portID string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.PortKey, []byte(portID)) +} + +// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function +func (k Keeper) AuthenticateCapability(ctx sdk.Context, capability *capabilitytypes.Capability, name string) bool { + return k.scopedKeeper.AuthenticateCapability(ctx, capability, name) +} + +// ClaimCapability allows the transfer module that can claim a capability that IBC module +// passes to it +func (k Keeper) ClaimCapability(ctx sdk.Context, capability *capabilitytypes.Capability, name string) error { + return k.scopedKeeper.ClaimCapability(ctx, capability, name) +} diff --git a/x/oracle/bandtesting/x/oracle/keeper/owasm.go b/x/oracle/bandtesting/x/oracle/keeper/owasm.go new file mode 100644 index 00000000..2d74d9d2 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/keeper/owasm.go @@ -0,0 +1,27 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +// PrepareRequest takes an request specification object, performs the prepare call, and saves +// the request object to store. Also emits events related to the request. +func (k Keeper) PrepareRequest( + ctx sdk.Context, + r types.RequestSpec, + ibcChannel *types.IBCChannel, +) (types.RequestID, error) { + + // Create a request object. Note that RawRequestIDs will be populated after preparation is done. + req := types.NewRequest( + r.GetOracleScriptID(), r.GetCalldata(), nil, r.GetMinCount(), + ctx.BlockHeight(), ctx.BlockTime(), r.GetClientID(), nil, ibcChannel, r.GetExecuteGas(), + ) + + // We now have everything we need to the request, so let's add it to the store. + id := k.AddRequest(ctx, req) + + return id, nil +} diff --git a/x/oracle/bandtesting/x/oracle/keeper/relay.go b/x/oracle/bandtesting/x/oracle/keeper/relay.go new file mode 100644 index 00000000..3d820566 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/keeper/relay.go @@ -0,0 +1,20 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +// OnRecvPacket processes a cross chain oracle request. Data source fees +// are collected from an escrowAddress corresponding to the given requestKey. +func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.OracleRequestPacketData) (types.RequestID, error) { + if err := data.ValidateBasic(); err != nil { + return 0, err + } + + ibcChannel := types.NewIBCChannel(packet.DestinationPort, packet.DestinationChannel) + + return k.PrepareRequest(ctx, &data, &ibcChannel) +} diff --git a/x/oracle/bandtesting/x/oracle/keeper/request.go b/x/oracle/bandtesting/x/oracle/keeper/request.go new file mode 100644 index 00000000..f49f73c2 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/keeper/request.go @@ -0,0 +1,91 @@ +package keeper + +import ( + "fmt" + + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +// GetRequestCount returns the current number of all requests ever exist. +func (k Keeper) GetRequestCount(ctx sdk.Context) uint64 { + bz := ctx.KVStore(k.storeKey).Get(types.RequestCountStoreKey) + return sdk.BigEndianToUint64(bz) +} + +// GetNextRequestID increments and returns the current number of requests. +func (k Keeper) GetNextRequestID(ctx sdk.Context) types.RequestID { + requestNumber := k.GetRequestCount(ctx) + bz := sdk.Uint64ToBigEndian(requestNumber + 1) + ctx.KVStore(k.storeKey).Set(types.RequestCountStoreKey, bz) + return types.RequestID(requestNumber + 1) +} + +// HasRequest checks if the request of this ID exists in the storage. +func (k Keeper) HasRequest(ctx sdk.Context, id types.RequestID) bool { + return ctx.KVStore(k.storeKey).Has(types.RequestStoreKey(id)) +} + +// GetRequest returns the request struct for the given ID or error if not exists. +func (k Keeper) GetRequest(ctx sdk.Context, id types.RequestID) (types.Request, error) { + bz := ctx.KVStore(k.storeKey).Get(types.RequestStoreKey(id)) + if bz == nil { + return types.Request{}, fmt.Errorf("request not found, id: %d", id) + } + var request types.Request + k.cdc.MustUnmarshal(bz, &request) + return request, nil +} + +// MustGetRequest returns the request struct for the given ID. Panics error if not exists. +func (k Keeper) MustGetRequest(ctx sdk.Context, id types.RequestID) types.Request { + request, err := k.GetRequest(ctx, id) + if err != nil { + panic(err) + } + return request +} + +// SetRequest saves the given data request to the store without performing any validation. +func (k Keeper) SetRequest(ctx sdk.Context, id types.RequestID, request types.Request) { + ctx.KVStore(k.storeKey).Set(types.RequestStoreKey(id), k.cdc.MustMarshal(&request)) +} + +// DeleteRequest removes the given data request from the store. +func (k Keeper) DeleteRequest(ctx sdk.Context, id types.RequestID) { + ctx.KVStore(k.storeKey).Delete(types.RequestStoreKey(id)) +} + +// AddRequest attempts to create and save a new request. +func (k Keeper) AddRequest(ctx sdk.Context, req types.Request) types.RequestID { + id := k.GetNextRequestID(ctx) + k.SetRequest(ctx, id, req) + return id +} + +// GetAllRequests returns all requests +func (k Keeper) GetAllRequests(ctx sdk.Context) []types.Request { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.RequestStoreKeyPrefix) + defer iterator.Close() + + requests := []types.Request{} + for ; iterator.Valid(); iterator.Next() { + var request types.Request + k.cdc.MustUnmarshal(iterator.Value(), &request) + requests = append(requests, request) + } + return requests +} + +// DeleteAllRequests delete all requests +func (k Keeper) DeleteAllRequests(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.RequestStoreKeyPrefix) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + store.Delete(iterator.Key()) + } +} diff --git a/x/oracle/bandtesting/x/oracle/keeper/result.go b/x/oracle/bandtesting/x/oracle/keeper/result.go new file mode 100644 index 00000000..239b3cc3 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/keeper/result.go @@ -0,0 +1,61 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" +) + +// ProcessRequest process request. +func (k Keeper) ProcessRequest(ctx sdk.Context, r types.Request) { + if r.IBCChannel != nil { + sourceChannel := r.IBCChannel.ChannelId + sourcePort := r.IBCChannel.PortId + sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel) + if !found { + return + } + destinationPort := sourceChannelEnd.Counterparty.PortId + destinationChannel := sourceChannelEnd.Counterparty.ChannelId + sequence, found := k.channelKeeper.GetNextSequenceSend( + ctx, sourcePort, sourceChannel, + ) + if !found { + return + } + channelCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(sourcePort, sourceChannel)) + if !ok { + return + } + + packetData := types.NewOracleResponsePacketData( + r.ClientID, 1, 0, 1577923380, 1577923405, 1, []byte("beeb"), + ) + + packet := channeltypes.NewPacket( + packetData.GetBytes(), + sequence, + sourcePort, + sourceChannel, + destinationPort, + destinationChannel, + clienttypes.ZeroHeight(), + 1577924005000000000, + ) + + if _, err := k.channelKeeper.SendPacket( + ctx, + channelCap, + packet.SourcePort, + packet.SourceChannel, + packet.TimeoutHeight, + packet.TimeoutTimestamp, + packet.Data, + ); err != nil { + panic(err) + } + } +} diff --git a/x/oracle/bandtesting/x/oracle/module.go b/x/oracle/bandtesting/x/oracle/module.go new file mode 100644 index 00000000..930d0e44 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/module.go @@ -0,0 +1,325 @@ +package oracle + +import ( + "context" + "encoding/json" + "fmt" + "math" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "cosmossdk.io/errors" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/module" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" + +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// AppModuleBasic is Band Oracle's module basic object. +type AppModuleBasic struct{} + +// Name returns this module's name - "oracle" (SDK AppModuleBasic interface). +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the oracle module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// DefaultGenesis returns the default genesis state as raw bytes. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// Validation check of the Genesis +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var gs types.GenesisState + err := cdc.UnmarshalJSON(bz, &gs) + if err != nil { + return err + } + return gs.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the oracle module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serverMux *runtime.ServeMux) { +} + +// GetTxCmd returns cobra CLI command to send txs for this module (SDK AppModuleBasic interface). +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns cobra CLI command to query chain state (SDK AppModuleBasic interface). +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return nil +} + +// AppModule represents the AppModule for this module. +type AppModule struct { + AppModuleBasic + keeper oraclekeeper.Keeper +} + +// NewAppModule creates a new AppModule object. +func NewAppModule(k oraclekeeper.Keeper) AppModule { + return AppModule{ + keeper: k, + } +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + +// RegisterInvariants is a noop function to satisfy SDK AppModule interface. +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} + +// QuerierRoute returns the oracle module's querier route name. +func (AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { +} + +// BeginBlock processes ABCI begin block message for this oracle module (SDK AppModule interface). +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock processes ABCI end block message for this oracle module (SDK AppModule interface). +func (am AppModule) EndBlock(ctx context.Context) error { + handleEndBlock(sdk.UnwrapSDKContext(ctx), am.keeper) + return nil +} + +// InitGenesis performs genesis initialization for the oracle module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, &genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the current state as genesis raw bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(gs) +} + +// ____________________________________________________________________________ + +// ValidateOracleChannelParams does validation of a newly created oracle channel. A oracle +// channel must be UNORDERED, use the correct port (by default 'oracle'), and use the current +// supported version. Only 2^32 channels are allowed to be created. +func ValidateOracleChannelParams( + ctx sdk.Context, + keeper oraclekeeper.Keeper, + order channeltypes.Order, + portID string, + channelID string, +) error { + // NOTE: for escrow address security only 2^32 channels are allowed to be created + // Issue: https://github.com/cosmos/cosmos-sdk/issues/7737 + channelSequence, err := channeltypes.ParseChannelSequence(channelID) + if err != nil { + return err + } + if channelSequence > uint64(math.MaxUint32) { + return fmt.Errorf("channel sequence %d is greater than max allowed oracle channels %d", channelSequence, uint64(math.MaxUint32)) + } + if order != channeltypes.UNORDERED { + return errors.Wrapf(channeltypes.ErrInvalidChannelOrdering, "expected %s channel, got %s ", channeltypes.UNORDERED, order) + } + + // Require portID is the portID oracle module is bound to + boundPort := keeper.GetPort(ctx) + if boundPort != portID { + return errors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + } + + return nil +} + +// OnChanOpenInit implements the IBCModule interface +func (am AppModule) OnChanOpenInit( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + channelCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, +) (string, error) { + if err := ValidateOracleChannelParams(ctx, am.keeper, order, portID, channelID); err != nil { + return "", err + } + + if version != types.Version { + return "", fmt.Errorf("got %s, expected %s", version, types.Version) + } + + // Claim channel capability passed back by IBC module + if err := am.keeper.ClaimCapability(ctx, channelCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + return "", err + } + + return version, nil +} + +// OnChanOpenTry implements the IBCModule interface +func (am AppModule) OnChanOpenTry( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, +) (string, error) { + if err := ValidateOracleChannelParams(ctx, am.keeper, order, portID, channelID); err != nil { + return "", err + } + + if counterpartyVersion != types.Version { + return "", fmt.Errorf("invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) + } + + // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos + // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) + // If module can already authenticate the capability then module already owns it so we don't need to claim + // Otherwise, module does not have channel capability and we must claim it from IBC + if !am.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { + // Only claim channel capability passed back by IBC module if we do not already own it + if err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + return "", err + } + } + + return types.Version, nil +} + +// OnChanOpenAck implements the IBCModule interface +func (am AppModule) OnChanOpenAck( + ctx sdk.Context, + portID, + channelID string, + counterpartyChannelID string, + counterpartyVersion string, +) error { + if counterpartyVersion != types.Version { + return fmt.Errorf("invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) + } + return nil +} + +// OnChanOpenConfirm implements the IBCModule interface +func (am AppModule) OnChanOpenConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + return nil +} + +// OnChanCloseInit implements the IBCModule interface +func (am AppModule) OnChanCloseInit( + ctx sdk.Context, + portID, + channelID string, +) error { + // Disallow user-initiated channel closing for oracle channels + return errors.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") +} + +// OnChanCloseConfirm implements the IBCModule interface +func (am AppModule) OnChanCloseConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + return nil +} + +// OnRecvPacket implements the IBCModule interface +func (am AppModule) OnRecvPacket( + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) exported.Acknowledgement { + + var data types.OracleRequestPacketData + if err := types.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil { + return channeltypes.NewErrorAcknowledgement(fmt.Errorf("cannot unmarshal oracle request packet data: %w", err)) + } + + cacheCtx, writeFn := ctx.CacheContext() + id, err := am.keeper.OnRecvPacket(cacheCtx, packet, data) + + var acknowledgement channeltypes.Acknowledgement + if err != nil { + acknowledgement = channeltypes.NewErrorAcknowledgement(err) + } else { + writeFn() + acknowledgement = channeltypes.NewResultAcknowledgement(types.ModuleCdc.MustMarshalJSON(types.NewOracleRequestPacketAcknowledgement(id))) + } + + // NOTE: acknowledgement will be written synchronously during IBC handler execution. + return acknowledgement +} + +// OnAcknowledgementPacket implements the IBCModule interface +func (am AppModule) OnAcknowledgementPacket( + ctx sdk.Context, + modulePacket channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, +) error { + // Do nothing for out-going packet + return nil +} + +// OnTimeoutPacket implements the IBCModule interface +func (am AppModule) OnTimeoutPacket( + ctx sdk.Context, + modulePacket channeltypes.Packet, + relayer sdk.AccAddress, +) error { + // Do nothing for out-going packet + return nil +} + +func (am AppModule) ConsensusVersion() uint64 { + return 1 +} diff --git a/x/oracle/bandtesting/x/oracle/types/channel.go b/x/oracle/bandtesting/x/oracle/types/channel.go new file mode 100644 index 00000000..33aa45b3 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/channel.go @@ -0,0 +1,9 @@ +package types + +// NewIBCChannel creates a new IBCChannel instance. +func NewIBCChannel(portId, channelId string) IBCChannel { + return IBCChannel{ + PortId: portId, + ChannelId: channelId, + } +} diff --git a/x/oracle/bandtesting/x/oracle/types/codec.go b/x/oracle/bandtesting/x/oracle/types/codec.go new file mode 100644 index 00000000..400740fa --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/codec.go @@ -0,0 +1,39 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers the necessary x/oracle interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + // nolint:all + // cdc.RegisterConcrete(OracleRequestPacketData{}, "oracle/OracleRequestPacketData", nil) + // cdc.RegisterConcrete(OracleResponsePacketData{}, "oracle/OracleResponsePacketData", nil) +} + +// RegisterInterfaces register the oracle module interfaces to protobuf Any. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil)) +} + +var ( + // ModuleCdc references the global x/oracle module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding. + // + // The actual codec used for serialization should be provided to x/oracle and + // defined at the application level. + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + + // AminoCdc is a amino codec created to support amino json compatible msgs. + AminoCdc = codec.NewLegacyAmino() +) + +func init() { + RegisterLegacyAminoCodec(AminoCdc) + cryptocodec.RegisterCrypto(AminoCdc) + AminoCdc.Seal() +} diff --git a/x/oracle/bandtesting/x/oracle/types/constants.go b/x/oracle/bandtesting/x/oracle/types/constants.go new file mode 100644 index 00000000..ed87dec1 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/constants.go @@ -0,0 +1,23 @@ +package types + +// nolint +const ( + DoNotModify = "[do-not-modify]" + + MaxNameLength = 128 + MaxDescriptionLength = 4096 + MaxClientIDLength = 128 + MaxSchemaLength = 512 + MaxURLLength = 128 + + MaxExecutableSize = 8 * 1024 // 8kB + MaxWasmCodeSize = 512 * 1024 // 512kB + MaxCompiledWasmCodeSize = 1 * 1024 * 1024 // 1MB + + MaximumOwasmGas = 8000000 // The same as block gas limit +) + +// nolint +var ( + DoNotModifyBytes = []byte(DoNotModify) +) diff --git a/x/oracle/bandtesting/x/oracle/types/expected_keepers.go b/x/oracle/bandtesting/x/oracle/types/expected_keepers.go new file mode 100644 index 00000000..82907899 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/expected_keepers.go @@ -0,0 +1,28 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" +) + +// ChannelKeeper defines the expected IBC channel keeper +type ChannelKeeper interface { + GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) + GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) + SendPacket( + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, + ) (sequence uint64, err error) +} + +// PortKeeper defines the expected IBC port keeper +type PortKeeper interface { + BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability +} diff --git a/x/oracle/bandtesting/x/oracle/types/genesis.go b/x/oracle/bandtesting/x/oracle/types/genesis.go new file mode 100644 index 00000000..8ecefb48 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/genesis.go @@ -0,0 +1,40 @@ +package types + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" +) + +// NewGenesisState creates a new GenesisState instanc e +func NewGenesisState(params Params, dataSources []DataSource, oracleScripts []OracleScript) *GenesisState { + return &GenesisState{ + Params: params, + DataSources: dataSources, + OracleScripts: oracleScripts, + } +} + +// DefaultGenesisState returns the default oracle genesis state. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + DataSources: []DataSource{}, + OracleScripts: []OracleScript{}, + } +} + +// GetGenesisStateFromAppState returns oracle GenesisState given raw application genesis state. +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return &genesisState +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (g GenesisState) Validate() error { return nil } diff --git a/x/oracle/bandtesting/x/oracle/types/genesis.pb.go b/x/oracle/bandtesting/x/oracle/types/genesis.pb.go new file mode 100644 index 00000000..86c995dd --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/genesis.pb.go @@ -0,0 +1,453 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// GenesisState defines the oracle module's genesis state. +type GenesisState struct { + // Params defines all the paramaters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // DataSources are data sources to be installed during genesis phase + DataSources []DataSource `protobuf:"bytes,2,rep,name=data_sources,json=dataSources,proto3" json:"data_sources"` + // OracleScripts are list of oracle scripts to be installed during genesis + // phase + OracleScripts []OracleScript `protobuf:"bytes,3,rep,name=oracle_scripts,json=oracleScripts,proto3" json:"oracle_scripts"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_14b982a0a6345d1d, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetDataSources() []DataSource { + if m != nil { + return m.DataSources + } + return nil +} + +func (m *GenesisState) GetOracleScripts() []OracleScript { + if m != nil { + return m.OracleScripts + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "oracle.v1.GenesisState") +} + +func init() { proto.RegisterFile("oracle/v1/genesis.proto", fileDescriptor_14b982a0a6345d1d) } + +var fileDescriptor_14b982a0a6345d1d = []byte{ + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x2f, 0x4a, 0x4c, + 0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x48, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, + 0x83, 0x45, 0xf5, 0x41, 0x2c, 0x88, 0x02, 0x29, 0x31, 0x84, 0x4e, 0xa8, 0x52, 0xb0, 0xb8, 0xd2, + 0x51, 0x46, 0x2e, 0x1e, 0x77, 0x88, 0x51, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0xfa, 0x5c, 0x6c, + 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x82, 0x7a, 0x70, + 0xa3, 0xf5, 0x02, 0xc0, 0x12, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x95, 0x09, 0xd9, + 0x71, 0xf1, 0xa4, 0x24, 0x96, 0x24, 0xc6, 0x17, 0xe7, 0x97, 0x16, 0x25, 0xa7, 0x16, 0x4b, 0x30, + 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0x22, 0x69, 0x73, 0x49, 0x2c, 0x49, 0x0c, 0x06, 0xcb, 0x42, + 0xb5, 0x72, 0xa7, 0xc0, 0x45, 0x8a, 0x85, 0x5c, 0xb8, 0xf8, 0x20, 0x4a, 0xe3, 0x8b, 0x93, 0x8b, + 0x32, 0x0b, 0x4a, 0x8a, 0x25, 0x98, 0xc1, 0x26, 0x88, 0x23, 0x99, 0xe0, 0x0f, 0x66, 0x05, 0x83, + 0xe5, 0xa1, 0x66, 0xf0, 0xe6, 0x23, 0x89, 0x15, 0x3b, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, + 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, + 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, + 0x7e, 0x52, 0x62, 0x5e, 0x0a, 0xd8, 0xdf, 0xc9, 0xf9, 0x39, 0xfa, 0xc9, 0x19, 0x89, 0x99, 0x79, + 0xfa, 0x15, 0xd0, 0xf0, 0xd0, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x4b, 0x1b, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x21, 0x1c, 0xeb, 0x6a, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OracleScripts) > 0 { + for iNdEx := len(m.OracleScripts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OracleScripts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.DataSources) > 0 { + for iNdEx := len(m.DataSources) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DataSources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.DataSources) > 0 { + for _, e := range m.DataSources { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.OracleScripts) > 0 { + for _, e := range m.OracleScripts { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataSources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataSources = append(m.DataSources, DataSource{}) + if err := m.DataSources[len(m.DataSources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScripts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OracleScripts = append(m.OracleScripts, OracleScript{}) + if err := m.OracleScripts[len(m.OracleScripts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/bandtesting/x/oracle/types/id.go b/x/oracle/bandtesting/x/oracle/types/id.go new file mode 100644 index 00000000..a9348da2 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/id.go @@ -0,0 +1,13 @@ +package types + +// DataSourceID is the type-safe unique identifier type for data sources. +type DataSourceID uint64 + +// OracleScriptID is the type-safe unique identifier type for oracle scripts. +type OracleScriptID uint64 + +// RequestID is the type-safe unique identifier type for data requests. +type RequestID uint64 + +// ExternalID is the type-safe unique identifier type for raw data requests. +type ExternalID uint64 diff --git a/x/oracle/bandtesting/x/oracle/types/keys.go b/x/oracle/bandtesting/x/oracle/types/keys.go new file mode 100644 index 00000000..b46c3538 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/keys.go @@ -0,0 +1,98 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // ModuleName is the name of the module. + ModuleName = "oracle" + + // Version defines the current version the IBC oracle module supports + Version = "bandchain-1" + + // StoreKey to be used when creating the KVStore. + StoreKey = ModuleName + + // QuerierRoute is the querier route for the oracle module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the oracle module + RouterKey = ModuleName + + // PortID is the default port id that oracle module binds to. + PortID = ModuleName +) + +var ( + // RollingSeedSizeInBytes is the size of rolling block hash for random seed. + RollingSeedSizeInBytes = 32 + // GlobalStoreKeyPrefix is the prefix for global primitive state variables. + GlobalStoreKeyPrefix = []byte{0x00} + // RollingSeedStoreKey is the key that keeps the seed based on the first 8-bit of the most recent 32 block hashes. + RollingSeedStoreKey = append(GlobalStoreKeyPrefix, []byte("RollingSeed")...) + // RequestCountStoreKey is the key that keeps the total request count. + RequestCountStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestCount")...) + // RequestLastExpiredStoreKey is the key that keeps the ID of the last expired request, or 0 if none. + RequestLastExpiredStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestLastExpired")...) + // PendingResolveListStoreKey is the key that keeps the list of pending-resolve requests. + PendingResolveListStoreKey = append(GlobalStoreKeyPrefix, []byte("PendingList")...) + // DataSourceCountStoreKey is the key that keeps the total data source count. + DataSourceCountStoreKey = append(GlobalStoreKeyPrefix, []byte("DataSourceCount")...) + // OracleScriptCountStoreKey is the key that keeps the total oracle sciprt count. + OracleScriptCountStoreKey = append(GlobalStoreKeyPrefix, []byte("OracleScriptCount")...) + + // RequestStoreKeyPrefix is the prefix for request store. + RequestStoreKeyPrefix = []byte{0x01} + // ReportStoreKeyPrefix is the prefix for report store. + ReportStoreKeyPrefix = []byte{0x02} + // DataSourceStoreKeyPrefix is the prefix for data source store. + DataSourceStoreKeyPrefix = []byte{0x03} + // OracleScriptStoreKeyPrefix is the prefix for oracle script store. + OracleScriptStoreKeyPrefix = []byte{0x04} + // ValidatorStatusKeyPrefix is the prefix for validator status store. + ValidatorStatusKeyPrefix = []byte{0x05} + // ResultStoreKeyPrefix is the prefix for request result store. + ResultStoreKeyPrefix = []byte{0xff} + + // PortKey defines the key to store the port ID in store + PortKey = []byte{0xf0} +) + +// RequestStoreKey returns the key to retrieve a specific request from the store. +func RequestStoreKey(requestID RequestID) []byte { + return append(RequestStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// ReportStoreKey returns the key to retrieve all data reports for a request. +func ReportStoreKey(requestID RequestID) []byte { + return append(ReportStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// DataSourceStoreKey returns the key to retrieve a specific data source from the store. +func DataSourceStoreKey(dataSourceID DataSourceID) []byte { + return append(DataSourceStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(dataSourceID))...) +} + +// OracleScriptStoreKey returns the key to retrieve a specific oracle script from the store. +func OracleScriptStoreKey(oracleScriptID OracleScriptID) []byte { + return append(OracleScriptStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(oracleScriptID))...) +} + +// ValidatorStatusStoreKey returns the key to a validator's status. +func ValidatorStatusStoreKey(v sdk.ValAddress) []byte { + return append(ValidatorStatusKeyPrefix, v.Bytes()...) +} + +// ResultStoreKey returns the key to a request result in the store. +func ResultStoreKey(requestID RequestID) []byte { + return append(ResultStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(requestID))...) +} + +// ReportsOfValidatorPrefixKey returns the prefix key to get all reports for a request from a validator. +func ReportsOfValidatorPrefixKey(reqID RequestID, val sdk.ValAddress) []byte { + buf := ReportStoreKeyPrefix + buf = append(buf, sdk.Uint64ToBigEndian(uint64(reqID))...) + buf = append(buf, val.Bytes()...) + return buf +} diff --git a/x/oracle/bandtesting/x/oracle/types/oracle.pb.go b/x/oracle/bandtesting/x/oracle/types/oracle.pb.go new file mode 100644 index 00000000..2b50fe4b --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/oracle.pb.go @@ -0,0 +1,6774 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/v1/oracle.proto + +package types + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_gogo_protobuf_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// ResolveStatus encodes the status of an oracle request. +type ResolveStatus int32 + +const ( + // Open - the request is not yet resolved. + RESOLVE_STATUS_OPEN ResolveStatus = 0 + // Success - the request has been resolved successfully with no errors. + RESOLVE_STATUS_SUCCESS ResolveStatus = 1 + // Failure - an error occured during the request's resolve call. + RESOLVE_STATUS_FAILURE ResolveStatus = 2 + // Expired - the request does not get enough reports from validator within the + // timeframe. + RESOLVE_STATUS_EXPIRED ResolveStatus = 3 +) + +var ResolveStatus_name = map[int32]string{ + 0: "RESOLVE_STATUS_OPEN_UNSPECIFIED", + 1: "RESOLVE_STATUS_SUCCESS", + 2: "RESOLVE_STATUS_FAILURE", + 3: "RESOLVE_STATUS_EXPIRED", +} + +var ResolveStatus_value = map[string]int32{ + "RESOLVE_STATUS_OPEN_UNSPECIFIED": 0, + "RESOLVE_STATUS_SUCCESS": 1, + "RESOLVE_STATUS_FAILURE": 2, + "RESOLVE_STATUS_EXPIRED": 3, +} + +func (x ResolveStatus) String() string { + return proto.EnumName(ResolveStatus_name, int32(x)) +} + +func (ResolveStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{0} +} + +// DataSource is the data structure for storing data sources in the storage. +type DataSource struct { + // Owner is an address of the account who own the data source + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // Name is data source name used for display + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Description is data source description used for display + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // Filename is string of file name used as reference for locating + // data source file stored in bandchain nodes + Filename string `protobuf:"bytes,4,opt,name=filename,proto3" json:"filename,omitempty"` + // Treasury is the account address who receive data source fee from requester. + Treasury string `protobuf:"bytes,5,opt,name=treasury,proto3" json:"treasury,omitempty"` + // Fee is the data source fee per ask_count that data provider will receive + // from requester. + Fee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=fee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee"` +} + +func (m *DataSource) Reset() { *m = DataSource{} } +func (m *DataSource) String() string { return proto.CompactTextString(m) } +func (*DataSource) ProtoMessage() {} +func (*DataSource) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{0} +} +func (m *DataSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataSource.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 *DataSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataSource.Merge(m, src) +} +func (m *DataSource) XXX_Size() int { + return m.Size() +} +func (m *DataSource) XXX_DiscardUnknown() { + xxx_messageInfo_DataSource.DiscardUnknown(m) +} + +var xxx_messageInfo_DataSource proto.InternalMessageInfo + +func (m *DataSource) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *DataSource) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *DataSource) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *DataSource) GetFilename() string { + if m != nil { + return m.Filename + } + return "" +} + +func (m *DataSource) GetTreasury() string { + if m != nil { + return m.Treasury + } + return "" +} + +func (m *DataSource) GetFee() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Fee + } + return nil +} + +// OracleScript is the data structure for storing oracle scripts in the storage. +type OracleScript struct { + // Owner is an address of the account who own the oracle script + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // Name is oracle script name used for display + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Description is oracle script description used for display + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // Filename is string of file name used as reference for locating + // compiled oracle script WASM file stored in bandchain nodes + Filename string `protobuf:"bytes,4,opt,name=filename,proto3" json:"filename,omitempty"` + // Schema is the schema of the oracle script input/output + // which is formatted in OBI format e.g. + // "{symbol:string,multiplier:u64}/{px:u64}" + Schema string `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"` + // SourceCodeURL is the URL of oracle script's source code. + // It is recommendded to store source code on IPFS and get its URL to preserve + // decentralization. + SourceCodeURL string `protobuf:"bytes,6,opt,name=source_code_url,json=sourceCodeUrl,proto3" json:"source_code_url,omitempty"` +} + +func (m *OracleScript) Reset() { *m = OracleScript{} } +func (m *OracleScript) String() string { return proto.CompactTextString(m) } +func (*OracleScript) ProtoMessage() {} +func (*OracleScript) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{1} +} +func (m *OracleScript) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleScript) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleScript.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 *OracleScript) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleScript.Merge(m, src) +} +func (m *OracleScript) XXX_Size() int { + return m.Size() +} +func (m *OracleScript) XXX_DiscardUnknown() { + xxx_messageInfo_OracleScript.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleScript proto.InternalMessageInfo + +func (m *OracleScript) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *OracleScript) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *OracleScript) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *OracleScript) GetFilename() string { + if m != nil { + return m.Filename + } + return "" +} + +func (m *OracleScript) GetSchema() string { + if m != nil { + return m.Schema + } + return "" +} + +func (m *OracleScript) GetSourceCodeURL() string { + if m != nil { + return m.SourceCodeURL + } + return "" +} + +// RawRequest is the data structure for storing raw requests in the storage. +type RawRequest struct { + // ExternalID is an ID of the raw request + ExternalID ExternalID `protobuf:"varint,1,opt,name=external_id,json=externalId,proto3,casttype=ExternalID" json:"external_id,omitempty"` + // DataSourceID is an ID of data source script that relates to the raw request + DataSourceID DataSourceID `protobuf:"varint,2,opt,name=data_source_id,json=dataSourceId,proto3,casttype=DataSourceID" json:"data_source_id,omitempty"` + // Calldata is the data used as argument params for executing data source + // script + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` +} + +func (m *RawRequest) Reset() { *m = RawRequest{} } +func (m *RawRequest) String() string { return proto.CompactTextString(m) } +func (*RawRequest) ProtoMessage() {} +func (*RawRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{2} +} +func (m *RawRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawRequest.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 *RawRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawRequest.Merge(m, src) +} +func (m *RawRequest) XXX_Size() int { + return m.Size() +} +func (m *RawRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RawRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_RawRequest proto.InternalMessageInfo + +func (m *RawRequest) GetExternalID() ExternalID { + if m != nil { + return m.ExternalID + } + return 0 +} + +func (m *RawRequest) GetDataSourceID() DataSourceID { + if m != nil { + return m.DataSourceID + } + return 0 +} + +func (m *RawRequest) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +// RawRequest is the data structure for storing raw reporter in the storage. +type RawReport struct { + // ExternalID is an ID of the raw request + ExternalID ExternalID `protobuf:"varint,1,opt,name=external_id,json=externalId,proto3,casttype=ExternalID" json:"external_id,omitempty"` + // ExitCode is status code provided by validators to specify error, if any. + // Exit code is usually filled by the exit code returned from execution of + // specified data source script. With code 0 means there is no error. + ExitCode uint32 `protobuf:"varint,2,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` + // Data is raw result provided by validators. + // It is usually filled by the result from execution of specified data source + // script. + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *RawReport) Reset() { *m = RawReport{} } +func (m *RawReport) String() string { return proto.CompactTextString(m) } +func (*RawReport) ProtoMessage() {} +func (*RawReport) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{3} +} +func (m *RawReport) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawReport.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 *RawReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawReport.Merge(m, src) +} +func (m *RawReport) XXX_Size() int { + return m.Size() +} +func (m *RawReport) XXX_DiscardUnknown() { + xxx_messageInfo_RawReport.DiscardUnknown(m) +} + +var xxx_messageInfo_RawReport proto.InternalMessageInfo + +func (m *RawReport) GetExternalID() ExternalID { + if m != nil { + return m.ExternalID + } + return 0 +} + +func (m *RawReport) GetExitCode() uint32 { + if m != nil { + return m.ExitCode + } + return 0 +} + +func (m *RawReport) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// Request is the data structure for storing requests in the storage. +type Request struct { + // OracleScriptID is ID of an oracle script + OracleScriptID OracleScriptID `protobuf:"varint,1,opt,name=oracle_script_id,json=oracleScriptId,proto3,casttype=OracleScriptID" json:"oracle_script_id,omitempty"` + // Calldata is the data used as argument params for the oracle script + Calldata []byte `protobuf:"bytes,2,opt,name=calldata,proto3" json:"calldata,omitempty"` + // RequestedValidators is a list of validator addresses that are assigned for + // fulfilling the request + RequestedValidators []string `protobuf:"bytes,3,rep,name=requested_validators,json=requestedValidators,proto3" json:"requested_validators,omitempty"` + // MinCount is minimum number of validators required for fulfilling the + // request + MinCount uint64 `protobuf:"varint,4,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // RequestHeight is block height that the request has been created + RequestHeight int64 `protobuf:"varint,5,opt,name=request_height,json=requestHeight,proto3" json:"request_height,omitempty"` + // RequestTime is timestamp of the chain's block which contains the request + RequestTime int64 `protobuf:"varint,6,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ClientID is arbitrary id provided by requester. + // It is used by client-side for referencing the request + ClientID string `protobuf:"bytes,7,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // RawRequests is a list of raw requests specified by execution of oracle + // script + RawRequests []RawRequest `protobuf:"bytes,8,rep,name=raw_requests,json=rawRequests,proto3" json:"raw_requests"` + // IBCChannel is an IBC channel info of the other chain, which contains a + // channel and a port to allow bandchain connect to that chain. This field + // allows other chain be able to request data from bandchain via IBC. + IBCChannel *IBCChannel `protobuf:"bytes,9,opt,name=ibc_channel,json=ibcChannel,proto3" json:"ibc_channel,omitempty"` + // ExecuteGas is amount of gas to reserve for executing + ExecuteGas uint64 `protobuf:"varint,10,opt,name=execute_gas,json=executeGas,proto3" json:"execute_gas,omitempty"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{4} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Request.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 *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) +} +func (m *Request) XXX_Size() int { + return m.Size() +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +func (m *Request) GetOracleScriptID() OracleScriptID { + if m != nil { + return m.OracleScriptID + } + return 0 +} + +func (m *Request) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +func (m *Request) GetRequestedValidators() []string { + if m != nil { + return m.RequestedValidators + } + return nil +} + +func (m *Request) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *Request) GetRequestHeight() int64 { + if m != nil { + return m.RequestHeight + } + return 0 +} + +func (m *Request) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *Request) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *Request) GetRawRequests() []RawRequest { + if m != nil { + return m.RawRequests + } + return nil +} + +func (m *Request) GetIBCChannel() *IBCChannel { + if m != nil { + return m.IBCChannel + } + return nil +} + +func (m *Request) GetExecuteGas() uint64 { + if m != nil { + return m.ExecuteGas + } + return 0 +} + +// Report is the data structure for storing reports in the storage. +type Report struct { + // Validator is a validator address who submit the report + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + // InBeforeResolve indicates whether the report is submitted before the + // request resolved + InBeforeResolve bool `protobuf:"varint,2,opt,name=in_before_resolve,json=inBeforeResolve,proto3" json:"in_before_resolve,omitempty"` + // RawReports is list of raw reports provided by the validator. + // Each raw report has different external ID + RawReports []RawReport `protobuf:"bytes,3,rep,name=raw_reports,json=rawReports,proto3" json:"raw_reports"` +} + +func (m *Report) Reset() { *m = Report{} } +func (m *Report) String() string { return proto.CompactTextString(m) } +func (*Report) ProtoMessage() {} +func (*Report) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{5} +} +func (m *Report) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Report) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Report.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 *Report) XXX_Merge(src proto.Message) { + xxx_messageInfo_Report.Merge(m, src) +} +func (m *Report) XXX_Size() int { + return m.Size() +} +func (m *Report) XXX_DiscardUnknown() { + xxx_messageInfo_Report.DiscardUnknown(m) +} + +var xxx_messageInfo_Report proto.InternalMessageInfo + +func (m *Report) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *Report) GetInBeforeResolve() bool { + if m != nil { + return m.InBeforeResolve + } + return false +} + +func (m *Report) GetRawReports() []RawReport { + if m != nil { + return m.RawReports + } + return nil +} + +// OracleRequestPacketData encodes an oracle request sent from other blockchains +// to BandChain. +type OracleRequestPacketData struct { + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptID OracleScriptID `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3,casttype=OracleScriptID" json:"oracle_script_id,omitempty"` + // Calldata is the OBI-encoded calldata bytes available for oracle executor to + // read. + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + FeeLimit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=fee_limit,json=feeLimit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee_limit"` + // PrepareGas is amount of gas to pay to prepare raw requests + PrepareGas uint64 `protobuf:"varint,7,opt,name=prepare_gas,json=prepareGas,proto3" json:"prepare_gas,omitempty"` + // ExecuteGas is amount of gas to reserve for executing + ExecuteGas uint64 `protobuf:"varint,8,opt,name=execute_gas,json=executeGas,proto3" json:"execute_gas,omitempty"` +} + +func (m *OracleRequestPacketData) Reset() { *m = OracleRequestPacketData{} } +func (m *OracleRequestPacketData) String() string { return proto.CompactTextString(m) } +func (*OracleRequestPacketData) ProtoMessage() {} +func (*OracleRequestPacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{6} +} +func (m *OracleRequestPacketData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleRequestPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleRequestPacketData.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 *OracleRequestPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleRequestPacketData.Merge(m, src) +} +func (m *OracleRequestPacketData) XXX_Size() int { + return m.Size() +} +func (m *OracleRequestPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_OracleRequestPacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleRequestPacketData proto.InternalMessageInfo + +func (m *OracleRequestPacketData) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *OracleRequestPacketData) GetOracleScriptID() OracleScriptID { + if m != nil { + return m.OracleScriptID + } + return 0 +} + +func (m *OracleRequestPacketData) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +func (m *OracleRequestPacketData) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *OracleRequestPacketData) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *OracleRequestPacketData) GetFeeLimit() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeeLimit + } + return nil +} + +func (m *OracleRequestPacketData) GetPrepareGas() uint64 { + if m != nil { + return m.PrepareGas + } + return 0 +} + +func (m *OracleRequestPacketData) GetExecuteGas() uint64 { + if m != nil { + return m.ExecuteGas + } + return 0 +} + +// OracleRequestPacketAcknowledgement encodes an oracle request acknowledgement +// send back to requester chain. +type OracleRequestPacketAcknowledgement struct { + // RequestID is BandChain's unique identifier for this oracle request. + RequestID RequestID `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` +} + +func (m *OracleRequestPacketAcknowledgement) Reset() { *m = OracleRequestPacketAcknowledgement{} } +func (m *OracleRequestPacketAcknowledgement) String() string { return proto.CompactTextString(m) } +func (*OracleRequestPacketAcknowledgement) ProtoMessage() {} +func (*OracleRequestPacketAcknowledgement) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{7} +} +func (m *OracleRequestPacketAcknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleRequestPacketAcknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleRequestPacketAcknowledgement.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 *OracleRequestPacketAcknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleRequestPacketAcknowledgement.Merge(m, src) +} +func (m *OracleRequestPacketAcknowledgement) XXX_Size() int { + return m.Size() +} +func (m *OracleRequestPacketAcknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_OracleRequestPacketAcknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleRequestPacketAcknowledgement proto.InternalMessageInfo + +func (m *OracleRequestPacketAcknowledgement) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +// OracleResponsePacketData encodes an oracle response from BandChain to the +// requester. +type OracleResponsePacketData struct { + // ClientID is the unique identifier matched with that of the oracle request + // packet. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // RequestID is BandChain's unique identifier for this oracle request. + RequestID RequestID `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + AnsCount uint64 `protobuf:"varint,3,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + RequestTime int64 `protobuf:"varint,4,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + ResolveTime int64 `protobuf:"varint,5,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.ResolveStatus" json:"resolve_status,omitempty"` + // Result is the final aggregated value encoded in OBI format. Only available + // if status if OK. + Result []byte `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *OracleResponsePacketData) Reset() { *m = OracleResponsePacketData{} } +func (m *OracleResponsePacketData) String() string { return proto.CompactTextString(m) } +func (*OracleResponsePacketData) ProtoMessage() {} +func (*OracleResponsePacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{8} +} +func (m *OracleResponsePacketData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleResponsePacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleResponsePacketData.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 *OracleResponsePacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleResponsePacketData.Merge(m, src) +} +func (m *OracleResponsePacketData) XXX_Size() int { + return m.Size() +} +func (m *OracleResponsePacketData) XXX_DiscardUnknown() { + xxx_messageInfo_OracleResponsePacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleResponsePacketData proto.InternalMessageInfo + +func (m *OracleResponsePacketData) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *OracleResponsePacketData) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *OracleResponsePacketData) GetAnsCount() uint64 { + if m != nil { + return m.AnsCount + } + return 0 +} + +func (m *OracleResponsePacketData) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *OracleResponsePacketData) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *OracleResponsePacketData) GetResolveStatus() ResolveStatus { + if m != nil { + return m.ResolveStatus + } + return RESOLVE_STATUS_OPEN +} + +func (m *OracleResponsePacketData) GetResult() []byte { + if m != nil { + return m.Result + } + return nil +} + +// Result encodes a result of request and store in chain +type Result struct { + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptID OracleScriptID `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3,casttype=OracleScriptID" json:"oracle_script_id,omitempty"` + // Calldata is the calldata bytes available for oracle executor to read. + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // RequestID is BandChain's unique identifier for this oracle request. + RequestID RequestID `protobuf:"varint,6,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + AnsCount uint64 `protobuf:"varint,7,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + RequestTime int64 `protobuf:"varint,8,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + ResolveTime int64 `protobuf:"varint,9,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus ResolveStatus `protobuf:"varint,10,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.ResolveStatus" json:"resolve_status,omitempty"` + // Result is the final aggregated value only available if status if OK. + Result []byte `protobuf:"bytes,11,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *Result) Reset() { *m = Result{} } +func (m *Result) String() string { return proto.CompactTextString(m) } +func (*Result) ProtoMessage() {} +func (*Result) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{9} +} +func (m *Result) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_Result.Merge(m, src) +} +func (m *Result) XXX_Size() int { + return m.Size() +} +func (m *Result) XXX_DiscardUnknown() { + xxx_messageInfo_Result.DiscardUnknown(m) +} + +var xxx_messageInfo_Result proto.InternalMessageInfo + +func (m *Result) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *Result) GetOracleScriptID() OracleScriptID { + if m != nil { + return m.OracleScriptID + } + return 0 +} + +func (m *Result) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +func (m *Result) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *Result) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *Result) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *Result) GetAnsCount() uint64 { + if m != nil { + return m.AnsCount + } + return 0 +} + +func (m *Result) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *Result) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *Result) GetResolveStatus() ResolveStatus { + if m != nil { + return m.ResolveStatus + } + return RESOLVE_STATUS_OPEN +} + +func (m *Result) GetResult() []byte { + if m != nil { + return m.Result + } + return nil +} + +// ValidatorStatus maintains whether a validator is an active oracle provider. +type ValidatorStatus struct { + // IsActive is a boolean indicating active status of validator. + // The validator will be deactivated when they are unable to send reports + // to fulfill oracle request before the request expired. + IsActive bool `protobuf:"varint,1,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` + // Since is a block timestamp when validator has been activated/deactivated + Since time.Time `protobuf:"bytes,2,opt,name=since,proto3,stdtime" json:"since"` +} + +func (m *ValidatorStatus) Reset() { *m = ValidatorStatus{} } +func (m *ValidatorStatus) String() string { return proto.CompactTextString(m) } +func (*ValidatorStatus) ProtoMessage() {} +func (*ValidatorStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{10} +} +func (m *ValidatorStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorStatus.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 *ValidatorStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorStatus.Merge(m, src) +} +func (m *ValidatorStatus) XXX_Size() int { + return m.Size() +} +func (m *ValidatorStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorStatus proto.InternalMessageInfo + +func (m *ValidatorStatus) GetIsActive() bool { + if m != nil { + return m.IsActive + } + return false +} + +func (m *ValidatorStatus) GetSince() time.Time { + if m != nil { + return m.Since + } + return time.Time{} +} + +// ActiveValidator is information of currently active validator +type ActiveValidator struct { + // Address is a validator address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Power is an amount of token that the validator is holding + Power uint64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` +} + +func (m *ActiveValidator) Reset() { *m = ActiveValidator{} } +func (m *ActiveValidator) String() string { return proto.CompactTextString(m) } +func (*ActiveValidator) ProtoMessage() {} +func (*ActiveValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{11} +} +func (m *ActiveValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ActiveValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ActiveValidator.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 *ActiveValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_ActiveValidator.Merge(m, src) +} +func (m *ActiveValidator) XXX_Size() int { + return m.Size() +} +func (m *ActiveValidator) XXX_DiscardUnknown() { + xxx_messageInfo_ActiveValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_ActiveValidator proto.InternalMessageInfo + +func (m *ActiveValidator) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *ActiveValidator) GetPower() uint64 { + if m != nil { + return m.Power + } + return 0 +} + +// Params is the data structure that keeps the parameters of the oracle module. +type Params struct { + // MaxRawRequestCount is the maximum number of data source raw requests a + // request can make. + MaxRawRequestCount uint64 `protobuf:"varint,1,opt,name=max_raw_request_count,json=maxRawRequestCount,proto3" json:"max_raw_request_count,omitempty"` + // MaxAskCount is the maximum number of validators a request can target. + MaxAskCount uint64 `protobuf:"varint,2,opt,name=max_ask_count,json=maxAskCount,proto3" json:"max_ask_count,omitempty"` + // MaxCalldataSize is the maximum size limit of calldata (bytes) in a request. + MaxCalldataSize uint64 `protobuf:"varint,3,opt,name=max_calldata_size,json=maxCalldataSize,proto3" json:"max_calldata_size,omitempty"` + // MaxReportDataSize is the maximum size limit of report data (bytes) in a + // report. + MaxReportDataSize uint64 `protobuf:"varint,4,opt,name=max_report_data_size,json=maxReportDataSize,proto3" json:"max_report_data_size,omitempty"` + // ExpirationBlockCount is the number of blocks a request stays valid before + // it gets expired due to insufficient reports. + ExpirationBlockCount uint64 `protobuf:"varint,5,opt,name=expiration_block_count,json=expirationBlockCount,proto3" json:"expiration_block_count,omitempty"` + // BaseOwasmGas is the base amount of Cosmos-SDK gas charged for owasm + // execution. + BaseOwasmGas uint64 `protobuf:"varint,6,opt,name=base_owasm_gas,json=baseOwasmGas,proto3" json:"base_owasm_gas,omitempty"` + // PerValidatorRequestGas is the amount of Cosmos-SDK gas charged per + // requested validator. + PerValidatorRequestGas uint64 `protobuf:"varint,7,opt,name=per_validator_request_gas,json=perValidatorRequestGas,proto3" json:"per_validator_request_gas,omitempty"` + // SamplingTryCount the number of validator sampling tries to pick the highest + // voting power subset of validators to perform an oracle task. + SamplingTryCount uint64 `protobuf:"varint,8,opt,name=sampling_try_count,json=samplingTryCount,proto3" json:"sampling_try_count,omitempty"` + // OracleRewardPercentage is the percentage of block rewards allocated to + // active oracle validators. + OracleRewardPercentage uint64 `protobuf:"varint,9,opt,name=oracle_reward_percentage,json=oracleRewardPercentage,proto3" json:"oracle_reward_percentage,omitempty"` + // InactivePenaltyDuration is the duration period where a validator cannot + // activate back after missing an oracle report. + InactivePenaltyDuration uint64 `protobuf:"varint,10,opt,name=inactive_penalty_duration,json=inactivePenaltyDuration,proto3" json:"inactive_penalty_duration,omitempty"` + // IBCRequestEnabled is a flag indicating whether sending oracle request via + // IBC is allowed + IBCRequestEnabled bool `protobuf:"varint,11,opt,name=ibc_request_enabled,json=ibcRequestEnabled,proto3" json:"ibc_request_enabled,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{12} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMaxRawRequestCount() uint64 { + if m != nil { + return m.MaxRawRequestCount + } + return 0 +} + +func (m *Params) GetMaxAskCount() uint64 { + if m != nil { + return m.MaxAskCount + } + return 0 +} + +func (m *Params) GetMaxCalldataSize() uint64 { + if m != nil { + return m.MaxCalldataSize + } + return 0 +} + +func (m *Params) GetMaxReportDataSize() uint64 { + if m != nil { + return m.MaxReportDataSize + } + return 0 +} + +func (m *Params) GetExpirationBlockCount() uint64 { + if m != nil { + return m.ExpirationBlockCount + } + return 0 +} + +func (m *Params) GetBaseOwasmGas() uint64 { + if m != nil { + return m.BaseOwasmGas + } + return 0 +} + +func (m *Params) GetPerValidatorRequestGas() uint64 { + if m != nil { + return m.PerValidatorRequestGas + } + return 0 +} + +func (m *Params) GetSamplingTryCount() uint64 { + if m != nil { + return m.SamplingTryCount + } + return 0 +} + +func (m *Params) GetOracleRewardPercentage() uint64 { + if m != nil { + return m.OracleRewardPercentage + } + return 0 +} + +func (m *Params) GetInactivePenaltyDuration() uint64 { + if m != nil { + return m.InactivePenaltyDuration + } + return 0 +} + +func (m *Params) GetIBCRequestEnabled() bool { + if m != nil { + return m.IBCRequestEnabled + } + return false +} + +// PendingResolveList is a list of requests that are waiting to be resolved +type PendingResolveList struct { + // RequestIDs is a list of request IDs that are waiting to be resolved + RequestIds []uint64 `protobuf:"varint,1,rep,packed,name=request_ids,json=requestIds,proto3" json:"request_ids,omitempty"` +} + +func (m *PendingResolveList) Reset() { *m = PendingResolveList{} } +func (m *PendingResolveList) String() string { return proto.CompactTextString(m) } +func (*PendingResolveList) ProtoMessage() {} +func (*PendingResolveList) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{13} +} +func (m *PendingResolveList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingResolveList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingResolveList.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 *PendingResolveList) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingResolveList.Merge(m, src) +} +func (m *PendingResolveList) XXX_Size() int { + return m.Size() +} +func (m *PendingResolveList) XXX_DiscardUnknown() { + xxx_messageInfo_PendingResolveList.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingResolveList proto.InternalMessageInfo + +func (m *PendingResolveList) GetRequestIds() []uint64 { + if m != nil { + return m.RequestIds + } + return nil +} + +// IBCChannel is information of IBC protocol to allow communicating with other +// chain +type IBCChannel struct { + // PortID is port ID used for sending response packet when request is + // resolved. + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + // ChannelID is channel ID used for sending response packet when request is + // resolved. + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` +} + +func (m *IBCChannel) Reset() { *m = IBCChannel{} } +func (m *IBCChannel) String() string { return proto.CompactTextString(m) } +func (*IBCChannel) ProtoMessage() {} +func (*IBCChannel) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{14} +} +func (m *IBCChannel) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCChannel.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 *IBCChannel) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCChannel.Merge(m, src) +} +func (m *IBCChannel) XXX_Size() int { + return m.Size() +} +func (m *IBCChannel) XXX_DiscardUnknown() { + xxx_messageInfo_IBCChannel.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCChannel proto.InternalMessageInfo + +func (m *IBCChannel) GetPortId() string { + if m != nil { + return m.PortId + } + return "" +} + +func (m *IBCChannel) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +// RequestVerification is a message that is constructed and signed by a reporter +// to be used as a part of verification of oracle request. +type RequestVerification struct { + // ChainID is the ID of targeted chain + ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // Validator is an validator address + Validator string `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"` + // RequestID is the targeted request ID + RequestID RequestID `protobuf:"varint,3,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` + // ExternalID is the oracle's external ID of data source + ExternalID ExternalID `protobuf:"varint,4,opt,name=external_id,json=externalId,proto3,casttype=ExternalID" json:"external_id,omitempty"` +} + +func (m *RequestVerification) Reset() { *m = RequestVerification{} } +func (m *RequestVerification) String() string { return proto.CompactTextString(m) } +func (*RequestVerification) ProtoMessage() {} +func (*RequestVerification) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{15} +} +func (m *RequestVerification) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestVerification.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 *RequestVerification) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerification.Merge(m, src) +} +func (m *RequestVerification) XXX_Size() int { + return m.Size() +} +func (m *RequestVerification) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerification.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerification proto.InternalMessageInfo + +func (m *RequestVerification) GetChainID() string { + if m != nil { + return m.ChainID + } + return "" +} + +func (m *RequestVerification) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *RequestVerification) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *RequestVerification) GetExternalID() ExternalID { + if m != nil { + return m.ExternalID + } + return 0 +} + +// PriceResult is a result from standard price reference +type PriceResult struct { + // Symbol is unit of data indicating what the data is. It is price currencies + // for this case. + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + // Multiplier is a number used for left-shifting value to eliminate decimal + // digits + Multiplier uint64 `protobuf:"varint,2,opt,name=multiplier,proto3" json:"multiplier,omitempty"` + // Px is the actual data, which is rate number multiplied by the multiplier. + Px uint64 `protobuf:"varint,3,opt,name=px,proto3" json:"px,omitempty"` + // RequestID is oracle request ID that contains this price + RequestID RequestID `protobuf:"varint,4,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` + // ResolveTime is epoch timestamp indicating the time when the request had + // been resolved + ResolveTime int64 `protobuf:"varint,5,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` +} + +func (m *PriceResult) Reset() { *m = PriceResult{} } +func (m *PriceResult) String() string { return proto.CompactTextString(m) } +func (*PriceResult) ProtoMessage() {} +func (*PriceResult) Descriptor() ([]byte, []int) { + return fileDescriptor_652b57db11528d07, []int{16} +} +func (m *PriceResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PriceResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PriceResult.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 *PriceResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_PriceResult.Merge(m, src) +} +func (m *PriceResult) XXX_Size() int { + return m.Size() +} +func (m *PriceResult) XXX_DiscardUnknown() { + xxx_messageInfo_PriceResult.DiscardUnknown(m) +} + +var xxx_messageInfo_PriceResult proto.InternalMessageInfo + +func (m *PriceResult) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +func (m *PriceResult) GetMultiplier() uint64 { + if m != nil { + return m.Multiplier + } + return 0 +} + +func (m *PriceResult) GetPx() uint64 { + if m != nil { + return m.Px + } + return 0 +} + +func (m *PriceResult) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *PriceResult) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func init() { + // proto.RegisterEnum("oracle.v1.ResolveStatus", ResolveStatus_name, ResolveStatus_value) + proto.RegisterType((*DataSource)(nil), "oracle.v1.DataSource") + proto.RegisterType((*OracleScript)(nil), "oracle.v1.OracleScript") + proto.RegisterType((*RawRequest)(nil), "oracle.v1.RawRequest") + proto.RegisterType((*RawReport)(nil), "oracle.v1.RawReport") + proto.RegisterType((*Request)(nil), "oracle.v1.Request") + proto.RegisterType((*Report)(nil), "oracle.v1.Report") + // proto.RegisterType((*OracleRequestPacketData)(nil), "oracle.v1.OracleRequestPacketData") + // proto.RegisterType((*OracleRequestPacketAcknowledgement)(nil), "oracle.v1.OracleRequestPacketAcknowledgement") + // proto.RegisterType((*OracleResponsePacketData)(nil), "oracle.v1.OracleResponsePacketData") + proto.RegisterType((*Result)(nil), "oracle.v1.Result") + proto.RegisterType((*ValidatorStatus)(nil), "oracle.v1.ValidatorStatus") + proto.RegisterType((*ActiveValidator)(nil), "oracle.v1.ActiveValidator") + proto.RegisterType((*Params)(nil), "oracle.v1.Params") + proto.RegisterType((*PendingResolveList)(nil), "oracle.v1.PendingResolveList") + proto.RegisterType((*IBCChannel)(nil), "oracle.v1.IBCChannel") + proto.RegisterType((*RequestVerification)(nil), "oracle.v1.RequestVerification") + proto.RegisterType((*PriceResult)(nil), "oracle.v1.PriceResult") +} + +func init() { proto.RegisterFile("oracle/v1/oracle.proto", fileDescriptor_652b57db11528d07) } + +var fileDescriptor_652b57db11528d07 = []byte{ + // 1740 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0xdb, 0x4e, 0x62, 0x3f, 0x3b, 0x5f, 0x35, 0x99, 0x8c, 0xc7, 0xbb, 0xd8, 0x21, 0x5a, + 0xd0, 0x30, 0x5a, 0x6c, 0x32, 0x20, 0xc4, 0xcc, 0xf2, 0xa1, 0xd8, 0x71, 0x16, 0xa3, 0x68, 0xc6, + 0x2a, 0x27, 0x23, 0x84, 0x84, 0x5a, 0xe5, 0xee, 0x8a, 0x53, 0x4a, 0x7f, 0x51, 0xd5, 0x4e, 0x9c, + 0xbd, 0x71, 0x43, 0x7b, 0xda, 0x0b, 0x12, 0x07, 0x56, 0x5a, 0x89, 0x1b, 0x57, 0xc4, 0x3f, 0xc0, + 0x69, 0x6e, 0xec, 0x09, 0x21, 0x21, 0x79, 0x91, 0xe7, 0x02, 0x7f, 0x00, 0x17, 0xb8, 0xa0, 0xfa, + 0x68, 0xb7, 0x6d, 0x32, 0x0c, 0x19, 0x3e, 0x0e, 0x9c, 0xe2, 0xf7, 0x7b, 0xef, 0x75, 0xbf, 0x8f, + 0xdf, 0x7b, 0x55, 0x1d, 0xd8, 0x09, 0x39, 0x71, 0x3c, 0xda, 0xb8, 0xdc, 0x6f, 0xe8, 0x5f, 0xf5, + 0x88, 0x87, 0x71, 0x88, 0x0a, 0x46, 0xba, 0xdc, 0xaf, 0x6c, 0x0f, 0xc2, 0x41, 0xa8, 0xd0, 0x86, + 0xfc, 0xa5, 0x0d, 0x2a, 0xb5, 0x41, 0x18, 0x0e, 0x3c, 0xda, 0x50, 0x52, 0x7f, 0x78, 0xd6, 0x88, + 0x99, 0x4f, 0x45, 0x4c, 0xfc, 0xc8, 0x18, 0xdc, 0x5f, 0x34, 0x20, 0xc1, 0xb5, 0x51, 0x55, 0x9d, + 0x50, 0xf8, 0xa1, 0x68, 0xf4, 0x89, 0x90, 0x6f, 0xee, 0xd3, 0x98, 0xec, 0x37, 0x9c, 0x90, 0x05, + 0x5a, 0xbf, 0xf7, 0x17, 0x0b, 0xe0, 0x90, 0xc4, 0xa4, 0x17, 0x0e, 0xb9, 0x43, 0xd1, 0x36, 0x2c, + 0x87, 0x57, 0x01, 0xe5, 0x65, 0x6b, 0xd7, 0x7a, 0x50, 0xc0, 0x5a, 0x40, 0x08, 0x72, 0x01, 0xf1, + 0x69, 0x39, 0xa3, 0x40, 0xf5, 0x1b, 0xed, 0x42, 0xd1, 0xa5, 0xc2, 0xe1, 0x2c, 0x8a, 0x59, 0x18, + 0x94, 0xb3, 0x4a, 0x35, 0x0b, 0xa1, 0x0a, 0xe4, 0xcf, 0x98, 0x47, 0x95, 0x67, 0x4e, 0xa9, 0xa7, + 0xb2, 0xd4, 0xc5, 0x9c, 0x12, 0x31, 0xe4, 0xd7, 0xe5, 0x65, 0xad, 0x4b, 0x64, 0xf4, 0x43, 0xc8, + 0x9e, 0x51, 0x5a, 0x5e, 0xd9, 0xcd, 0x3e, 0x28, 0x3e, 0xba, 0x5f, 0xd7, 0x09, 0xd4, 0x65, 0x02, + 0x75, 0x93, 0x40, 0xbd, 0x15, 0xb2, 0xa0, 0xf9, 0x95, 0x17, 0xe3, 0xda, 0xd2, 0x2f, 0x3f, 0xab, + 0x3d, 0x18, 0xb0, 0xf8, 0x7c, 0xd8, 0xaf, 0x3b, 0xa1, 0xdf, 0x30, 0xd9, 0xea, 0x3f, 0x5f, 0x16, + 0xee, 0x45, 0x23, 0xbe, 0x8e, 0xa8, 0x50, 0x0e, 0x02, 0xcb, 0xe7, 0x3e, 0xc9, 0xfd, 0xe9, 0x93, + 0x9a, 0xb5, 0xf7, 0x5b, 0x0b, 0x4a, 0xcf, 0x54, 0xdd, 0x7b, 0x2a, 0xe0, 0xff, 0x59, 0xe6, 0x3b, + 0xb0, 0x22, 0x9c, 0x73, 0xea, 0x13, 0x93, 0xb7, 0x91, 0xd0, 0x63, 0xd8, 0x10, 0xaa, 0x07, 0xb6, + 0x13, 0xba, 0xd4, 0x1e, 0x72, 0xaf, 0xbc, 0x22, 0x0d, 0x9a, 0x5b, 0x93, 0x71, 0x6d, 0x4d, 0xb7, + 0xa7, 0x15, 0xba, 0xf4, 0x14, 0x1f, 0xe3, 0x35, 0x91, 0x8a, 0xdc, 0x33, 0x19, 0xfd, 0xda, 0x02, + 0xc0, 0xe4, 0x0a, 0xd3, 0x1f, 0x0d, 0xa9, 0x88, 0xd1, 0xb7, 0xa0, 0x48, 0x47, 0x31, 0xe5, 0x01, + 0xf1, 0x6c, 0xe6, 0xaa, 0xac, 0x72, 0xcd, 0xb7, 0x27, 0xe3, 0x1a, 0xb4, 0x0d, 0xdc, 0x39, 0xfc, + 0xeb, 0x9c, 0x84, 0x21, 0x71, 0xe8, 0xb8, 0xe8, 0x08, 0xd6, 0x5d, 0x12, 0x13, 0xdb, 0xc4, 0xc4, + 0x5c, 0x55, 0x82, 0x5c, 0x73, 0x77, 0x32, 0xae, 0x95, 0x52, 0xc2, 0xa8, 0x67, 0xcc, 0xc9, 0xb8, + 0xe4, 0xa6, 0x92, 0x2b, 0x4b, 0xe1, 0x10, 0xcf, 0x93, 0x98, 0xaa, 0x54, 0x09, 0x4f, 0x65, 0x13, + 0xf7, 0x8f, 0x2d, 0x28, 0xa8, 0xb8, 0xa3, 0x90, 0xff, 0xdb, 0x61, 0xbf, 0x05, 0x05, 0x3a, 0x62, + 0xb1, 0xaa, 0xa1, 0x8a, 0x78, 0x0d, 0xe7, 0x25, 0x20, 0x4b, 0x25, 0x9b, 0x39, 0x13, 0x47, 0x6e, + 0x26, 0x86, 0x3f, 0x67, 0x61, 0x35, 0x29, 0xdc, 0x53, 0xd8, 0xd4, 0x03, 0x69, 0xeb, 0x86, 0xa6, + 0x61, 0xbc, 0x33, 0x19, 0xd7, 0xd6, 0x67, 0x49, 0xa3, 0x42, 0x59, 0x40, 0xf0, 0x7a, 0x38, 0x2b, + 0xcf, 0x57, 0x20, 0x33, 0x5f, 0x01, 0xb4, 0x0f, 0xdb, 0x5c, 0xbf, 0x96, 0xba, 0xf6, 0x25, 0xf1, + 0x98, 0x4b, 0xe2, 0x90, 0x8b, 0x72, 0x76, 0x37, 0xfb, 0xa0, 0x80, 0xef, 0x4c, 0x75, 0xcf, 0xa7, + 0x2a, 0x99, 0xa1, 0xcf, 0x02, 0xdb, 0x09, 0x87, 0x41, 0xac, 0xc8, 0x95, 0xc3, 0x79, 0x9f, 0x05, + 0x2d, 0x29, 0xa3, 0x2f, 0xc0, 0xba, 0xf1, 0xb1, 0xcf, 0x29, 0x1b, 0x9c, 0xc7, 0x8a, 0x64, 0x59, + 0xbc, 0x66, 0xd0, 0xef, 0x2a, 0x10, 0x7d, 0x1e, 0x4a, 0x89, 0x99, 0x5c, 0x25, 0x8a, 0x68, 0x59, + 0x5c, 0x34, 0xd8, 0x09, 0xf3, 0x29, 0xfa, 0x12, 0x14, 0x1c, 0x8f, 0xd1, 0x40, 0xa5, 0xbf, 0xaa, + 0x88, 0x58, 0x9a, 0x8c, 0x6b, 0xf9, 0x96, 0x02, 0x3b, 0x87, 0x38, 0xaf, 0xd5, 0x1d, 0x17, 0x7d, + 0x1b, 0x4a, 0x9c, 0x5c, 0xd9, 0xc6, 0x5b, 0x94, 0xf3, 0x6a, 0x70, 0xef, 0xd6, 0xa7, 0x6b, 0xad, + 0x9e, 0xd2, 0xb2, 0x99, 0x93, 0x43, 0x8b, 0x8b, 0x7c, 0x8a, 0x08, 0x74, 0x04, 0x45, 0xd6, 0x77, + 0x6c, 0xe7, 0x9c, 0x04, 0x01, 0xf5, 0xca, 0x85, 0x5d, 0x6b, 0xc1, 0xbd, 0xd3, 0x6c, 0xb5, 0xb4, + 0xb2, 0xb9, 0x2e, 0x99, 0x90, 0xca, 0x18, 0x58, 0xdf, 0x31, 0xbf, 0x51, 0x4d, 0x52, 0x87, 0x3a, + 0xc3, 0x98, 0xda, 0x03, 0x22, 0xca, 0xa0, 0x6a, 0x03, 0x06, 0x7a, 0x9f, 0x08, 0xd3, 0xeb, 0x9f, + 0x5a, 0xb0, 0x62, 0xc8, 0xf6, 0x36, 0x14, 0xa6, 0x45, 0x37, 0x73, 0x9f, 0x02, 0xe8, 0x21, 0x6c, + 0xb1, 0xc0, 0xee, 0xd3, 0xb3, 0x90, 0x53, 0x9b, 0x53, 0x11, 0x7a, 0x97, 0x9a, 0x53, 0x79, 0xbc, + 0xc1, 0x82, 0xa6, 0xc2, 0xb1, 0x86, 0xd1, 0x7b, 0x50, 0xd4, 0x35, 0x90, 0xcf, 0xd5, 0xfd, 0x2b, + 0x3e, 0xda, 0x5e, 0x2c, 0x81, 0x54, 0x9a, 0x0a, 0x00, 0x4f, 0x80, 0x24, 0xae, 0x9f, 0x67, 0xe1, + 0x9e, 0xa6, 0x92, 0xa9, 0x4c, 0x97, 0x38, 0x17, 0x34, 0x96, 0xb3, 0x35, 0xdf, 0x0d, 0xeb, 0x9f, + 0x76, 0xe3, 0x26, 0xfa, 0x66, 0xfe, 0x43, 0xf4, 0x5d, 0x18, 0x60, 0xc9, 0x45, 0x22, 0x2e, 0xe6, + 0xb9, 0x48, 0xc4, 0x85, 0xe6, 0xe2, 0x1c, 0x51, 0x97, 0x17, 0x88, 0x7a, 0x0e, 0x85, 0x33, 0x4a, + 0x6d, 0x8f, 0xf9, 0x2c, 0xfe, 0x6f, 0x6c, 0xfa, 0xfc, 0x19, 0xa5, 0xc7, 0xf2, 0xe1, 0x92, 0x15, + 0x11, 0xa7, 0x11, 0xe1, 0x9a, 0x15, 0xab, 0x9a, 0x15, 0x06, 0x7a, 0x9f, 0x88, 0x45, 0xda, 0xe4, + 0x5f, 0x41, 0x1b, 0x0a, 0x7b, 0x37, 0x74, 0xe7, 0xc0, 0xb9, 0x08, 0xc2, 0x2b, 0x8f, 0xba, 0x03, + 0xea, 0xd3, 0x20, 0x46, 0x8f, 0x01, 0x92, 0xc9, 0x9a, 0xae, 0x8d, 0xca, 0x64, 0x5c, 0x2b, 0x18, + 0x2f, 0x55, 0xf2, 0x54, 0xc0, 0x05, 0x63, 0xdd, 0x71, 0xcd, 0x6b, 0x7e, 0x93, 0x81, 0x72, 0xf2, + 0x1e, 0x11, 0x85, 0x81, 0xa0, 0x6f, 0x46, 0x83, 0xf9, 0x40, 0x32, 0xb7, 0x08, 0x44, 0x75, 0x35, + 0x10, 0xa6, 0x71, 0x59, 0xd3, 0xd5, 0x40, 0xe8, 0xc6, 0x2d, 0xae, 0x8e, 0xdc, 0x3f, 0xae, 0x0e, + 0x65, 0xa2, 0xc6, 0x42, 0x9b, 0x2c, 0x27, 0x26, 0x0a, 0x53, 0x26, 0xdf, 0x91, 0x7b, 0x4a, 0x9b, + 0x88, 0x98, 0xc4, 0x43, 0xa1, 0x56, 0xd0, 0xfa, 0xa3, 0xf2, 0xec, 0xc4, 0x68, 0x83, 0x9e, 0xd2, + 0xcb, 0x0d, 0x36, 0x23, 0xca, 0x53, 0x94, 0x53, 0x31, 0xf4, 0x62, 0xd5, 0xd0, 0x12, 0x36, 0x92, + 0x29, 0xe2, 0xef, 0xb2, 0x72, 0xc4, 0x25, 0xf0, 0xff, 0x37, 0x39, 0xf3, 0x8d, 0x5d, 0x79, 0xe3, + 0xc6, 0xae, 0xbe, 0xa6, 0xb1, 0xf9, 0xd7, 0x37, 0xb6, 0xf0, 0xaf, 0x34, 0x16, 0xde, 0xb4, 0xb1, + 0xc5, 0x1b, 0x1a, 0x1b, 0xc1, 0xc6, 0xf4, 0x28, 0x34, 0x0e, 0x6f, 0x41, 0x81, 0x09, 0x9b, 0x38, + 0x31, 0xbb, 0xa4, 0xaa, 0xc1, 0x79, 0x9c, 0x67, 0xe2, 0x40, 0xc9, 0xe8, 0x09, 0x2c, 0x0b, 0x16, + 0x38, 0x7a, 0x6d, 0x17, 0x1f, 0x55, 0xea, 0xfa, 0xa2, 0x5c, 0x4f, 0x2e, 0xca, 0xf5, 0x93, 0xe4, + 0x26, 0xdd, 0xcc, 0xcb, 0x1d, 0xf3, 0xd1, 0x67, 0x35, 0x0b, 0x6b, 0x17, 0xf3, 0xc6, 0x03, 0xd8, + 0xd0, 0xcf, 0x9a, 0xbe, 0x17, 0x95, 0x61, 0x95, 0xb8, 0x2e, 0xa7, 0x42, 0x98, 0x33, 0x23, 0x11, + 0xe5, 0x1d, 0x32, 0x0a, 0xaf, 0x28, 0xd7, 0xb4, 0xc1, 0x5a, 0xd8, 0x7b, 0x91, 0x83, 0x95, 0x2e, + 0xe1, 0xc4, 0x17, 0x68, 0x1f, 0xee, 0xfa, 0x64, 0x64, 0xcf, 0x1c, 0x97, 0xa6, 0x1b, 0x6a, 0x53, + 0x60, 0xe4, 0x93, 0x51, 0x7a, 0x56, 0xea, 0xbe, 0xec, 0xc1, 0x9a, 0x74, 0x49, 0xd9, 0xa2, 0x9f, + 0x5d, 0xf4, 0xc9, 0xe8, 0x20, 0x21, 0xcc, 0x43, 0xd8, 0x92, 0x36, 0x09, 0xbb, 0x6c, 0xc1, 0x3e, + 0xa0, 0x66, 0x72, 0x37, 0x7c, 0x32, 0x6a, 0x19, 0xbc, 0xc7, 0x3e, 0xa0, 0xa8, 0x01, 0xdb, 0x2a, + 0x04, 0x75, 0xf6, 0xd8, 0xa9, 0xb9, 0x26, 0xa1, 0x7c, 0x8e, 0x3e, 0x96, 0x0e, 0x13, 0x87, 0xaf, + 0xc1, 0x0e, 0x1d, 0x45, 0x8c, 0x13, 0x79, 0xb5, 0xb5, 0xfb, 0x5e, 0xe8, 0x5c, 0xcc, 0x51, 0x73, + 0x3b, 0xd5, 0x36, 0xa5, 0x52, 0x87, 0xf4, 0x0e, 0xac, 0xcb, 0x3d, 0x6e, 0x87, 0x57, 0x44, 0xf8, + 0x6a, 0xb1, 0x2a, 0xaa, 0xe2, 0x92, 0x44, 0x9f, 0x49, 0x50, 0xee, 0xde, 0xc7, 0x70, 0x3f, 0xa2, + 0x3c, 0xbd, 0xf9, 0x4c, 0xab, 0x92, 0xae, 0xea, 0x9d, 0x88, 0xf2, 0x69, 0xed, 0x4d, 0x65, 0xa4, + 0xeb, 0xbb, 0x80, 0x04, 0xf1, 0x23, 0x8f, 0x05, 0x03, 0x3b, 0xe6, 0xd7, 0x26, 0x24, 0xbd, 0xbd, + 0x37, 0x13, 0xcd, 0x09, 0xbf, 0xd6, 0xe1, 0x7c, 0x03, 0xca, 0x66, 0xb6, 0x39, 0xbd, 0x22, 0xdc, + 0xb5, 0x23, 0xca, 0x1d, 0x1a, 0xc4, 0x64, 0xa0, 0x69, 0x9c, 0xc3, 0xe6, 0xeb, 0x0c, 0x2b, 0x75, + 0x77, 0xaa, 0x45, 0x4f, 0xe0, 0x3e, 0x0b, 0x34, 0xbd, 0xec, 0x88, 0x06, 0xc4, 0x8b, 0xaf, 0x6d, + 0x77, 0xa8, 0xf3, 0x35, 0x77, 0x8c, 0x7b, 0x89, 0x41, 0x57, 0xeb, 0x0f, 0x8d, 0x1a, 0xb5, 0xe1, + 0x8e, 0xbc, 0xd9, 0x24, 0x49, 0xd1, 0x80, 0xf4, 0x3d, 0xea, 0x2a, 0x66, 0xe7, 0x9b, 0x77, 0x27, + 0xe3, 0xda, 0x56, 0xa7, 0xd9, 0x32, 0x39, 0xb5, 0xb5, 0x12, 0x6f, 0xb1, 0xbe, 0x33, 0x0f, 0x3d, + 0xc9, 0xff, 0xec, 0x93, 0xda, 0x92, 0x62, 0xe3, 0x7b, 0x80, 0xba, 0x34, 0x70, 0x59, 0x30, 0x30, + 0x43, 0x74, 0xcc, 0x84, 0x3a, 0xe2, 0xd2, 0x95, 0x20, 0x49, 0x99, 0x95, 0x27, 0xd8, 0x74, 0xee, + 0x93, 0x13, 0xec, 0x7b, 0x30, 0x73, 0x73, 0x42, 0xf7, 0x60, 0x55, 0x31, 0x20, 0x59, 0x8b, 0x78, + 0x45, 0x8a, 0x1d, 0x17, 0x7d, 0x0e, 0xc0, 0x5c, 0xc5, 0x92, 0x05, 0x58, 0xc0, 0x05, 0x83, 0x4c, + 0x8f, 0xa9, 0x3f, 0x58, 0x70, 0xc7, 0x44, 0xf9, 0x9c, 0x72, 0x76, 0xc6, 0x1c, 0x9d, 0xf1, 0x17, + 0x21, 0xef, 0x9c, 0x13, 0x16, 0xa4, 0xdb, 0xb6, 0x38, 0x19, 0xd7, 0x56, 0x5b, 0x12, 0xeb, 0x1c, + 0xe2, 0x55, 0xa5, 0xec, 0xb8, 0xf3, 0x37, 0xaf, 0xcc, 0xe2, 0xcd, 0x6b, 0x7e, 0xc7, 0x65, 0x6f, + 0xb3, 0xe3, 0x16, 0xbe, 0x1f, 0x72, 0xb7, 0xfb, 0x7e, 0x30, 0xd9, 0xfd, 0xca, 0x82, 0x62, 0x97, + 0x33, 0x87, 0x9a, 0x43, 0x44, 0x7e, 0xb3, 0x5d, 0xfb, 0xfd, 0xd0, 0x4b, 0x4a, 0xa5, 0x25, 0x54, + 0x05, 0xf0, 0x87, 0x5e, 0xcc, 0x22, 0x8f, 0x4d, 0x87, 0x7e, 0x06, 0x41, 0xeb, 0x90, 0x89, 0x46, + 0x66, 0x10, 0x33, 0xd1, 0x68, 0x21, 0xaf, 0xdc, 0x6d, 0xf2, 0x7a, 0xfd, 0xa1, 0xfa, 0xf0, 0x6f, + 0x16, 0xac, 0xcd, 0xed, 0x56, 0xf4, 0x4d, 0xa8, 0xe1, 0x76, 0xef, 0xd9, 0xf1, 0xf3, 0xb6, 0xdd, + 0x3b, 0x39, 0x38, 0x39, 0xed, 0xd9, 0xcf, 0xba, 0xed, 0xa7, 0xf6, 0xe9, 0xd3, 0x5e, 0xb7, 0xdd, + 0xea, 0x1c, 0x75, 0xda, 0x87, 0x9b, 0x4b, 0x95, 0x7b, 0x1f, 0x7e, 0xbc, 0x7b, 0xe7, 0x06, 0x33, + 0xf4, 0x75, 0xd8, 0x59, 0x80, 0x7b, 0xa7, 0xad, 0x56, 0xbb, 0xd7, 0xdb, 0xb4, 0x2a, 0x95, 0x0f, + 0x3f, 0xde, 0x7d, 0x85, 0xf6, 0x06, 0xbf, 0xa3, 0x83, 0xce, 0xf1, 0x29, 0x6e, 0x6f, 0x66, 0x6e, + 0xf4, 0x33, 0xda, 0x1b, 0xfc, 0xda, 0xdf, 0xef, 0x76, 0x70, 0xfb, 0x70, 0x33, 0x7b, 0xa3, 0x9f, + 0xd1, 0x56, 0x72, 0x3f, 0xf9, 0x45, 0x75, 0xa9, 0x79, 0xf4, 0x62, 0x52, 0xb5, 0x3e, 0x9d, 0x54, + 0xad, 0x3f, 0x4e, 0xaa, 0xd6, 0x47, 0x2f, 0xab, 0x4b, 0x9f, 0xbe, 0xac, 0x2e, 0xfd, 0xfe, 0x65, + 0x75, 0xe9, 0x07, 0xef, 0xce, 0xdc, 0x1a, 0xfb, 0x24, 0x70, 0xd5, 0xf2, 0x77, 0x42, 0xaf, 0xa1, + 0xc8, 0xd8, 0x18, 0x99, 0xff, 0xc6, 0xe8, 0xfb, 0x63, 0x7f, 0x45, 0xa9, 0xbf, 0xfa, 0xf7, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x91, 0xec, 0x8d, 0x21, 0xae, 0x11, 0x00, 0x00, +} + +func (this *DataSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataSource) + if !ok { + that2, ok := that.(DataSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.Name != that1.Name { + return false + } + if this.Description != that1.Description { + return false + } + if this.Filename != that1.Filename { + return false + } + if this.Treasury != that1.Treasury { + return false + } + if len(this.Fee) != len(that1.Fee) { + return false + } + for i := range this.Fee { + if !this.Fee[i].Equal(&that1.Fee[i]) { + return false + } + } + return true +} +func (this *OracleScript) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleScript) + if !ok { + that2, ok := that.(OracleScript) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.Name != that1.Name { + return false + } + if this.Description != that1.Description { + return false + } + if this.Filename != that1.Filename { + return false + } + if this.Schema != that1.Schema { + return false + } + if this.SourceCodeURL != that1.SourceCodeURL { + return false + } + return true +} +func (this *RawRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RawRequest) + if !ok { + that2, ok := that.(RawRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ExternalID != that1.ExternalID { + return false + } + if this.DataSourceID != that1.DataSourceID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + return true +} +func (this *RawReport) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RawReport) + if !ok { + that2, ok := that.(RawReport) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ExternalID != that1.ExternalID { + return false + } + if this.ExitCode != that1.ExitCode { + return false + } + if !bytes.Equal(this.Data, that1.Data) { + return false + } + return true +} +func (this *Request) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Request) + if !ok { + that2, ok := that.(Request) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if len(this.RequestedValidators) != len(that1.RequestedValidators) { + return false + } + for i := range this.RequestedValidators { + if this.RequestedValidators[i] != that1.RequestedValidators[i] { + return false + } + } + if this.MinCount != that1.MinCount { + return false + } + if this.RequestHeight != that1.RequestHeight { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if len(this.RawRequests) != len(that1.RawRequests) { + return false + } + for i := range this.RawRequests { + if !this.RawRequests[i].Equal(&that1.RawRequests[i]) { + return false + } + } + if !this.IBCChannel.Equal(that1.IBCChannel) { + return false + } + if this.ExecuteGas != that1.ExecuteGas { + return false + } + return true +} +func (this *Report) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Report) + if !ok { + that2, ok := that.(Report) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Validator != that1.Validator { + return false + } + if this.InBeforeResolve != that1.InBeforeResolve { + return false + } + if len(this.RawReports) != len(that1.RawReports) { + return false + } + for i := range this.RawReports { + if !this.RawReports[i].Equal(&that1.RawReports[i]) { + return false + } + } + return true +} +func (this *OracleRequestPacketData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleRequestPacketData) + if !ok { + that2, ok := that.(OracleRequestPacketData) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if this.AskCount != that1.AskCount { + return false + } + if this.MinCount != that1.MinCount { + return false + } + if len(this.FeeLimit) != len(that1.FeeLimit) { + return false + } + for i := range this.FeeLimit { + if !this.FeeLimit[i].Equal(&that1.FeeLimit[i]) { + return false + } + } + if this.PrepareGas != that1.PrepareGas { + return false + } + if this.ExecuteGas != that1.ExecuteGas { + return false + } + return true +} +func (this *OracleRequestPacketAcknowledgement) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleRequestPacketAcknowledgement) + if !ok { + that2, ok := that.(OracleRequestPacketAcknowledgement) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RequestID != that1.RequestID { + return false + } + return true +} +func (this *OracleResponsePacketData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleResponsePacketData) + if !ok { + that2, ok := that.(OracleResponsePacketData) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.AnsCount != that1.AnsCount { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ResolveTime != that1.ResolveTime { + return false + } + if this.ResolveStatus != that1.ResolveStatus { + return false + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + return true +} +func (this *Result) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Result) + if !ok { + that2, ok := that.(Result) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if this.AskCount != that1.AskCount { + return false + } + if this.MinCount != that1.MinCount { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.AnsCount != that1.AnsCount { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ResolveTime != that1.ResolveTime { + return false + } + if this.ResolveStatus != that1.ResolveStatus { + return false + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + return true +} +func (this *ValidatorStatus) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ValidatorStatus) + if !ok { + that2, ok := that.(ValidatorStatus) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IsActive != that1.IsActive { + return false + } + if !this.Since.Equal(that1.Since) { + return false + } + return true +} +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.MaxRawRequestCount != that1.MaxRawRequestCount { + return false + } + if this.MaxAskCount != that1.MaxAskCount { + return false + } + if this.MaxCalldataSize != that1.MaxCalldataSize { + return false + } + if this.MaxReportDataSize != that1.MaxReportDataSize { + return false + } + if this.ExpirationBlockCount != that1.ExpirationBlockCount { + return false + } + if this.BaseOwasmGas != that1.BaseOwasmGas { + return false + } + if this.PerValidatorRequestGas != that1.PerValidatorRequestGas { + return false + } + if this.SamplingTryCount != that1.SamplingTryCount { + return false + } + if this.OracleRewardPercentage != that1.OracleRewardPercentage { + return false + } + if this.InactivePenaltyDuration != that1.InactivePenaltyDuration { + return false + } + if this.IBCRequestEnabled != that1.IBCRequestEnabled { + return false + } + return true +} +func (this *PendingResolveList) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PendingResolveList) + if !ok { + that2, ok := that.(PendingResolveList) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.RequestIds) != len(that1.RequestIds) { + return false + } + for i := range this.RequestIds { + if this.RequestIds[i] != that1.RequestIds[i] { + return false + } + } + return true +} +func (this *IBCChannel) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IBCChannel) + if !ok { + that2, ok := that.(IBCChannel) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PortId != that1.PortId { + return false + } + if this.ChannelId != that1.ChannelId { + return false + } + return true +} +func (this *RequestVerification) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RequestVerification) + if !ok { + that2, ok := that.(RequestVerification) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ChainID != that1.ChainID { + return false + } + if this.Validator != that1.Validator { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.ExternalID != that1.ExternalID { + return false + } + return true +} +func (m *DataSource) 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 *DataSource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fee) > 0 { + for iNdEx := len(m.Fee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.Treasury) > 0 { + i -= len(m.Treasury) + copy(dAtA[i:], m.Treasury) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Treasury))) + i-- + dAtA[i] = 0x2a + } + if len(m.Filename) > 0 { + i -= len(m.Filename) + copy(dAtA[i:], m.Filename) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Filename))) + i-- + dAtA[i] = 0x22 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OracleScript) 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 *OracleScript) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleScript) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SourceCodeURL) > 0 { + i -= len(m.SourceCodeURL) + copy(dAtA[i:], m.SourceCodeURL) + i = encodeVarintOracle(dAtA, i, uint64(len(m.SourceCodeURL))) + i-- + dAtA[i] = 0x32 + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x2a + } + if len(m.Filename) > 0 { + i -= len(m.Filename) + copy(dAtA[i:], m.Filename) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Filename))) + i-- + dAtA[i] = 0x22 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RawRequest) 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 *RawRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.DataSourceID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.DataSourceID)) + i-- + dAtA[i] = 0x10 + } + if m.ExternalID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExternalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RawReport) 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 *RawReport) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if m.ExitCode != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExitCode)) + i-- + dAtA[i] = 0x10 + } + if m.ExternalID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExternalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Request) 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 *Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExecuteGas != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExecuteGas)) + i-- + dAtA[i] = 0x50 + } + if m.IBCChannel != nil { + { + size, err := m.IBCChannel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if len(m.RawRequests) > 0 { + for iNdEx := len(m.RawRequests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RawRequests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0x3a + } + if m.RequestTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x30 + } + if m.RequestHeight != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestHeight)) + i-- + dAtA[i] = 0x28 + } + if m.MinCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.RequestedValidators) > 0 { + for iNdEx := len(m.RequestedValidators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RequestedValidators[iNdEx]) + copy(dAtA[i:], m.RequestedValidators[iNdEx]) + i = encodeVarintOracle(dAtA, i, uint64(len(m.RequestedValidators[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x12 + } + if m.OracleScriptID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Report) 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 *Report) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Report) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RawReports) > 0 { + for iNdEx := len(m.RawReports) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RawReports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.InBeforeResolve { + i-- + if m.InBeforeResolve { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OracleRequestPacketData) 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 *OracleRequestPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleRequestPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExecuteGas != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExecuteGas)) + i-- + dAtA[i] = 0x40 + } + if m.PrepareGas != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.PrepareGas)) + i-- + dAtA[i] = 0x38 + } + if len(m.FeeLimit) > 0 { + for iNdEx := len(m.FeeLimit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeeLimit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.MinCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.OracleScriptID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OracleRequestPacketAcknowledgement) 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 *OracleRequestPacketAcknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleRequestPacketAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RequestID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *OracleResponsePacketData) 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 *OracleResponsePacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleResponsePacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x3a + } + if m.ResolveStatus != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ResolveStatus)) + i-- + dAtA[i] = 0x30 + } + if m.ResolveTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x28 + } + if m.RequestTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x20 + } + if m.AnsCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AnsCount)) + i-- + dAtA[i] = 0x18 + } + if m.RequestID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x5a + } + if m.ResolveStatus != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ResolveStatus)) + i-- + dAtA[i] = 0x50 + } + if m.ResolveTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x48 + } + if m.RequestTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x40 + } + if m.AnsCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AnsCount)) + i-- + dAtA[i] = 0x38 + } + if m.RequestID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x30 + } + if m.MinCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.OracleScriptID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorStatus) 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 *ValidatorStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Since, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Since):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintOracle(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + if m.IsActive { + i-- + if m.IsActive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ActiveValidator) 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 *ActiveValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ActiveValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Power != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IBCRequestEnabled { + i-- + if m.IBCRequestEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.InactivePenaltyDuration != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.InactivePenaltyDuration)) + i-- + dAtA[i] = 0x50 + } + if m.OracleRewardPercentage != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.OracleRewardPercentage)) + i-- + dAtA[i] = 0x48 + } + if m.SamplingTryCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.SamplingTryCount)) + i-- + dAtA[i] = 0x40 + } + if m.PerValidatorRequestGas != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.PerValidatorRequestGas)) + i-- + dAtA[i] = 0x38 + } + if m.BaseOwasmGas != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.BaseOwasmGas)) + i-- + dAtA[i] = 0x30 + } + if m.ExpirationBlockCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExpirationBlockCount)) + i-- + dAtA[i] = 0x28 + } + if m.MaxReportDataSize != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MaxReportDataSize)) + i-- + dAtA[i] = 0x20 + } + if m.MaxCalldataSize != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MaxCalldataSize)) + i-- + dAtA[i] = 0x18 + } + if m.MaxAskCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MaxAskCount)) + i-- + dAtA[i] = 0x10 + } + if m.MaxRawRequestCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MaxRawRequestCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PendingResolveList) 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 *PendingResolveList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingResolveList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestIds) > 0 { + dAtA4 := make([]byte, len(m.RequestIds)*10) + var j3 int + for _, num := range m.RequestIds { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintOracle(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IBCChannel) 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 *IBCChannel) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintOracle(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestVerification) 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 *RequestVerification) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerification) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExternalID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ExternalID)) + i-- + dAtA[i] = 0x20 + } + if m.RequestID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x18 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PriceResult) 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 *PriceResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriceResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResolveTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x28 + } + if m.RequestID != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x20 + } + if m.Px != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Px)) + i-- + dAtA[i] = 0x18 + } + if m.Multiplier != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Multiplier)) + i-- + dAtA[i] = 0x10 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { + offset -= sovOracle(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DataSource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Filename) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Treasury) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if len(m.Fee) > 0 { + for _, e := range m.Fee { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + return n +} + +func (m *OracleScript) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Filename) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.SourceCodeURL) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *RawRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExternalID != 0 { + n += 1 + sovOracle(uint64(m.ExternalID)) + } + if m.DataSourceID != 0 { + n += 1 + sovOracle(uint64(m.DataSourceID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *RawReport) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExternalID != 0 { + n += 1 + sovOracle(uint64(m.ExternalID)) + } + if m.ExitCode != 0 { + n += 1 + sovOracle(uint64(m.ExitCode)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OracleScriptID != 0 { + n += 1 + sovOracle(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if len(m.RequestedValidators) > 0 { + for _, s := range m.RequestedValidators { + l = len(s) + n += 1 + l + sovOracle(uint64(l)) + } + } + if m.MinCount != 0 { + n += 1 + sovOracle(uint64(m.MinCount)) + } + if m.RequestHeight != 0 { + n += 1 + sovOracle(uint64(m.RequestHeight)) + } + if m.RequestTime != 0 { + n += 1 + sovOracle(uint64(m.RequestTime)) + } + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if len(m.RawRequests) > 0 { + for _, e := range m.RawRequests { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + if m.IBCChannel != nil { + l = m.IBCChannel.Size() + n += 1 + l + sovOracle(uint64(l)) + } + if m.ExecuteGas != 0 { + n += 1 + sovOracle(uint64(m.ExecuteGas)) + } + return n +} + +func (m *Report) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.InBeforeResolve { + n += 2 + } + if len(m.RawReports) > 0 { + for _, e := range m.RawReports { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + return n +} + +func (m *OracleRequestPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.OracleScriptID != 0 { + n += 1 + sovOracle(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.AskCount != 0 { + n += 1 + sovOracle(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovOracle(uint64(m.MinCount)) + } + if len(m.FeeLimit) > 0 { + for _, e := range m.FeeLimit { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + if m.PrepareGas != 0 { + n += 1 + sovOracle(uint64(m.PrepareGas)) + } + if m.ExecuteGas != 0 { + n += 1 + sovOracle(uint64(m.ExecuteGas)) + } + return n +} + +func (m *OracleRequestPacketAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestID != 0 { + n += 1 + sovOracle(uint64(m.RequestID)) + } + return n +} + +func (m *OracleResponsePacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.RequestID != 0 { + n += 1 + sovOracle(uint64(m.RequestID)) + } + if m.AnsCount != 0 { + n += 1 + sovOracle(uint64(m.AnsCount)) + } + if m.RequestTime != 0 { + n += 1 + sovOracle(uint64(m.RequestTime)) + } + if m.ResolveTime != 0 { + n += 1 + sovOracle(uint64(m.ResolveTime)) + } + if m.ResolveStatus != 0 { + n += 1 + sovOracle(uint64(m.ResolveStatus)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.OracleScriptID != 0 { + n += 1 + sovOracle(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.AskCount != 0 { + n += 1 + sovOracle(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovOracle(uint64(m.MinCount)) + } + if m.RequestID != 0 { + n += 1 + sovOracle(uint64(m.RequestID)) + } + if m.AnsCount != 0 { + n += 1 + sovOracle(uint64(m.AnsCount)) + } + if m.RequestTime != 0 { + n += 1 + sovOracle(uint64(m.RequestTime)) + } + if m.ResolveTime != 0 { + n += 1 + sovOracle(uint64(m.ResolveTime)) + } + if m.ResolveStatus != 0 { + n += 1 + sovOracle(uint64(m.ResolveStatus)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *ValidatorStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsActive { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Since) + n += 1 + l + sovOracle(uint64(l)) + return n +} + +func (m *ActiveValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.Power != 0 { + n += 1 + sovOracle(uint64(m.Power)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MaxRawRequestCount != 0 { + n += 1 + sovOracle(uint64(m.MaxRawRequestCount)) + } + if m.MaxAskCount != 0 { + n += 1 + sovOracle(uint64(m.MaxAskCount)) + } + if m.MaxCalldataSize != 0 { + n += 1 + sovOracle(uint64(m.MaxCalldataSize)) + } + if m.MaxReportDataSize != 0 { + n += 1 + sovOracle(uint64(m.MaxReportDataSize)) + } + if m.ExpirationBlockCount != 0 { + n += 1 + sovOracle(uint64(m.ExpirationBlockCount)) + } + if m.BaseOwasmGas != 0 { + n += 1 + sovOracle(uint64(m.BaseOwasmGas)) + } + if m.PerValidatorRequestGas != 0 { + n += 1 + sovOracle(uint64(m.PerValidatorRequestGas)) + } + if m.SamplingTryCount != 0 { + n += 1 + sovOracle(uint64(m.SamplingTryCount)) + } + if m.OracleRewardPercentage != 0 { + n += 1 + sovOracle(uint64(m.OracleRewardPercentage)) + } + if m.InactivePenaltyDuration != 0 { + n += 1 + sovOracle(uint64(m.InactivePenaltyDuration)) + } + if m.IBCRequestEnabled { + n += 2 + } + return n +} + +func (m *PendingResolveList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RequestIds) > 0 { + l = 0 + for _, e := range m.RequestIds { + l += sovOracle(uint64(e)) + } + n += 1 + sovOracle(uint64(l)) + l + } + return n +} + +func (m *IBCChannel) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *RequestVerification) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.RequestID != 0 { + n += 1 + sovOracle(uint64(m.RequestID)) + } + if m.ExternalID != 0 { + n += 1 + sovOracle(uint64(m.ExternalID)) + } + return n +} + +func (m *PriceResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.Multiplier != 0 { + n += 1 + sovOracle(uint64(m.Multiplier)) + } + if m.Px != 0 { + n += 1 + sovOracle(uint64(m.Px)) + } + if m.RequestID != 0 { + n += 1 + sovOracle(uint64(m.RequestID)) + } + if m.ResolveTime != 0 { + n += 1 + sovOracle(uint64(m.ResolveTime)) + } + return n +} + +func sovOracle(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozOracle(x uint64) (n int) { + return sovOracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DataSource) 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 ErrIntOverflowOracle + } + 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: DataSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Treasury", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Treasury = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fee = append(m.Fee, types.Coin{}) + if err := m.Fee[len(m.Fee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleScript) 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 ErrIntOverflowOracle + } + 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: OracleScript: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleScript: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceCodeURL", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceCodeURL = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawRequest) 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 ErrIntOverflowOracle + } + 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: RawRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalID", wireType) + } + m.ExternalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExternalID |= ExternalID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataSourceID", wireType) + } + m.DataSourceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataSourceID |= DataSourceID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawReport) 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 ErrIntOverflowOracle + } + 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: RawReport: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawReport: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalID", wireType) + } + m.ExternalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExternalID |= ExternalID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitCode", wireType) + } + m.ExitCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitCode |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Request) 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 ErrIntOverflowOracle + } + 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: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= OracleScriptID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedValidators", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestedValidators = append(m.RequestedValidators, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeight", wireType) + } + m.RequestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawRequests = append(m.RawRequests, RawRequest{}) + if err := m.RawRequests[len(m.RawRequests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IBCChannel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IBCChannel == nil { + m.IBCChannel = &IBCChannel{} + } + if err := m.IBCChannel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecuteGas", wireType) + } + m.ExecuteGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecuteGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Report) 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 ErrIntOverflowOracle + } + 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: Report: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Report: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InBeforeResolve", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.InBeforeResolve = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawReports", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawReports = append(m.RawReports, RawReport{}) + if err := m.RawReports[len(m.RawReports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleRequestPacketData) 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 ErrIntOverflowOracle + } + 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: OracleRequestPacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleRequestPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= OracleScriptID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeLimit = append(m.FeeLimit, types.Coin{}) + if err := m.FeeLimit[len(m.FeeLimit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrepareGas", wireType) + } + m.PrepareGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrepareGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecuteGas", wireType) + } + m.ExecuteGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecuteGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleRequestPacketAcknowledgement) 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 ErrIntOverflowOracle + } + 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: OracleRequestPacketAcknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleRequestPacketAcknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleResponsePacketData) 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 ErrIntOverflowOracle + } + 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: OracleResponsePacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleResponsePacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) + } + m.AnsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) + } + m.ResolveStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveStatus |= ResolveStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Result) 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 ErrIntOverflowOracle + } + 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: Result: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= OracleScriptID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) + } + m.AnsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) + } + m.ResolveStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveStatus |= ResolveStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorStatus) 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 ErrIntOverflowOracle + } + 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: ValidatorStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsActive = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Since, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ActiveValidator) 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 ErrIntOverflowOracle + } + 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: ActiveValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ActiveValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) 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 ErrIntOverflowOracle + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRawRequestCount", wireType) + } + m.MaxRawRequestCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxRawRequestCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxAskCount", wireType) + } + m.MaxAskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxAskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxCalldataSize", wireType) + } + m.MaxCalldataSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxCalldataSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxReportDataSize", wireType) + } + m.MaxReportDataSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxReportDataSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationBlockCount", wireType) + } + m.ExpirationBlockCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationBlockCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseOwasmGas", wireType) + } + m.BaseOwasmGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseOwasmGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PerValidatorRequestGas", wireType) + } + m.PerValidatorRequestGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PerValidatorRequestGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SamplingTryCount", wireType) + } + m.SamplingTryCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SamplingTryCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleRewardPercentage", wireType) + } + m.OracleRewardPercentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleRewardPercentage |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InactivePenaltyDuration", wireType) + } + m.InactivePenaltyDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InactivePenaltyDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IBCRequestEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IBCRequestEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PendingResolveList) 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 ErrIntOverflowOracle + } + 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: PendingResolveList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingResolveList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RequestIds = append(m.RequestIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RequestIds) == 0 { + m.RequestIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RequestIds = append(m.RequestIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RequestIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IBCChannel) 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 ErrIntOverflowOracle + } + 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: IBCChannel: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IBCChannel: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestVerification) 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 ErrIntOverflowOracle + } + 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: RequestVerification: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestVerification: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalID", wireType) + } + m.ExternalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExternalID |= ExternalID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriceResult) 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 ErrIntOverflowOracle + } + 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: PriceResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriceResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Multiplier", wireType) + } + m.Multiplier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Multiplier |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Px", wireType) + } + m.Px = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Px |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOracle(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, ErrIntOverflowOracle + } + 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, ErrIntOverflowOracle + } + 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, ErrIntOverflowOracle + } + 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, ErrInvalidLengthOracle + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOracle + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthOracle + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthOracle = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOracle = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOracle = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/bandtesting/x/oracle/types/packets.go b/x/oracle/bandtesting/x/oracle/types/packets.go new file mode 100644 index 00000000..407e4a74 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/packets.go @@ -0,0 +1,84 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + bandoracletypes "github.com/onomyprotocol/reserve/x/oracle/bandchain/oracle/types" + +) + +// NewOracleRequestPacketData contructs a new OracleRequestPacketData instance +func NewOracleRequestPacketData( + clientID string, oracleScriptID OracleScriptID, calldata []byte, askCount uint64, minCount uint64, feeLimit sdk.Coins, prepareGas uint64, executeGas uint64, +) OracleRequestPacketData { + return OracleRequestPacketData{ + ClientID: clientID, + OracleScriptID: oracleScriptID, + Calldata: calldata, + AskCount: askCount, + MinCount: minCount, + FeeLimit: feeLimit, + PrepareGas: prepareGas, + ExecuteGas: executeGas, + } +} + +// ValidateBasic is used for validating the request. +func (p OracleRequestPacketData) ValidateBasic() error { + if p.MinCount <= 0 { + return errors.Wrapf(bandoracletypes.ErrInvalidMinCount, "got: %d", p.MinCount) + } + if p.AskCount < p.MinCount { + return errors.Wrapf(bandoracletypes.ErrInvalidAskCount, "got: %d, min count: %d", p.AskCount, p.MinCount) + } + if len(p.ClientID) > MaxClientIDLength { + return bandoracletypes.WrapMaxError(bandoracletypes.ErrTooLongClientID, len(p.ClientID), MaxClientIDLength) + } + if p.PrepareGas <= 0 { + return errors.Wrapf(bandoracletypes.ErrInvalidOwasmGas, "invalid prepare gas: %d", p.PrepareGas) + } + if p.ExecuteGas <= 0 { + return errors.Wrapf(bandoracletypes.ErrInvalidOwasmGas, "invalid execute gas: %d", p.ExecuteGas) + } + if p.PrepareGas+p.ExecuteGas > MaximumOwasmGas { + return errors.Wrapf(bandoracletypes.ErrInvalidOwasmGas, "sum of prepare gas and execute gas (%d) exceed %d", p.PrepareGas+p.ExecuteGas, MaximumOwasmGas) + } + if !p.FeeLimit.IsValid() { + return errors.Wrap(sdkerrors.ErrInvalidCoins, p.FeeLimit.String()) + } + return nil +} + +// GetBytes is a helper for serialising +func (p OracleRequestPacketData) GetBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&p)) +} + +func NewOracleRequestPacketAcknowledgement(requestID RequestID) *OracleRequestPacketAcknowledgement { + return &OracleRequestPacketAcknowledgement{ + RequestID: requestID, + } +} + +// NewOracleResponsePacketData contructs a new OracleResponsePacketData instance +func NewOracleResponsePacketData( + clientID string, requestID RequestID, ansCount uint64, requestTime int64, + resolveTime int64, resolveStatus ResolveStatus, result []byte, +) OracleResponsePacketData { + return OracleResponsePacketData{ + ClientID: clientID, + RequestID: requestID, + AnsCount: ansCount, + RequestTime: requestTime, + ResolveTime: resolveTime, + ResolveStatus: resolveStatus, + Result: result, + } +} + +// GetBytes returns the bytes representation of this oracle response packet data. +func (p OracleResponsePacketData) GetBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&p)) +} diff --git a/x/oracle/bandtesting/x/oracle/types/params.go b/x/oracle/bandtesting/x/oracle/types/params.go new file mode 100644 index 00000000..5780c520 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/params.go @@ -0,0 +1,134 @@ +package types + +import ( + "fmt" + "time" + + "gopkg.in/yaml.v2" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// nolint +const ( + // Each value below is the default value for each parameter when generating the default + // genesis file. See comments in types.proto for explanation for each parameter. + DefaultMaxRawRequestCount = uint64(12) + DefaultMaxAskCount = uint64(16) + DefaultMaxCalldataSize = uint64(256) // 256B + DefaultMaxReportDataSize = uint64(512) // 512B + DefaultExpirationBlockCount = uint64(100) + DefaultBaseRequestGas = uint64(20000) + DefaultPerValidatorRequestGas = uint64(30000) + DefaultSamplingTryCount = uint64(3) + DefaultOracleRewardPercentage = uint64(70) + DefaultInactivePenaltyDuration = uint64(10 * time.Minute) + DefaultIBCRequestEnabled = true +) + +// nolint +var ( + // Each value below is the key to store the respective oracle module parameter. See comments + // in types.proto for explanation for each parameter. + KeyMaxRawRequestCount = []byte("MaxRawRequestCount") + KeyMaxAskCount = []byte("MaxAskCount") + KeyMaxCalldataSize = []byte("MaxCalldataSize") + KeyMaxReportDataSize = []byte("MaxReportDataSize") + KeyExpirationBlockCount = []byte("ExpirationBlockCount") + KeyBaseOwasmGas = []byte("BaseOwasmGas") + KeyPerValidatorRequestGas = []byte("PerValidatorRequestGas") + KeySamplingTryCount = []byte("SamplingTryCount") + KeyOracleRewardPercentage = []byte("OracleRewardPercentage") + KeyInactivePenaltyDuration = []byte("InactivePenaltyDuration") + KeyIBCRequestEnabled = []byte("IBCRequestEnabled") +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable for oracle module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new parameter configuration for the oracle module +func NewParams( + maxRawRequestCount, maxAskCount, maxCalldataSize, maxReportDataSize, expirationBlockCount, baseRequestGas, perValidatorRequestGas, + samplingTryCount, oracleRewardPercentage, inactivePenaltyDuration uint64, ibcRequestEnabled bool, +) Params { + return Params{ + MaxRawRequestCount: maxRawRequestCount, + MaxAskCount: maxAskCount, + MaxCalldataSize: maxCalldataSize, + MaxReportDataSize: maxReportDataSize, + ExpirationBlockCount: expirationBlockCount, + BaseOwasmGas: baseRequestGas, + PerValidatorRequestGas: perValidatorRequestGas, + SamplingTryCount: samplingTryCount, + OracleRewardPercentage: oracleRewardPercentage, + InactivePenaltyDuration: inactivePenaltyDuration, + IBCRequestEnabled: ibcRequestEnabled, + } +} + +// ParamSetPairs implements the paramtypes.ParamSet interface for Params. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyMaxRawRequestCount, &p.MaxRawRequestCount, validateUint64("max data source count", true)), + paramtypes.NewParamSetPair(KeyMaxAskCount, &p.MaxAskCount, validateUint64("max ask count", true)), + paramtypes.NewParamSetPair(KeyMaxCalldataSize, &p.MaxCalldataSize, validateUint64("max calldata size", true)), + paramtypes.NewParamSetPair(KeyMaxReportDataSize, &p.MaxReportDataSize, validateUint64("max report data size", true)), + paramtypes.NewParamSetPair(KeyExpirationBlockCount, &p.ExpirationBlockCount, validateUint64("expiration block count", true)), + paramtypes.NewParamSetPair(KeyBaseOwasmGas, &p.BaseOwasmGas, validateUint64("base request gas", false)), + paramtypes.NewParamSetPair(KeyPerValidatorRequestGas, &p.PerValidatorRequestGas, validateUint64("per validator request gas", false)), + paramtypes.NewParamSetPair(KeySamplingTryCount, &p.SamplingTryCount, validateUint64("sampling try count", true)), + paramtypes.NewParamSetPair(KeyOracleRewardPercentage, &p.OracleRewardPercentage, validateUint64("oracle reward percentage", false)), + paramtypes.NewParamSetPair(KeyInactivePenaltyDuration, &p.InactivePenaltyDuration, validateUint64("inactive penalty duration", false)), + paramtypes.NewParamSetPair(KeyIBCRequestEnabled, &p.IBCRequestEnabled, validateBool()), + } +} + +// DefaultParams defines the default parameters. +func DefaultParams() Params { + return NewParams( + DefaultMaxRawRequestCount, + DefaultMaxAskCount, + DefaultMaxCalldataSize, + DefaultMaxReportDataSize, + DefaultExpirationBlockCount, + DefaultBaseRequestGas, + DefaultPerValidatorRequestGas, + DefaultSamplingTryCount, + DefaultOracleRewardPercentage, + DefaultInactivePenaltyDuration, + DefaultIBCRequestEnabled, + ) +} + +// String returns a human readable string representation of the parameters. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +func validateUint64(name string, positiveOnly bool) func(interface{}) error { + return func(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if v <= 0 && positiveOnly { + return fmt.Errorf("%s must be positive: %d", name, v) + } + return nil + } +} + +func validateBool() func(interface{}) error { + return func(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil + } +} diff --git a/x/oracle/bandtesting/x/oracle/types/request.go b/x/oracle/bandtesting/x/oracle/types/request.go new file mode 100644 index 00000000..451052e4 --- /dev/null +++ b/x/oracle/bandtesting/x/oracle/types/request.go @@ -0,0 +1,57 @@ +package types + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + _ RequestSpec = &OracleRequestPacketData{} +) + +// RequestSpec captures the essence of what it means to be a request-making object. +type RequestSpec interface { + GetOracleScriptID() OracleScriptID + GetCalldata() []byte + GetAskCount() uint64 + GetMinCount() uint64 + GetClientID() string + GetPrepareGas() uint64 + GetExecuteGas() uint64 + GetFeeLimit() sdk.Coins +} + +func NewRequest( + oracleScriptID OracleScriptID, + calldata []byte, + requestedValidators []sdk.ValAddress, + minCount uint64, + requestHeight int64, + requestTime time.Time, + clientID string, + rawRequests []RawRequest, + ibcChannel *IBCChannel, + executeGas uint64, +) Request { + requestedVals := make([]string, len(requestedValidators)) + if requestedValidators != nil { + for idx, reqVal := range requestedValidators { + requestedVals[idx] = reqVal.String() + } + } else { + requestedVals = nil + } + return Request{ + OracleScriptID: oracleScriptID, + Calldata: calldata, + RequestedValidators: requestedVals, + MinCount: minCount, + RequestHeight: requestHeight, + RequestTime: requestTime.Unix(), + ClientID: clientID, + RawRequests: rawRequests, + IBCChannel: ibcChannel, + ExecuteGas: executeGas, + } +} diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go new file mode 100644 index 00000000..ef5679bf --- /dev/null +++ b/x/oracle/client/cli/query.go @@ -0,0 +1,56 @@ +package cli + +import ( + "context" + + "github.com/cosmos/gogoproto/proto" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +// GetQueryCmd returns the parent command for all modules/oracle CLi query commands. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the oracle module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetBandPriceStates(), + ) + return cmd +} + +// GetBandPriceStates queries the state for all band price states +func GetBandPriceStates() *cobra.Command { + cmd := &cobra.Command{ + Use: "band-price-states", + Short: "Gets Band price states", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + var res proto.Message + req := &types.QueryBandPriceStatesRequest{} + res, err = queryClient.BandPriceStates(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} \ No newline at end of file diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index f59772ed..eea8042a 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -2,16 +2,30 @@ package cli import ( "fmt" - "time" + "strconv" + errors "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + + "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/onomyprotocol/reserve/x/oracle/types" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +const ( + flagSymbols = "symbols" + flagRequestedValidatorCount = "requested-validator-count" + flagSufficientValidatorCount = "sufficient-validator-count" + flagMinSourceCount = "min-source-count" + flagPrepareGas = "prepare-gas" + flagExecuteGas = "execute-gas" + flagFeeLimit = "fee-limit" +) // GetTxCmd returns the transaction commands for this module. func GetTxCmd() *cobra.Command { @@ -23,7 +37,276 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - // this line is used by starport scaffolding # 1 + cmd.AddCommand( + NewRequestBandRatesTxCmd(), + NewUpdateBandOracleRequestProposalTxCmd(), + NewDeleteBandOracleRequestProposalTxCmd(), + ) + + return cmd +} + +// NewRequestBandRatesTxCmd implements the request command handler. +func NewRequestBandRatesTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "request-band-rates [request-id]", + Short: "Make a new data request via an existing oracle script", + Args: cobra.ExactArgs(1), + Long: `Make a new request via an existing oracle script with the configuration flags. + Example: + $ %s tx oracle request-band-rates 2 --from mykey`, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + requestID, err := strconv.Atoi(args[0]) + if err != nil { + return errors.New("requestID should be a positive number") + } else if requestID <= 0 { + return errors.New("requestID should be a positive number") + } + + msg := types.NewMsgRequestBandRates( + clientCtx.GetFromAddress(), + uint64(requestID), + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) return cmd } + +func NewUpdateBandOracleRequestProposalTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-band-oracle-request-proposal 1 37 [flags]", + Args: cobra.ExactArgs(2), + Short: "Submit a proposal to update a Band Oracle IBC Request.", + Long: `Submit a proposal to update a Band Oracle IBC Request. + Example: + $ %s tx oracle update-band-oracle-request-proposal 1 37 --port-id "oracle" --ibc-version "bandchain-1" --symbols "BTC,ETH,USDT,USDC" --requested-validator-count 4 --sufficient-validator-count 3 --min-source-count 3 --expiration 20 --prepare-gas 50 --execute-gas 5000 --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + content, err := updateBandOracleRequestProposalArgsToContent(cmd, args) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + + depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) + if err != nil { + return err + } + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().StringSlice(flagSymbols, []string{}, "Symbols used in calling the oracle script") + cmd.Flags().Uint64(flagPrepareGas, 0, "Prepare gas used in fee counting for prepare request") + cmd.Flags().Uint64(flagExecuteGas, 0, "Execute gas used in fee counting for execute request") + cmd.Flags().String(flagFeeLimit, "", "the maximum tokens that will be paid to all data source providers") + cmd.Flags().Uint64(flagRequestedValidatorCount, 0, "Requested Validator Count") + cmd.Flags().Uint64(flagSufficientValidatorCount, 0, "Sufficient Validator Count") + cmd.Flags().Uint64(flagMinSourceCount, 3, "Min Source Count") + cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") + cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") + cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewDeleteBandOracleRequestProposalTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete-band-oracle-request-proposal 1 [flags]", + Args: cobra.MinimumNArgs(1), + Short: "Submit a proposal to Delete a Band Oracle IBC Request.", + Long: `Submit a proposal to Delete a Band Oracle IBC Request. + Example: + $ %s tx oracle delete-band-oracle-request-proposal 1 --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + content, err := deleteBandOracleRequestProposalArgsToContent(cmd, args) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + + depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) + if err != nil { + return err + } + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") + cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") + cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func updateBandOracleRequestProposalArgsToContent( + cmd *cobra.Command, + args []string, +) (govtypes.Content, error) { + title, err := cmd.Flags().GetString(govcli.FlagTitle) + if err != nil { + return nil, err + } + + description, err := cmd.Flags().GetString(govcli.FlagDescription) + if err != nil { + return nil, err + } + + requestID, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return nil, err + } + + int64OracleScriptID, err := strconv.ParseInt(args[1], 10, 64) + if err != nil { + return nil, err + } + + askCount, err := cmd.Flags().GetUint64(flagRequestedValidatorCount) + if err != nil { + return nil, err + } + + minCount, err := cmd.Flags().GetUint64(flagSufficientValidatorCount) + if err != nil { + return nil, err + } + minSourceCount, err := cmd.Flags().GetUint64(flagMinSourceCount) + if err != nil { + return nil, err + } + + symbols, err := cmd.Flags().GetStringSlice(flagSymbols) + if err != nil { + return nil, err + } + + prepareGas, err := cmd.Flags().GetUint64(flagPrepareGas) + if err != nil { + return nil, err + } + + executeGas, err := cmd.Flags().GetUint64(flagExecuteGas) + if err != nil { + return nil, err + } + + coinStr, err := cmd.Flags().GetString(flagFeeLimit) + if err != nil { + return nil, err + } + + feeLimit, err := sdk.ParseCoinsNormalized(coinStr) + if err != nil { + return nil, err + } + + content := &types.UpdateBandOracleRequestProposal{ + Title: title, + Description: description, + UpdateOracleRequest: &types.BandOracleRequest{ + RequestId: uint64(requestID), + OracleScriptId: int64OracleScriptID, + Symbols: symbols, + AskCount: askCount, + MinCount: minCount, + FeeLimit: feeLimit, + PrepareGas: prepareGas, + ExecuteGas: executeGas, + MinSourceCount: minSourceCount, + }, + } + if err := content.ValidateBasic(); err != nil { + return nil, err + } + + return content, nil +} + +func deleteBandOracleRequestProposalArgsToContent( + cmd *cobra.Command, + args []string, +) (govtypes.Content, error) { + title, err := cmd.Flags().GetString(govcli.FlagTitle) + if err != nil { + return nil, err + } + + description, err := cmd.Flags().GetString(govcli.FlagDescription) + if err != nil { + return nil, err + } + + requestIDs := make([]uint64, 0, len(args)) + for _, arg := range args { + id, err := strconv.ParseInt(arg, 10, 64) + if err != nil { + return nil, err + } + + requestIDs = append(requestIDs, uint64(id)) + } + + content := &types.DeleteBandOracleRequestProposal{ + Title: title, + Description: description, + DeleteRequestIds: requestIDs, + } + + if err := content.ValidateBasic(); err != nil { + return nil, err + } + + return content, nil +} diff --git a/x/oracle/keeper/abci.go b/x/oracle/keeper/abci.go new file mode 100644 index 00000000..3c826447 --- /dev/null +++ b/x/oracle/keeper/abci.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "context" + "time" + + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +func BeginBlocker(ctx context.Context, k Keeper) error { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + bandParams := k.GetBandParams(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Request oracle prices using band IBC in frequent intervals + if sdkCtx.BlockHeight()%bandParams.IbcRequestInterval == 0 { + k.RequestAllBandRates(ctx) + } + + // todo: default cleanup interval (1 day) + if sdkCtx.BlockHeight()%86400 == 0 { + k.CleanUpStaleBandCalldataRecords(sdkCtx) + } + + return nil +} + +func (k *Keeper) RequestAllBandRates(ctx context.Context) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // TODO: check logic flow for this + bandOracleRequests := k.GetAllBandOracleRequests(ctx) + + if len(bandOracleRequests) == 0 { + return + } + + for _, req := range bandOracleRequests { + println("checking request .......") + for _, symbol := range req.Symbols { + println("With symbols: ", symbol) + } + err := k.RequestBandOraclePrices(ctx, req) + if err != nil { + sdkCtx.Logger().Error(err.Error()) + } + } +} + +func (k *Keeper) EndBlocker(ctx context.Context) { +} diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go new file mode 100644 index 00000000..b5be80b1 --- /dev/null +++ b/x/oracle/keeper/band_oracle.go @@ -0,0 +1,530 @@ +package keeper + +import ( + "context" + "fmt" + "strconv" + "time" + + errorsmod "cosmossdk.io/errors" + math "cosmossdk.io/math" + prefix "cosmossdk.io/store/prefix" + runtime "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/onomyprotocol/reserve/x/oracle/types" +) + +// SetBandParams sets the Band params in the state +func (k Keeper) SetBandParams(ctx context.Context, bandParams types.BandParams) error { + bz := k.cdc.MustMarshal(&bandParams) + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.BandParamsKey, bz) +} + +// GetBandParams gets the Band params stored in the state +func (k Keeper) GetBandParams(ctx context.Context) types.BandParams { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.BandParamsKey) + + if err != nil { + return types.DefaultGenesis().BandParams + } + + if bz == nil { + return types.DefaultGenesis().BandParams + } + + var bandParams types.BandParams + k.cdc.MustUnmarshal(bz, &bandParams) + return bandParams +} + +// SetBandOracleRequestParams sets the Band Oracle request params in the state +func (k Keeper) SetBandOracleRequestParams(ctx context.Context, bandOracleRequestParams types.BandOracleRequestParams) error { + bz := k.cdc.MustMarshal(&bandOracleRequestParams) + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.BandOracleRequestParamsKey, bz) +} + +// GetBandParams gets the Band params stored in the state +func (k Keeper) GetBandOracleRequestParams(ctx context.Context) types.BandOracleRequestParams { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.BandOracleRequestParamsKey) + + if err != nil { + return types.DefaultGenesis().BandOracleRequestParams + } + + if bz == nil { + return types.DefaultGenesis().BandOracleRequestParams + } + + var bandOracleRequestParams types.BandOracleRequestParams + k.cdc.MustUnmarshal(bz, &bandOracleRequestParams) + return bandOracleRequestParams +} + +// SetBandCallData sets the Band IBC oracle request call data +func (k Keeper) SetBandCallDataRecord(ctx context.Context, record *types.CalldataRecord) error { + bz := k.cdc.MustMarshal(record) + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.GetBandCallDataRecordKey(record.ClientId), bz) +} + +// DeleteBandCallDataRecord deletes the Band IBC oracle request call data +func (k Keeper) DeleteBandCallDataRecord(ctx context.Context, clientID uint64) error { + store := k.storeService.OpenKVStore(ctx) + return store.Delete(types.GetBandCallDataRecordKey(clientID)) +} + +// GetAllBandCalldataRecords gets all Band oracle request CallData for each clientID +func (k Keeper) GetAllBandCalldataRecords(ctx context.Context) []*types.CalldataRecord { + calldataRecords := make([]*types.CalldataRecord, 0) + kvStore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bandCalldataStore := prefix.NewStore(kvStore, types.BandCallDataRecordKey) + + iterator := bandCalldataStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var calldataRecord types.CalldataRecord + k.cdc.MustUnmarshal(iterator.Value(), &calldataRecord) + calldataRecords = append(calldataRecords, &calldataRecord) + } + + return calldataRecords +} + +// GetBandCallDataRecord gets the Band oracle request CallDataRecord for a given clientID +func (k Keeper) GetBandCallDataRecord(ctx context.Context, clientID uint64) *types.CalldataRecord { + var callDataRecord types.CalldataRecord + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.GetBandCallDataRecordKey(clientID)) + if err != nil { + return nil + } + if bz == nil { + return nil + } + k.cdc.MustUnmarshal(bz, &callDataRecord) + return &callDataRecord +} + +// GetBandLatestClientID returns the latest clientID of Band oracle request packet data. +func (k Keeper) GetBandLatestClientID(ctx context.Context) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.LatestClientIDKey) + if err != nil { + return 0 + } + if bz == nil { + return 0 + } + clientID := sdk.BigEndianToUint64(bz) + return clientID +} + +// SetBandLatestClientID sets the latest clientID of Band oracle request packet data. +func (k Keeper) SetBandLatestClientID(ctx context.Context, clientID uint64) error { + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.LatestClientIDKey, sdk.Uint64ToBigEndian(clientID)) +} + +// GetBandLatestRequestID returns the latest requestID of Band oracle request types. +func (k Keeper) GetBandLatestRequestID(ctx context.Context) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.LatestRequestIDKey) + if err != nil { + // TODO: should we return 0 here? + return 0 + } + if bz == nil { + return 0 + } + requestID := sdk.BigEndianToUint64(bz) + return requestID +} + +// SetBandLatestRequestID sets the latest requestID of Band oracle request types. +func (k Keeper) SetBandLatestRequestID(ctx context.Context, requestID uint64) error { + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.LatestRequestIDKey, sdk.Uint64ToBigEndian(requestID)) +} + +// SetBandOracleRequest sets the Band oracle request data +func (k Keeper) SetBandOracleRequest(ctx context.Context, req types.BandOracleRequest) error { + bz := k.cdc.MustMarshal(&req) + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.GetBandOracleRequestIDKey(req.RequestId), bz) +} + +// GetBandOracleRequest gets the Band oracle request data +func (k Keeper) GetBandOracleRequest(ctx context.Context, requestID uint64) *types.BandOracleRequest { + var bandOracleRequest types.BandOracleRequest + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.GetBandOracleRequestIDKey(requestID)) + if err != nil { + return nil + } + if bz == nil { + return nil + } + + k.cdc.MustUnmarshal(bz, &bandOracleRequest) + return &bandOracleRequest +} + +// DeleteBandOracleRequest deletes the Band oracle request call data +func (k Keeper) DeleteBandOracleRequest(ctx context.Context, requestID uint64) error { + store := k.storeService.OpenKVStore(ctx) + return store.Delete(types.GetBandOracleRequestIDKey(requestID)) +} + +// GetAllBandOracleRequests gets all Band oracle requests for each requestID +func (k Keeper) GetAllBandOracleRequests(ctx context.Context) []*types.BandOracleRequest { + bandOracleRequests := make([]*types.BandOracleRequest, 0) + kvStore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bandOracleRequestStore := prefix.NewStore(kvStore, types.BandOracleRequestIDKey) + + iterator := bandOracleRequestStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var bandOracleRequest types.BandOracleRequest + k.cdc.MustUnmarshal(iterator.Value(), &bandOracleRequest) + bandOracleRequests = append(bandOracleRequests, &bandOracleRequest) + } + + return bandOracleRequests +} + +// GetBandPriceState reads the stored band ibc price state. +func (k *Keeper) GetBandPriceState(ctx context.Context, symbol string) *types.BandPriceState { + var priceState types.BandPriceState + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.GetBandPriceStoreKey(symbol)) + if err != nil { + return nil + } + if bz == nil { + return nil + } + + k.cdc.MustUnmarshal(bz, &priceState) + return &priceState +} + +// SetBandPriceState sets the band ibc price state. +func (k *Keeper) SetBandPriceState(ctx context.Context, symbol string, priceState *types.BandPriceState) error { + bz := k.cdc.MustMarshal(priceState) + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.GetBandPriceStoreKey(symbol), bz) +} + +// GetAllBandPriceStates reads all stored band price states. +func (k *Keeper) GetAllBandPriceStates(ctx context.Context) []*types.BandPriceState { + priceStates := make([]*types.BandPriceState, 0) + kvStore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bandPriceStore := prefix.NewStore(kvStore, types.BandPriceKey) + + iterator := bandPriceStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var bandPriceState types.BandPriceState + k.cdc.MustUnmarshal(iterator.Value(), &bandPriceState) + priceStates = append(priceStates, &bandPriceState) + } + + return priceStates +} + +// AddNewSymbolToBandOracleRequest adds a new symbol to the bandOracle request +func (k Keeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + allBandOracleRequests := k.GetAllBandOracleRequests(ctx) + // check if new symbol's oracle script id is existing + for _, req := range allBandOracleRequests { + if req.OracleScriptId == oracleScriptId { + req.Symbols = append(req.Symbols, symbol) + k.SetBandOracleRequest(ctx, *req) + return nil + } + } + + bandOracleRequestParams := k.GetBandOracleRequestParams(ctx) + requestID := k.GetBandLatestRequestID(ctx) + 1 + newBandOracleRequest := types.BandOracleRequest{ + RequestId: requestID, + OracleScriptId: oracleScriptId, + Symbols: []string{symbol}, + AskCount: bandOracleRequestParams.AskCount, + MinCount: bandOracleRequestParams.MinCount, + FeeLimit: bandOracleRequestParams.FeeLimit, + PrepareGas: bandOracleRequestParams.PrepareGas, + ExecuteGas: bandOracleRequestParams.ExecuteGas, + MinSourceCount: bandOracleRequestParams.MinSourceCount, + } + + k.SetBandOracleRequest(ctx, newBandOracleRequest) + + k.SetBandLatestRequestID(ctx, requestID) + return nil +} + +// GetPrice fetches band ibc prices for a given pair in math.LegacyDec +func (k *Keeper) GetPrice(ctx context.Context, base, quote string) *math.LegacyDec { + // query ref by using GetBandPriceState + basePriceState := k.GetBandPriceState(ctx, base) + if basePriceState == nil || basePriceState.Rate.IsZero() { + return nil + } + + if quote == types.QuoteUSD { + return &basePriceState.PriceState.Price + } + + quotePriceState := k.GetBandPriceState(ctx, quote) + if quotePriceState == nil || quotePriceState.Rate.IsZero() { + return nil + } + + baseRate := basePriceState.Rate.ToLegacyDec() + quoteRate := quotePriceState.Rate.ToLegacyDec() + + if baseRate.IsNil() || quoteRate.IsNil() || !baseRate.IsPositive() || !quoteRate.IsPositive() { + return nil + } + + price := baseRate.Quo(quoteRate) + return &price +} + +// RequestBandOraclePrices creates and sends an IBC packet to fetch band oracle price feed data through IBC. +func (k *Keeper) RequestBandOraclePrices( + ctx context.Context, + req *types.BandOracleRequest, +) (err error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + bandParams := k.GetBandParams(ctx) + sourcePortID := bandParams.IbcPortId + sourceChannel := bandParams.IbcSourceChannel + + calldata := req.GetCalldata(types.IsLegacySchemeOracleScript(req.OracleScriptId, bandParams)) + + sourceChannelEnd, found := k.ibcKeeperFn().ChannelKeeper.GetChannel(sdkCtx, sourcePortID, sourceChannel) + if !found { + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unknown channel %s port %s", sourceChannel, sourcePortID) + } + + // retrieve the dynamic capability for this channel + channelCap, ok := k.ScopedKeeper().GetCapability(sdkCtx, host.ChannelCapabilityPath(sourcePortID, sourceChannel)) + if !ok { + return errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") + } + + destinationPort := sourceChannelEnd.Counterparty.PortId + destinationChannel := sourceChannelEnd.Counterparty.ChannelId + sequence, found := k.ibcKeeperFn().ChannelKeeper.GetNextSequenceSend(sdkCtx, sourcePortID, sourceChannel) + + if !found { + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unknown sequence number for channel %s port %s", sourceChannel, sourcePortID) + } + + clientID := k.GetBandLatestClientID(ctx) + 1 + packetData := types.NewOracleRequestPacketData(strconv.Itoa(int(clientID)), calldata, req) + + // Creating custom oracle packet data + packet := channeltypes.NewPacket( + packetData.GetBytes(), + sequence, + sourcePortID, + sourceChannel, + destinationPort, + destinationChannel, + clienttypes.NewHeight(0, 0), + uint64(sdkCtx.BlockTime().UnixNano()+int64(20*time.Minute)), // Arbitrarily high timeout for now + ) + + // Send packet to IBC, authenticating with channelCap + _, err = k.ibcKeeperFn().ChannelKeeper.SendPacket( + sdkCtx, + channelCap, + packet.SourcePort, + packet.SourceChannel, + packet.TimeoutHeight, + packet.TimeoutTimestamp, + packet.Data, + ) + if err != nil { + return err + } + + // Persist the sequence number and OracleRequest CallData. CallData contains list of symbols. + // This is used to map the prices/rates with the symbols upon receiving oracle response from Band IBC. + k.SetBandCallDataRecord(ctx, &types.CalldataRecord{ + ClientId: clientID, + Calldata: calldata, + }) + + k.SetBandLatestClientID(ctx, clientID) + + return +} + +func (k *Keeper) ProcessBandOraclePrices( + ctx sdk.Context, + relayer sdk.Address, + packet types.OracleResponsePacketData, +) error { + clientID, err := strconv.Atoi(packet.ClientID) + if err != nil { + return fmt.Errorf("failed to parse client ID: %w", err) + } + + callRecord := k.GetBandCallDataRecord(ctx, uint64(clientID)) + if callRecord == nil { + // TODO: should this be an error? + return nil + } + + input, err := types.DecodeOracleInput(callRecord.Calldata) + if err != nil { + return err + } + + output, err := types.DecodeOracleOutput(packet.Result) + if err != nil { + return err + } + + k.updateBandPriceStates(ctx, input, output, packet, relayer, clientID) + + // Delete the calldata corresponding to the sequence number + k.DeleteBandCallDataRecord(ctx, uint64(clientID)) + + return nil +} + +func (k *Keeper) updateBandPriceStates( + ctx sdk.Context, + input types.OracleInput, + output types.OracleOutput, + packet types.OracleResponsePacketData, + relayer sdk.Address, + clientID int, +) { + var ( + inputSymbols = input.PriceSymbols() + requestID = packet.RequestID + resolveTime = uint64(packet.ResolveTime) + symbols = make([]string, 0, len(inputSymbols)) + prices = make([]math.LegacyDec, 0, len(inputSymbols)) + ) + + // loop SetBandPriceState for all symbols + for idx, symbol := range inputSymbols { + if !output.Valid(idx) { + // failed response for given symbol, skip it + continue + } + + var ( + rate = output.Rate(idx) + multiplier = input.PriceMultiplier() + price = math.LegacyNewDec(int64(rate)).Quo(math.LegacyNewDec(int64(multiplier))) + ) + println("Checking symbol: %s and price: %s", symbol, price.String()) + if price.IsZero() { + continue + } + + bandPriceState := k.GetBandPriceState(ctx, symbol) + + // don't update band prices with an older price + if bandPriceState != nil && bandPriceState.ResolveTime > resolveTime { + continue + } + + // skip price update if the price changes beyond 100x or less than 1% of the last price + if bandPriceState != nil && types.CheckPriceFeedThreshold(bandPriceState.PriceState.Price, price) { + continue + } + + blockTime := ctx.BlockTime().Unix() + if bandPriceState == nil { + bandPriceState = &types.BandPriceState{ + Symbol: symbol, + Rate: math.NewInt(int64(rate)), + ResolveTime: resolveTime, + Request_ID: requestID, + PriceState: *types.NewPriceState(price, blockTime), + } + } else { + bandPriceState.Rate = math.NewInt(int64(rate)) + bandPriceState.ResolveTime = resolveTime + bandPriceState.Request_ID = requestID + bandPriceState.PriceState.UpdatePrice(price, blockTime) + } + + err := k.SetBandPriceState(ctx, symbol, bandPriceState) + if err != nil { + k.Logger(ctx).Info("Can not set band price state for symbol %v", symbol) + } + + symbols = append(symbols, symbol) + prices = append(prices, price) + } + + if len(symbols) == 0 { + return + } + + // emit SetBandPriceEvent event + // nolint:errcheck //ignored on purpose + ctx.EventManager().EmitTypedEvent(&types.SetBandPriceEvent{ + Relayer: relayer.String(), + Symbols: symbols, + Prices: prices, + ResolveTime: uint64(packet.ResolveTime), + RequestId: packet.RequestID, + ClientId: int64(clientID), + }) +} + +func (k *Keeper) CleanUpStaleBandCalldataRecords(ctx context.Context) { + var ( + latestClientID = k.GetBandLatestClientID(ctx) + earliestToKeepClientID = latestClientID - 1000 // todo: default max records to keep (1000) + ) + + if earliestToKeepClientID > latestClientID { + // underflow + return + } + + for _, id := range k.getPreviousRecordIDs(ctx, earliestToKeepClientID) { + k.DeleteBandCallDataRecord(ctx, id) + } +} + +func (k *Keeper) getPreviousRecordIDs(ctx context.Context, clientID uint64) []uint64 { + kvStore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bandCalldataStore := prefix.NewStore(kvStore, types.BandCallDataRecordKey) + iter := bandCalldataStore.Iterator(nil, sdk.Uint64ToBigEndian(clientID)) + defer iter.Close() + + staleIDs := make([]uint64, 0) + for ; iter.Valid(); iter.Next() { + var record types.CalldataRecord + k.cdc.MustUnmarshal(iter.Value(), &record) + + staleIDs = append(staleIDs, record.ClientId) + } + + return staleIDs +} diff --git a/x/oracle/keeper/band_oracle_test.go b/x/oracle/keeper/band_oracle_test.go new file mode 100644 index 00000000..b6dcdcca --- /dev/null +++ b/x/oracle/keeper/band_oracle_test.go @@ -0,0 +1,423 @@ +package keeper_test + +import ( + "testing" + "time" + + "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/app" + "github.com/onomyprotocol/reserve/x/oracle/types" + "github.com/onomyprotocol/reserve/x/oracle/utils" + "github.com/stretchr/testify/require" +) + +func TestBandPriceState(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + // Band price state is nil now + data := app.OracleKeeper.GetBandPriceState(ctx, "ATOM") + require.Nil(t, data) + + states := app.OracleKeeper.GetAllBandPriceStates(ctx) + require.Equal(t, 0, len(states)) + + price := app.OracleKeeper.GetPrice(ctx, "ATOM", "USD") + require.Nil(t, price) + + bandPriceState := &types.BandPriceState{ + Symbol: "ATOM", + Rate: math.NewInt(10), + ResolveTime: 1, + Request_ID: 1, + PriceState: *types.NewPriceState(math.LegacyNewDec(10), 1), + } + // set band price state for ATOM + err := app.OracleKeeper.SetBandPriceState(ctx, "ATOM", bandPriceState) + require.NoError(t, err) + + data = app.OracleKeeper.GetBandPriceState(ctx, "ATOM") + require.Equal(t, bandPriceState, data) + + price = app.OracleKeeper.GetPrice(ctx, "ATOM", "USD") + expect := math.LegacyNewDec(10) + require.Equal(t, &expect, price) + + states = app.OracleKeeper.GetAllBandPriceStates(ctx) + require.Equal(t, 1, len(states)) +} + +func TestBandOracleRequest(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + req := app.OracleKeeper.GetBandOracleRequest(ctx, 1) + require.Nil(t, req) + + reqs := app.OracleKeeper.GetAllBandOracleRequests(ctx) + require.Equal(t, 0, len(reqs)) + + bandOracleRequest := types.BandOracleRequest{ + RequestId: 1, + OracleScriptId: 1, + Symbols: []string{"INJ"}, + AskCount: 1, + MinCount: 1, + FeeLimit: sdk.Coins{sdk.NewInt64Coin("INJ", 1)}, + PrepareGas: 100, + ExecuteGas: 200, + } + err := app.OracleKeeper.SetBandOracleRequest(ctx, bandOracleRequest) + require.NoError(t, err) + + req = app.OracleKeeper.GetBandOracleRequest(ctx, 1) + require.Equal(t, &bandOracleRequest, req) + reqs = app.OracleKeeper.GetAllBandOracleRequests(ctx) + require.Equal(t, 1, len(reqs)) + + // delete request and try again + err = app.OracleKeeper.DeleteBandOracleRequest(ctx, 1) + require.NoError(t, err) + reqs = app.OracleKeeper.GetAllBandOracleRequests(ctx) + require.Equal(t, 0, len(reqs)) +} + +func TestBandLatestClientId(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + id := app.OracleKeeper.GetBandLatestClientID(ctx) + require.Equal(t, uint64(0), id) + + err := app.OracleKeeper.SetBandLatestClientID(ctx, 10) + require.NoError(t, err) + + id = app.OracleKeeper.GetBandLatestClientID(ctx) + require.Equal(t, uint64(10), id) +} + +func TestBandLatestRequestId(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + id := app.OracleKeeper.GetBandLatestRequestID(ctx) + require.Equal(t, uint64(0), id) + + err := app.OracleKeeper.SetBandLatestRequestID(ctx, 1) + require.NoError(t, err) + + id = app.OracleKeeper.GetBandLatestRequestID(ctx) + require.Equal(t, uint64(1), id) +} + +func TestBandCallDataRecord(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + record := app.OracleKeeper.GetBandCallDataRecord(ctx, 1) + require.Nil(t, record) + + recordA := &types.CalldataRecord{ + ClientId: 1, + Calldata: []byte("123"), + } + err := app.OracleKeeper.SetBandCallDataRecord(ctx, recordA) + require.NoError(t, err) + record = app.OracleKeeper.GetBandCallDataRecord(ctx, 1) + require.Equal(t, recordA, record) + + err = app.OracleKeeper.DeleteBandCallDataRecord(ctx, 1) + require.NoError(t, err) + + record = app.OracleKeeper.GetBandCallDataRecord(ctx, 1) + require.Nil(t, record) +} + +func TestCleanStaleBandCallDataRecord(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + for id := 0; id < 1010; id++ { + record := &types.CalldataRecord{ + ClientId: uint64(id), + Calldata: []byte("123"), + } + err := app.OracleKeeper.SetBandCallDataRecord(ctx, record) + require.NoError(t, err) + } + records := app.OracleKeeper.GetAllBandCalldataRecords(ctx) + require.Equal(t, 1010, len(records)) + + err := app.OracleKeeper.SetBandLatestClientID(ctx, uint64(1010)) + require.NoError(t, err) + app.OracleKeeper.CleanUpStaleBandCalldataRecords(ctx) + records = app.OracleKeeper.GetAllBandCalldataRecords(ctx) + require.Equal(t, 1000, len(records)) +} + +func TestGetPrice(t *testing.T) { + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + // Setup test data + bandPriceStateATOM := &types.BandPriceState{ + Symbol: "ATOM", + Rate: math.NewInt(10), + ResolveTime: 1, + Request_ID: 1, + PriceState: *types.NewPriceState(math.LegacyNewDec(10), 1), + } + bandPriceStateUSD := &types.BandPriceState{ + Symbol: "USD", + Rate: math.NewInt(1), + ResolveTime: 1, + Request_ID: 1, + PriceState: *types.NewPriceState(math.LegacyNewDec(1), 1), + } + bandPriceStateNOM := &types.BandPriceState{ + Symbol: "NOM", + Rate: math.NewInt(2), + ResolveTime: 1, + Request_ID: 1, + PriceState: *types.NewPriceState(math.LegacyNewDec(2), 1), + } + invalidPriceStateATOM := &types.BandPriceState{ + Symbol: "ATOM", + Rate: math.NewInt(0), // Invalid base rate + ResolveTime: 1, + Request_ID: 1, + PriceState: *types.NewPriceState(math.LegacyNewDec(0), 1), + } + + // Create variables for expected prices + expectedPrice10 := math.LegacyNewDec(10) + expectedPrice05 := math.LegacyNewDec(5) // For ATOM/NOM (10/2) + expectedPrice01 := math.LegacyNewDec(1).Quo(math.LegacyNewDec(10)) // 0.1 + + tests := []struct { + name string + baseSymbol string + quoteSymbol string + basePriceState *types.BandPriceState + quotePriceState *types.BandPriceState + expectedPrice *math.LegacyDec + expectNil bool + }{ + // Return nil cases first + { + name: "Base, quote price do not exist, expect nil", + baseSymbol: "ATOM", + quoteSymbol: "USD", + basePriceState: nil, + quotePriceState: nil, + expectedPrice: nil, + expectNil: true, + }, + { + name: "Base price is invalid (rate is zero), expect nil", + baseSymbol: "ATOM", + quoteSymbol: "USD", + basePriceState: invalidPriceStateATOM, + quotePriceState: bandPriceStateUSD, + expectedPrice: nil, + expectNil: true, + }, + { + name: "Valid base price (ATOM), quote NOM does not exist, expect nil", + baseSymbol: "ATOM", + quoteSymbol: "NOM", + basePriceState: bandPriceStateATOM, + quotePriceState: nil, + expectedPrice: nil, // Since NOM doesn't exist, expect nil + expectNil: true, + }, + // return a valid price + { + name: "Valid base price (ATOM), valid quote price (NOM), expect 5 for ATOM/NOM", + baseSymbol: "ATOM", + quoteSymbol: "NOM", + basePriceState: bandPriceStateATOM, + quotePriceState: bandPriceStateNOM, + expectedPrice: &expectedPrice05, // 10/2 = 5 + expectNil: false, + }, + { + name: "Valid base price (ATOM), quote does not exist, expect 10", + baseSymbol: "ATOM", + quoteSymbol: "USD", + basePriceState: bandPriceStateATOM, + quotePriceState: nil, + expectedPrice: &expectedPrice10, // Since quote = USD, we return base price directly + expectNil: false, + }, + { + name: "Valid base and quote price, expect 10 for ATOM/USD", + baseSymbol: "ATOM", + quoteSymbol: "USD", + basePriceState: bandPriceStateATOM, + quotePriceState: bandPriceStateUSD, + expectedPrice: &expectedPrice10, + expectNil: false, + }, + { + name: "Reverse price (USD to ATOM), expect 0.1", + baseSymbol: "USD", + quoteSymbol: "ATOM", + basePriceState: bandPriceStateUSD, + quotePriceState: bandPriceStateATOM, + expectedPrice: &expectedPrice01, + expectNil: false, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + // Set up base and quote prices + if tc.basePriceState != nil { + err := app.OracleKeeper.SetBandPriceState(ctx, tc.baseSymbol, tc.basePriceState) + require.NoError(t, err) + } + if tc.quotePriceState != nil { + err := app.OracleKeeper.SetBandPriceState(ctx, tc.quoteSymbol, tc.quotePriceState) + require.NoError(t, err) + } + + // Execute GetPrice + price := app.OracleKeeper.GetPrice(ctx, tc.baseSymbol, tc.quoteSymbol) + + // Check expectations + if tc.expectNil { + require.Nil(t, price) + } else { + require.NotNil(t, price) + require.Equal(t, tc.expectedPrice, price) + } + }) + } +} + +func TestProcessBandOraclePrices(t *testing.T) { + // Set up the application and context + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + // Define table-driven test cases + tests := []struct { + name string + clientID string + calldata *types.CalldataRecord + oracleOutput interface{} + expectedError bool + expectedRate int64 + }{ + { + name: "Fail when ClientID is not a valid integer", + clientID: "invalid-id", + calldata: nil, + oracleOutput: nil, + expectedError: true, + }, + { + name: "Return nil when no CallDataRecord found", + clientID: "1", + calldata: nil, + oracleOutput: nil, + expectedError: false, + }, + { + name: "Fail when decoding OracleInput", + clientID: "1", + calldata: &types.CalldataRecord{ + ClientId: 1, + Calldata: []byte{0xFF, 0xFF}, + }, + oracleOutput: nil, + expectedError: true, + }, + { + name: "Fail when decoding OracleOutput", + clientID: "1", + calldata: &types.CalldataRecord{ + ClientId: 1, + Calldata: utils.MustEncode(types.Input{ + Symbols: []string{"ATOM", "BTC"}, + Multiplier: types.BandPriceMultiplier, + }), + }, + oracleOutput: []byte{0xFF, 0xFF}, + expectedError: true, + }, + { + name: "Success with valid OracleResponsePacketData", + clientID: "1", + calldata: &types.CalldataRecord{ + ClientId: 1, + Calldata: utils.MustEncode(types.Input{ + Symbols: []string{"ATOM", "BTC"}, + Multiplier: types.BandPriceMultiplier, + }), + }, + oracleOutput: types.BandOutput{ + Responses: []types.Response{ + {Symbol: "ATOM", ResponseCode: 0, Rate: 100 * types.BandPriceMultiplier}, + {Symbol: "BTC", ResponseCode: 0, Rate: 50000 * types.BandPriceMultiplier}, + }, + }, + expectedError: false, + expectedRate: 100, + }, + } + + // Iterate over each test case + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.calldata != nil { + err := app.OracleKeeper.SetBandCallDataRecord(ctx, tt.calldata) + require.NoError(t, err) + } + + var result []byte + if tt.oracleOutput != nil { + switch v := tt.oracleOutput.(type) { + case types.BandOutput: + result = utils.MustEncode(v) + case []byte: + result = v + } + } + + oraclePacketData := types.OracleResponsePacketData{ + ClientID: tt.clientID, + RequestID: 1, + Result: result, + ResolveTime: time.Now().Unix(), + } + + relayer := sdk.AccAddress("mock-relayer-address") + + err := app.OracleKeeper.ProcessBandOraclePrices(ctx, relayer, oraclePacketData) + + if tt.expectedError { + require.Error(t, err) + } else { + require.NoError(t, err) + + record := app.OracleKeeper.GetBandCallDataRecord(ctx, 1) + require.Nil(t, record, "BandCallDataRecord was not deleted after processing") + + if tt.expectedRate != 0 { + priceState := app.OracleKeeper.GetBandPriceState(ctx, "ATOM") + require.NotNil(t, priceState) + + actualPrice := priceState.PriceState.Price + + expectedPrice := math.LegacyNewDec(tt.expectedRate) + require.True(t, actualPrice.Equal(expectedPrice), "Price for ATOM did not match. Expected: %s, Got: %s", expectedPrice, actualPrice) + } + } + }) + } +} diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 981b3378..f3dc10bd 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -2,7 +2,7 @@ package keeper import ( "fmt" - + "context" "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" @@ -10,8 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -59,14 +59,16 @@ func NewKeeper( } } + // GetAuthority returns the module's authority. func (k Keeper) GetAuthority() string { return k.authority } // Logger returns a module-specific logger. -func (k Keeper) Logger() log.Logger { - return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +func (k Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return sdkCtx.Logger().With("module", types.ModuleName) } // ---------------------------------------------------------------------------- @@ -74,55 +76,60 @@ func (k Keeper) Logger() log.Logger { // ---------------------------------------------------------------------------- // ChanCloseInit defines a wrapper function for the channel Keeper's function. -func (k *Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error { +func (k *Keeper) ChanCloseInit(ctx context.Context, portID, channelID string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) capName := host.ChannelCapabilityPath(portID, channelID) - chanCap, ok := k.ScopedKeeper().GetCapability(ctx, capName) + chanCap, ok := k.ScopedKeeper().GetCapability(sdkCtx, capName) if !ok { return errorsmod.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName) } - return k.ibcKeeperFn().ChannelKeeper.ChanCloseInit(ctx, portID, channelID, chanCap) + return k.ibcKeeperFn().ChannelKeeper.ChanCloseInit(sdkCtx, portID, channelID, chanCap) } // ShouldBound checks if the IBC app module can be bound to the desired port -func (k *Keeper) ShouldBound(ctx sdk.Context, portID string) bool { +func (k *Keeper) ShouldBound(ctx context.Context, portID string) bool { + sdkCtx := sdk.UnwrapSDKContext(ctx) scopedKeeper := k.ScopedKeeper() if scopedKeeper == nil { return false } - _, ok := scopedKeeper.GetCapability(ctx, host.PortPath(portID)) + _, ok := scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID)) return !ok } // BindPort defines a wrapper function for the port Keeper's function in // order to expose it to module's InitGenesis function -func (k *Keeper) BindPort(ctx sdk.Context, portID string) error { - cap := k.ibcKeeperFn().PortKeeper.BindPort(ctx, portID) +func (k *Keeper) BindPort(ctx context.Context, portID string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + cap := k.ibcKeeperFn().PortKeeper.BindPort(sdkCtx, portID) return k.ClaimCapability(ctx, cap, host.PortPath(portID)) } // GetPort returns the portID for the IBC app module. Used in ExportGenesis -func (k *Keeper) GetPort(ctx sdk.Context) string { +func (k *Keeper) GetPort(ctx context.Context) string { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, []byte{}) return string(store.Get(types.PortKey)) } // SetPort sets the portID for the IBC app module. Used in InitGenesis -func (k *Keeper) SetPort(ctx sdk.Context, portID string) { +func (k *Keeper) SetPort(ctx context.Context, portID string) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, []byte{}) store.Set(types.PortKey, []byte(portID)) } // AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k *Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.ScopedKeeper().AuthenticateCapability(ctx, cap, name) +func (k *Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.ScopedKeeper().AuthenticateCapability(sdkCtx, cap, name) } // ClaimCapability allows the IBC app module to claim a capability that core IBC // passes to it -func (k *Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.ScopedKeeper().ClaimCapability(ctx, cap, name) +func (k *Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.ScopedKeeper().ClaimCapability(sdkCtx, cap, name) } // ScopedKeeper returns the ScopedKeeper diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go new file mode 100644 index 00000000..0148e6ea --- /dev/null +++ b/x/oracle/keeper/keeper_test.go @@ -0,0 +1,15 @@ +package keeper_test + +import ( + "testing" + testifysuite "github.com/stretchr/testify/suite" + apptesting "github.com/onomyprotocol/reserve/app/apptesting" +) + +type KeeperTestSuite struct { + apptesting.KeeperTestHelper +} + +func TestKeeperTestSuite(t *testing.T) { + testifysuite.Run(t, new(KeeperTestSuite)) +} \ No newline at end of file diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index 2c4a4bcb..497478e1 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -1,6 +1,9 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/onomyprotocol/reserve/x/oracle/types" ) @@ -15,3 +18,19 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { } var _ types.MsgServer = msgServer{} + +func (k Keeper) RequestBandRates(goCtx context.Context, msg *types.MsgRequestBandRates) (*types.MsgRequestBandRatesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + bandOracleRequest := k.GetBandOracleRequest(ctx, msg.RequestId) + if bandOracleRequest == nil { + return nil, errorsmod.Wrapf(types.ErrInvalidBandRequest, "Band oracle request not found!") + } + + if err := k.RequestBandOraclePrices(ctx, bandOracleRequest); err != nil { + k.Logger(ctx).Error(err.Error()) + return nil, err + } + + return &types.MsgRequestBandRatesResponse{}, nil +} diff --git a/x/oracle/keeper/query.go b/x/oracle/keeper/query.go index fa8e62ee..997c24a4 100644 --- a/x/oracle/keeper/query.go +++ b/x/oracle/keeper/query.go @@ -1,7 +1,19 @@ package keeper import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/onomyprotocol/reserve/x/oracle/types" ) var _ types.QueryServer = Keeper{} + +func (k Keeper) BandPriceStates(c context.Context, _ *types.QueryBandPriceStatesRequest) (*types.QueryBandPriceStatesResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + res := &types.QueryBandPriceStatesResponse{ + PriceStates: k.GetAllBandPriceStates(ctx), + } + + return res, nil +} \ No newline at end of file diff --git a/x/oracle/module/genesis.go b/x/oracle/module/genesis.go index f94ce278..54210700 100644 --- a/x/oracle/module/genesis.go +++ b/x/oracle/module/genesis.go @@ -1,38 +1,67 @@ package oracle import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/onomyprotocol/reserve/x/oracle/keeper" "github.com/onomyprotocol/reserve/x/oracle/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetPort(ctx, genState.PortId) - // Only try to bind to port if it is not already bound, since we may already own - // port capability from capability InitGenesis - if k.ShouldBound(ctx, genState.PortId) { - // module binds to the port on InitChain - // and claims the returned capability - err := k.BindPort(ctx, genState.PortId) - if err != nil { - panic("could not claim port capability: " + err.Error()) - } - } +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { if err := k.SetParams(ctx, genState.Params); err != nil { + // TODO: should we panic here panic(err) } -} -// ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) + for _, bandPriceState := range genState.BandPriceStates { + k.SetBandPriceState(ctx, bandPriceState.Symbol, bandPriceState) + } + + for _, bandOracleRequest := range genState.BandOracleRequests { + k.SetBandOracleRequest(ctx, *bandOracleRequest) + } + + k.SetBandParams(ctx, genState.BandParams) + + if genState.BandParams.IbcPortId != "" { + k.SetPort(ctx, genState.BandParams.IbcPortId) + // Only try to bind to port if it is not already bound, since we may already own port capability + if k.ShouldBound(ctx, genState.BandParams.IbcPortId) { + // module binds to the port on InitChain + // and claims the returned capability + err := k.BindPort(ctx, genState.BandParams.IbcPortId) + if err != nil { + panic(types.ErrBandPortBind.Error() + err.Error()) + } + } + } + + if genState.BandLatestClientId != 0 { + k.SetBandLatestClientID(ctx, genState.BandLatestClientId) + } + + for _, record := range genState.CalldataRecords { + k.SetBandCallDataRecord(ctx, record) + } - genesis.PortId = k.GetPort(ctx) - // this line is used by starport scaffolding # genesis/module/export + if genState.BandLatestRequestId != 0 { + k.SetBandLatestRequestID(ctx, genState.BandLatestRequestId) + } + + k.SetBandOracleRequestParams(ctx, genState.BandOracleRequestParams) +} - return genesis +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + BandParams: k.GetBandParams(ctx), + BandPriceStates: k.GetAllBandPriceStates(ctx), + BandOracleRequests: k.GetAllBandOracleRequests(ctx), + BandLatestClientId: k.GetBandLatestClientID(ctx), + CalldataRecords: k.GetAllBandCalldataRecords(ctx), + BandLatestRequestId: k.GetBandLatestRequestID(ctx), + BandOracleRequestParams: k.GetBandOracleRequestParams(ctx), + } } diff --git a/x/oracle/module/genesis_test.go b/x/oracle/module/genesis_test.go index 6410bd4e..5919085b 100644 --- a/x/oracle/module/genesis_test.go +++ b/x/oracle/module/genesis_test.go @@ -14,7 +14,6 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), - PortId: types.PortID, // this line is used by starport scaffolding # genesis/test/state } @@ -26,7 +25,5 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) - require.Equal(t, genesisState.PortId, got.PortId) - // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/oracle/module/module.go b/x/oracle/module/module.go index a4350ccd..6a041a26 100644 --- a/x/oracle/module/module.go +++ b/x/oracle/module/module.go @@ -32,7 +32,6 @@ import ( var ( _ module.AppModuleBasic = (*AppModule)(nil) - _ module.AppModuleSimulation = (*AppModule)(nil) _ module.HasGenesis = (*AppModule)(nil) _ module.HasInvariants = (*AppModule)(nil) _ module.HasConsensusVersion = (*AppModule)(nil) @@ -64,7 +63,9 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used // to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { @@ -99,6 +100,11 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { return cli.GetTxCmd() } +// GetQueryCmd returns no root query command for the oracle module. +func (a AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + // ---------------------------------------------------------------------------- // AppModule // ---------------------------------------------------------------------------- @@ -157,13 +163,13 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block. // The begin block implementation is optional. -func (am AppModule) BeginBlock(_ context.Context) error { - return nil +func (am AppModule) BeginBlock(ctx context.Context) error { + return keeper.BeginBlocker(sdk.UnwrapSDKContext(ctx), am.keeper) } // EndBlock contains the logic that is automatically triggered at the end of each block. // The end block implementation is optional. -func (am AppModule) EndBlock(_ context.Context) error { +func (am AppModule) EndBlock(ctx context.Context) error { return nil } diff --git a/x/oracle/module/module_ibc.go b/x/oracle/module/module_ibc.go index 3f0bafe6..7909d269 100644 --- a/x/oracle/module/module_ibc.go +++ b/x/oracle/module/module_ibc.go @@ -2,9 +2,10 @@ package oracle import ( "fmt" - "github.com/onomyprotocol/reserve/x/oracle/keeper" "github.com/onomyprotocol/reserve/x/oracle/types" + "strconv" + "strings" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -46,8 +47,14 @@ func (im IBCModule) OnChanOpenInit( return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } - if version != types.Version { - return "", errorsmod.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.Version) + bandParams := im.keeper.GetBandParams(ctx) + + if strings.TrimSpace(version) == "" { + version = bandParams.IbcVersion + } + + if version != bandParams.IbcVersion { + return "", errorsmod.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, bandParams.IbcVersion) } // Claim channel capability passed back by IBC module @@ -76,8 +83,10 @@ func (im IBCModule) OnChanOpenTry( return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } - if counterpartyVersion != types.Version { - return "", errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) + bandParams := im.keeper.GetBandParams(ctx) + + if counterpartyVersion != bandParams.IbcVersion { + return "", errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, bandParams.IbcVersion) } // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos @@ -91,7 +100,7 @@ func (im IBCModule) OnChanOpenTry( } } - return types.Version, nil + return bandParams.IbcVersion, nil } // OnChanOpenAck implements the IBCModule interface @@ -102,8 +111,10 @@ func (im IBCModule) OnChanOpenAck( _, counterpartyVersion string, ) error { - if counterpartyVersion != types.Version { - return errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) + bandParams := im.keeper.GetBandParams(ctx) + + if counterpartyVersion != bandParams.IbcVersion { + return errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, bandParams.IbcVersion) } return nil } @@ -142,25 +153,26 @@ func (im IBCModule) OnRecvPacket( modulePacket channeltypes.Packet, relayer sdk.AccAddress, ) ibcexported.Acknowledgement { - // var ack channeltypes.Acknowledgement - - // this line is used by starport scaffolding # oracle/packet/module/recv - - var modulePacketData types.OraclePacketData - if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + var resp types.OracleResponsePacketData + if err := types.ModuleCdc.UnmarshalJSON(modulePacket.GetData(), &resp); err != nil { return channeltypes.NewErrorAcknowledgement(errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error())) } - // Dispatch packet - switch packet := modulePacketData.Packet.(type) { - // this line is used by starport scaffolding # ibc/packet/module/recv - default: - err := fmt.Errorf("unrecognized %s packet type: %T", types.ModuleName, packet) - return channeltypes.NewErrorAcknowledgement(err) + if resp.ResolveStatus != types.RESOLVE_STATUS_SUCCESS { + clientID, err := strconv.Atoi(resp.ClientID) + if err != nil { + return channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed to parse client ID: %w", err)) + } + // Delete the calldata corresponding to the sequence number + im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + return channeltypes.NewErrorAcknowledgement(types.ErrResolveStatusNotSuccess) + } + println("Process OnrecvPacket ..........") + if err := im.keeper.ProcessBandOraclePrices(ctx, relayer, resp); err != nil { + return channeltypes.NewErrorAcknowledgement(fmt.Errorf("cannot process Oracle response packet data: %w", err)) } - // NOTE: acknowledgement will be written synchronously during IBC handler execution. - // return ack + return channeltypes.NewResultAcknowledgement([]byte{byte(1)}) } // OnAcknowledgementPacket implements the IBCModule interface @@ -175,49 +187,35 @@ func (im IBCModule) OnAcknowledgementPacket( return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet acknowledgement: %v", err) } - // this line is used by starport scaffolding # oracle/packet/module/ack - - var modulePacketData types.OraclePacketData - if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + var data types.OracleRequestPacketData + if err := types.ModuleCdc.UnmarshalJSON(modulePacket.GetData(), &data); err != nil { return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) } - // var eventType string - - // Dispatch packet - switch packet := modulePacketData.Packet.(type) { - // this line is used by starport scaffolding # ibc/packet/module/ack - default: - errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) - return errorsmod.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - - // ctx.EventManager().EmitEvent( - // sdk.NewEvent( - // eventType, - // sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - // sdk.NewAttribute(types.AttributeKeyAck, fmt.Sprintf("%v", ack)), - // ), - // ) - - // switch resp := ack.Response.(type) { - // case *channeltypes.Acknowledgement_Result: - // ctx.EventManager().EmitEvent( - // sdk.NewEvent( - // eventType, - // sdk.NewAttribute(types.AttributeKeyAckSuccess, string(resp.Result)), - // ), - // ) - // case *channeltypes.Acknowledgement_Error: - // ctx.EventManager().EmitEvent( - // sdk.NewEvent( - // eventType, - // sdk.NewAttribute(types.AttributeKeyAckError, resp.Error), - // ), - // ) - // } - - // return nil + clientID, err := strconv.Atoi(data.ClientID) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot parse client id: %s", err.Error()) + } + + switch resp := ack.Response.(type) { + case *channeltypes.Acknowledgement_Result: + // the acknowledgement succeeded on the receiving chain so nothing + // needs to be executed and no error needs to be returned + // nolint:errcheck //ignored on purpose + ctx.EventManager().EmitTypedEvent(&types.EventBandAckSuccess{ + AckResult: string(resp.Result), + ClientId: int64(clientID), + }) + case *channeltypes.Acknowledgement_Error: + im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + // nolint:errcheck //ignored on purpose + ctx.EventManager().EmitTypedEvent(&types.EventBandAckError{ + AckError: resp.Error, + ClientId: int64(clientID), + }) + } + + return nil } // OnTimeoutPacket implements the IBCModule interface @@ -226,18 +224,22 @@ func (im IBCModule) OnTimeoutPacket( modulePacket channeltypes.Packet, relayer sdk.AccAddress, ) error { - var modulePacketData types.OraclePacketData - if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + var data types.OracleRequestPacketData + if err := types.ModuleCdc.UnmarshalJSON(modulePacket.GetData(), &data); err != nil { return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) } - // Dispatch packet - switch packet := modulePacketData.Packet.(type) { - // this line is used by starport scaffolding # ibc/packet/module/timeout - default: - errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) - return errorsmod.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + clientID, err := strconv.Atoi(data.ClientID) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot parse client id: %s", err.Error()) } - // return nil + // Delete the calldata corresponding to the sequence number + im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + // nolint:errcheck //ignored on purpose + ctx.EventManager().EmitTypedEvent(&types.EventBandResponseTimeout{ + ClientId: int64(clientID), + }) + + return nil } diff --git a/x/oracle/module/module_ibc_test.go b/x/oracle/module/module_ibc_test.go new file mode 100644 index 00000000..58c10736 --- /dev/null +++ b/x/oracle/module/module_ibc_test.go @@ -0,0 +1,366 @@ +package oracle_test + +import ( + "encoding/hex" + + "cosmossdk.io/math" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v8/testing" + reserveapp "github.com/onomyprotocol/reserve/app" + oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" + utils "github.com/onomyprotocol/reserve/x/oracle/utils" +) + +func (suite *PriceRelayTestSuite) TestOnChanOpenInit() { + var ( + channel *channeltypes.Channel + path *ibctesting.Path + chanCap *capabilitytypes.Capability + ) + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + + { + "success", func() {}, true, + }, + { + "invalid port ID", func() { + path.EndpointA.ChannelConfig.PortID = ibctesting.MockPort + }, false, + }, + { + "invalid version", func() { + channel.Version = "version" + }, false, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.TearDownTest() + suite.SetupTest() // reset + path = NewPriceRelayPath(suite.chainO, suite.chainB) + suite.coordinator.SetupConnections(path) + path.EndpointA.ChannelID = ibctesting.FirstChannelID + + counterparty := channeltypes.NewCounterparty(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) + channel = &channeltypes.Channel{ + State: channeltypes.INIT, + Ordering: channeltypes.UNORDERED, + Counterparty: counterparty, + ConnectionHops: []string{path.EndpointA.ConnectionID}, + Version: oracletypes.DefaultTestBandIbcParams().IbcVersion, + } + module, _, err := suite.chainO.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainO.GetContext(), oracletypes.DefaultTestBandIbcParams().IbcPortId) + suite.Require().NoError(err) + + chanCap, err = suite.chainO.App.GetScopedIBCKeeper().NewCapability(suite.chainO.GetContext(), host.ChannelCapabilityPath(oracletypes.DefaultTestBandIbcParams().IbcPortId, path.EndpointA.ChannelID)) + suite.Require().NoError(err) + + cbs, ok := suite.chainO.App.GetIBCKeeper().Router.GetRoute(module) + suite.Require().True(ok) + + tc.malleate() // explicitly change fields in channel and testChannel + + _, err = cbs.OnChanOpenInit(suite.chainO.GetContext(), channel.Ordering, channel.GetConnectionHops(), + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, channel.Counterparty, channel.GetVersion(), + ) + + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + + }) + } +} + +func (suite *PriceRelayTestSuite) TestOnChanOpenTry() { + var ( + channel *channeltypes.Channel + chanCap *capabilitytypes.Capability + path *ibctesting.Path + counterpartyVersion string + ) + + testCases := []struct { + name string + malleate func() + expPass bool + expAppVersion string + }{ + + { + "success", func() {}, true, oracletypes.DefaultTestBandIbcParams().IbcVersion, + }, + { + "invalid port ID", func() { + path.EndpointA.ChannelConfig.PortID = ibctesting.MockPort + }, false, "", + }, + { + "invalid channel version", func() { + channel.Version = "version" + }, true, oracletypes.DefaultTestBandIbcParams().IbcVersion, + }, + { + "invalid counterparty version", func() { + counterpartyVersion = "version" + }, false, "", + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.TearDownTest() + suite.SetupTest() // reset + + path = NewPriceRelayPath(suite.chainO, suite.chainB) + suite.coordinator.SetupConnections(path) + path.EndpointA.ChannelID = ibctesting.FirstChannelID + + counterparty := channeltypes.NewCounterparty(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) + channel = &channeltypes.Channel{ + State: channeltypes.TRYOPEN, + Ordering: channeltypes.UNORDERED, + Counterparty: counterparty, + ConnectionHops: []string{path.EndpointA.ConnectionID}, + Version: oracletypes.DefaultTestBandIbcParams().IbcVersion, + } + counterpartyVersion = oracletypes.DefaultTestBandIbcParams().IbcVersion + + module, _, err := suite.chainO.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainO.GetContext(), oracletypes.DefaultTestBandIbcParams().IbcPortId) + suite.Require().NoError(err) + + chanCap, err = suite.chainO.App.GetScopedIBCKeeper().NewCapability(suite.chainO.GetContext(), host.ChannelCapabilityPath(oracletypes.DefaultTestBandIbcParams().IbcPortId, path.EndpointA.ChannelID)) + suite.Require().NoError(err) + + cbs, ok := suite.chainO.App.GetIBCKeeper().Router.GetRoute(module) + suite.Require().True(ok) + + tc.malleate() // explicitly change fields in channel and testChannel + + appVersion, err := cbs.OnChanOpenTry(suite.chainO.GetContext(), channel.Ordering, channel.GetConnectionHops(), + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, channel.Counterparty, counterpartyVersion, + ) + + suite.Assert().Equal(tc.expAppVersion, appVersion) + + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + }) + } +} + +func (suite *PriceRelayTestSuite) TestOnChanOpenAck() { + var counterpartyVersion string + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + + { + "success", func() {}, true, + }, + { + "invalid counterparty version", func() { + counterpartyVersion = "version" + }, false, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.TearDownTest() + suite.SetupTest() // reset + + path := NewPriceRelayPath(suite.chainO, suite.chainB) + suite.coordinator.SetupConnections(path) + path.EndpointA.ChannelID = ibctesting.FirstChannelID + counterpartyVersion = oracletypes.DefaultTestBandIbcParams().IbcVersion + + module, _, err := suite.chainO.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainO.GetContext(), oracletypes.DefaultTestBandIbcParams().IbcPortId) + suite.Require().NoError(err) + + cbs, ok := suite.chainO.App.GetIBCKeeper().Router.GetRoute(module) + suite.Require().True(ok) + + tc.malleate() // explicitly change fields in channel and testChannel + + err = cbs.OnChanOpenAck(suite.chainO.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointA.Counterparty.ChannelID, counterpartyVersion) + + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + }) + } +} + +func (suite *PriceRelayTestSuite) TestOnRecvPacket() { + // TODO: Add more test case to cover all branch + var packetData []byte + var msg oracletypes.OracleResponsePacketData + var symbolsInput = oracletypes.SymbolInput{ + Symbols: []string{"ATOM", "BNB", "BTC", "ETH", "INJ", "USDT", "OSMO", "STX", "SOL"}, + MinimumSourceCount: 1, + } + data := utils.MustEncode(symbolsInput) + testCases := []struct { + name string + malleate func() + expAckSuccess bool + }{ + { + "success", func() {}, true, + }, + { + "fails - cannot unmarshal packet data", func() { + packetData = []byte("invalid data") + }, false, + }, + { + "fails - request is not resolved successfully", func() { + msg.ResolveStatus = oracletypes.RESOLVE_STATUS_FAILURE + packetData = msg.GetBytes() + }, false, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.TearDownTest() + suite.SetupTest() // reset + path := NewPriceRelayPath(suite.chainO, suite.chainB) + suite.coordinator.SetupConnections(path) + + result, _ := hex.DecodeString( + "000000090000000441544f4d00000000028510582500000003424e42000000004b269758800000000342544300000019cde9ff0a340000000345544800000001b055202e8c00000003494e4a0000000001b991af3c000000045553445400000000003ba159af000000044f534d4f00000000002b0682d70000000353545800000000002f7a459e00000003534f4c0000000004fa3a37e8", + ) + // prepare packet + msg = oracletypes.OracleResponsePacketData{ + ClientID: "1", + RequestID: 1, + AnsCount: 1, + RequestTime: 1000000000, + ResolveTime: 1000000000, + ResolveStatus: oracletypes.RESOLVE_STATUS_SUCCESS, + Result: result, + } + packetData = msg.GetBytes() + + // modify test data + tc.malleate() + + packet := channeltypes.NewPacket( + packetData, + uint64(1), + path.EndpointA.ChannelConfig.PortID, + path.EndpointA.ChannelID, + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + clienttypes.NewHeight(0, 100), + 0, + ) + + // prepare expected ack + expectedAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) + // get module + module, _, err := suite.chainO.App.GetIBCKeeper().PortKeeper.LookupModuleByPort( + suite.chainO.GetContext(), + path.EndpointA.ChannelConfig.PortID, + ) + suite.Require().NoError(err) + + // get routeq + cbs, ok := suite.chainO.App.GetIBCKeeper().Router.GetRoute(module) + suite.Require().True(ok) + + onomyApp := suite.chainO.App.(*reserveapp.App) + onomyApp.OracleKeeper.SetBandCallDataRecord(suite.chainO.GetContext(), &oracletypes.CalldataRecord{ + ClientId: 1, + Calldata: data, + }) + + // call recv packet + ack := cbs.OnRecvPacket(suite.chainO.GetContext(), packet, nil) + + // state check blabla + // check result + if tc.expAckSuccess { + suite.Require().True(ack.Success()) + suite.Require().Equal(expectedAck, ack) + + price := onomyApp.OracleKeeper.GetPrice(suite.chainO.GetContext(), "ATOM", "USD") + suite.Require().Equal("10.822375461000000000", price.String()) + } else { + suite.Require().False(ack.Success()) + } + }) + } +} + +func (suite *PriceRelayTestSuite) TestPriceFeedThreshold() { + + currentBTCPrice, _ := math.LegacyNewDecFromStr("48495.410") + withinThresholdBTCPrice, _ := math.LegacyNewDecFromStr("49523.620") + minThresholdBTCPrice, _ := math.LegacyNewDecFromStr("484.9540") + maxThresholdBTCPrice, _ := math.LegacyNewDecFromStr("4952362.012") + + testCases := []struct { + name string + lastPrice math.LegacyDec + newPrice math.LegacyDec + expThreshold bool + }{ + { + "Within Threshold", math.LegacyNewDec(100), math.LegacyNewDec(120), false, + }, + { + "Min Threshold", math.LegacyNewDec(101), math.LegacyNewDec(1), true, + }, + { + "Max Threshold", math.LegacyNewDec(2), math.LegacyNewDec(201), true, + }, + { + "Within Threshold BTC", currentBTCPrice, withinThresholdBTCPrice, false, + }, + { + "Min Threshold BTC", currentBTCPrice, minThresholdBTCPrice, true, + }, + { + "Max Threshold BTC", currentBTCPrice, maxThresholdBTCPrice, true, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + isThresholdExceeded := oracletypes.CheckPriceFeedThreshold(tc.lastPrice, tc.newPrice) + suite.Assert().Equal(tc.expThreshold, isThresholdExceeded) + }) + } +} diff --git a/x/oracle/module/price_relay_test.go b/x/oracle/module/price_relay_test.go new file mode 100644 index 00000000..333e27df --- /dev/null +++ b/x/oracle/module/price_relay_test.go @@ -0,0 +1,154 @@ +package oracle_test + +import ( + "encoding/json" + "testing" + + "cosmossdk.io/log" + dbm "github.com/cosmos/cosmos-db" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" + testifysuite "github.com/stretchr/testify/suite" + + reserveapp "github.com/onomyprotocol/reserve/app" + bandapp "github.com/onomyprotocol/reserve/x/oracle/bandtesting/app" + bandoracletypes "github.com/onomyprotocol/reserve/x/oracle/bandtesting/x/oracle/types" + oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" +) + +type PriceRelayTestSuite struct { + testifysuite.Suite + + coordinator *ibctesting.Coordinator + + // testing chains used for convenience and readability + chainO *ibctesting.TestChain + chainB *ibctesting.TestChain +} + +func (suite *PriceRelayTestSuite) SetupTest() { + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 0) + + // setup injective chain + chainID := ibctesting.GetChainID(0) + ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { + db := dbm.NewMemDB() + encCdc := bandapp.MakeEncodingConfig() + app, _ := reserveapp.New(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) + genesisState := app.DefaultGenesis() + oracleGenesis := oracletypes.DefaultGenesis() + oracleGenesis.BandParams = *oracletypes.DefaultTestBandIbcParams() + oracleGenesisRaw := encCdc.Marshaler.MustMarshalJSON(oracleGenesis) + genesisState[oracletypes.ModuleName] = oracleGenesisRaw + return app, genesisState + } + suite.coordinator.Chains[chainID] = ibctesting.NewTestChain(suite.T(), suite.coordinator, chainID) + + // setup band chain + chainID = ibctesting.GetChainID(1) + ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { + db := dbm.NewMemDB() + encCdc := bandapp.MakeEncodingConfig() + app := bandapp.NewBandApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, bandapp.DefaultNodeHome, 5, encCdc, simtestutil.EmptyAppOptions{}) + return app, bandapp.NewDefaultGenesisState() + } + suite.coordinator.Chains[chainID] = ibctesting.NewTestChain(suite.T(), suite.coordinator, chainID) + + suite.chainO = suite.coordinator.GetChain(ibctesting.GetChainID(0)) + suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) +} + +func NewPriceRelayPath(chain0, chainB *ibctesting.TestChain) *ibctesting.Path { + path := ibctesting.NewPath(chain0, chainB) + path.EndpointA.ChannelConfig.Version = oracletypes.DefaultTestBandIbcParams().IbcVersion + path.EndpointA.ChannelConfig.PortID = oracletypes.DefaultTestBandIbcParams().IbcPortId + path.EndpointB.ChannelConfig.Version = oracletypes.DefaultTestBandIbcParams().IbcVersion + path.EndpointB.ChannelConfig.PortID = oracletypes.ModuleName + + return path +} + +// constructs a send from chainA to chainB on the established channel/connection +// and sends the same coin back from chainB to chainA. +func (suite *PriceRelayTestSuite) TestHandlePriceRelay() { + // setup between chainA and chainB + + onomyapp := suite.chainO.App.(*reserveapp.App) + + path := NewPriceRelayPath(suite.chainO, suite.chainB) + suite.coordinator.Setup(path) + + timeoutHeight := clienttypes.NewHeight(1, 110) + + // relay send + bandOracleReq := oracletypes.BandOracleRequest{ + OracleScriptId: 1, + Symbols: []string{"nom", "btc"}, + AskCount: 1, + MinCount: 1, + FeeLimit: sdk.Coins{sdk.NewInt64Coin("nom", 1)}, + PrepareGas: 100, + ExecuteGas: 200, + } + + priceRelayPacket := oracletypes.NewOracleRequestPacketData("11", bandOracleReq.GetCalldata(true), &bandOracleReq) + packet := channeltypes.NewPacket(priceRelayPacket.GetBytes(), 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) + _, err := path.EndpointA.SendPacket(packet.TimeoutHeight, packet.TimeoutTimestamp, packet.Data) + suite.Require().NoError(err) + + // nolint:all + // ack := channeltypes.NewResultAcknowledgement(types.ModuleCdc.MustMarshalJSON(bandoracletypes.NewOracleRequestPacketAcknowledgement(1))) + err = path.RelayPacket(packet) + suite.Require().NoError(err) // relay committed + + suite.chainB.NextBlock() + + oracleResponsePacket := bandoracletypes.NewOracleResponsePacketData("11", 1, 0, 1577923380, 1577923405, 1, []byte("beeb")) + responsePacket := channeltypes.NewPacket( + oracleResponsePacket.GetBytes(), + 1, + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + path.EndpointA.ChannelConfig.PortID, + path.EndpointA.ChannelID, + clienttypes.ZeroHeight(), + 1577924005000000000, + ) + + expectCommitment := channeltypes.CommitPacket(suite.chainB.Codec, responsePacket) + commitment := suite.chainB.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, 1) + suite.Equal(expectCommitment, commitment) + + // injectiveApp := suite.chainO.App.(*reserveapp.App) + onomyapp.OracleKeeper.SetBandOracleRequest(suite.chainO.GetContext(), oracletypes.BandOracleRequest{ + RequestId: 1, + OracleScriptId: 1, + Symbols: []string{"A"}, + AskCount: 1, + MinCount: 1, + FeeLimit: sdk.Coins{}, + PrepareGas: 100, + ExecuteGas: 200, + }) + + // send from chainI to chainB + msg := oracletypes.NewMsgRequestBandRates(suite.chainO.SenderAccount.GetAddress(), 1) + _, err = suite.chainO.SendMsgs(msg) + + suite.Require().NoError(err) // message committed +} + +func (suite *PriceRelayTestSuite) TearDownTest() { + for _, chain := range suite.coordinator.Chains { + if app, ok := chain.App.(*reserveapp.App); ok { + reserveapp.Cleanup(app) // cleanup old instance first + } + } +} + +func TestPriceRelayTestSuite(t *testing.T) { + testifysuite.Run(t, new(PriceRelayTestSuite)) +} diff --git a/x/oracle/proposal_handler.go b/x/oracle/proposal_handler.go new file mode 100644 index 00000000..7f9b5822 --- /dev/null +++ b/x/oracle/proposal_handler.go @@ -0,0 +1,107 @@ +package oracle + +import ( + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/onomyprotocol/reserve/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/oracle/types" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsmod "cosmossdk.io/errors" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// NewOracleProposalHandler creates a governance handler to manage new oracles +func NewOracleProposalHandler(k keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.UpdateBandParamsProposal: + return handleUpdateBandParamsProposal(ctx, k, c) + case *types.UpdateBandOracleRequestProposal: + return handleUpdateBandOracleRequestProposal(ctx, k, c) + + case *types.DeleteBandOracleRequestProposal: + return handleDeleteBandOracleRequestProposal(ctx, k, c) + default: + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized param proposal content type: %T", c) + } + } +} + +func handleUpdateBandParamsProposal(ctx sdk.Context, k keeper.Keeper, p *types.UpdateBandParamsProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + k.SetPort(ctx, p.BandParams.IbcPortId) + // Only try to bind to port if it is not already bound, since we may already own port capability + if k.ShouldBound(ctx, p.BandParams.IbcPortId) { + // module binds to the port on InitChain + // and claims the returned capability + err := k.BindPort(ctx, p.BandParams.IbcPortId) + if err != nil { + return errorsmod.Wrap(types.ErrBandPortBind, err.Error()) + } + } + + k.SetBandParams(ctx, p.BandParams) + return nil +} + +func handleUpdateBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p *types.UpdateBandOracleRequestProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + request := k.GetBandOracleRequest(ctx, p.UpdateOracleRequest.RequestId) + if request == nil { + return errorsmod.Wrapf(types.ErrBandRequestNotFound, "cannot update requestID %T", p.UpdateOracleRequest.RequestId) + } + + if p.UpdateOracleRequest.OracleScriptId > 0 { + request.OracleScriptId = p.UpdateOracleRequest.OracleScriptId + } + + if len(p.UpdateOracleRequest.Symbols) > 0 { + request.Symbols = p.UpdateOracleRequest.Symbols + } + + if p.UpdateOracleRequest.MinCount > 0 { + request.MinCount = p.UpdateOracleRequest.MinCount + } + + if p.UpdateOracleRequest.AskCount > 0 { + request.AskCount = p.UpdateOracleRequest.AskCount + } + + if p.UpdateOracleRequest.FeeLimit != nil { + request.FeeLimit = p.UpdateOracleRequest.FeeLimit + } + + if p.UpdateOracleRequest.PrepareGas > 0 { + request.PrepareGas = p.UpdateOracleRequest.PrepareGas + } + + if p.UpdateOracleRequest.ExecuteGas > 0 { + request.ExecuteGas = p.UpdateOracleRequest.ExecuteGas + } + + if p.UpdateOracleRequest.MinSourceCount > 0 { + request.MinSourceCount = p.UpdateOracleRequest.MinSourceCount + } + + k.SetBandOracleRequest(ctx, *request) + + return nil +} + +func handleDeleteBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p *types.DeleteBandOracleRequestProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, requestID := range p.DeleteRequestIds { + k.DeleteBandOracleRequest(ctx, requestID) + } + + return nil +} diff --git a/x/oracle/proposal_handler_test.go b/x/oracle/proposal_handler_test.go new file mode 100644 index 00000000..adddc82b --- /dev/null +++ b/x/oracle/proposal_handler_test.go @@ -0,0 +1,45 @@ +package oracle_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/onomyprotocol/reserve/app" + "github.com/onomyprotocol/reserve/x/oracle/types" + "github.com/onomyprotocol/reserve/x/oracle" +) + +func TestUpdateBandParamsProposal(t *testing.T) { + // check default band params + app := app.Setup(t, false) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "3", Time: time.Unix(1618997040, 0)}) + + bandParams := app.OracleKeeper.GetBandParams(ctx) + require.Equal(t ,types.DefaultBandParams(), bandParams) + + handler := oracle.NewOracleProposalHandler(app.OracleKeeper) + new_BandParams := types.BandParams{ + IbcRequestInterval: 2, + IbcSourceChannel: "channel-1", + IbcVersion: "bandchain-2", + IbcPortId: "oracle", + } + err := handler(ctx, &types.UpdateBandParamsProposal{ + Title: "Update Band param proposal", + Description: "Update band param proposal", + BandParams: new_BandParams, + }) + + require.NoError(t, err) + portID := app.OracleKeeper.GetPort(ctx) + require.Equal(t, new_BandParams.IbcPortId, portID) + + isBound := app.OracleKeeper.ShouldBound(ctx, portID) + require.False(t, isBound) + + bandParams = app.OracleKeeper.GetBandParams(ctx) + require.Equal(t ,new_BandParams, bandParams) + +} diff --git a/x/oracle/types/band_oracle.go b/x/oracle/types/band_oracle.go new file mode 100644 index 00000000..cba44f3b --- /dev/null +++ b/x/oracle/types/band_oracle.go @@ -0,0 +1,219 @@ +package types + +import ( + "fmt" + + math "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + utils "github.com/onomyprotocol/reserve/x/oracle/utils" +) + +const ( + BandPriceMultiplier uint64 = 1000000000 // 1e9 + MaxDataSize = 256 // 256B + QuoteUSD = "USD" +) + +type RequestID int64 + +func NewOracleRequestPacketData(clientID string, calldata []byte, r *BandOracleRequest) OracleRequestPacketData { + return OracleRequestPacketData{ + ClientID: clientID, + OracleScriptID: uint64(r.OracleScriptId), + Calldata: calldata, + AskCount: r.AskCount, + MinCount: r.MinCount, + FeeLimit: r.FeeLimit, + PrepareGas: r.PrepareGas, + ExecuteGas: r.ExecuteGas, + } +} + +// GetBytes is a helper for serialising +func (p OracleRequestPacketData) GetBytes() []byte { + cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + return sdk.MustSortJSON(cdc.MustMarshalJSON(&p)) +} + +// GetBytes returns the bytes representation of this oracle response packet data. +func (p OracleResponsePacketData) GetBytes() []byte { + cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + return sdk.MustSortJSON(cdc.MustMarshalJSON(&p)) +} + +// GetCalldata gets the Band IBC request call data based on the symbols and multiplier. +func (r *BandOracleRequest) GetCalldata(legacyScheme bool) []byte { + if legacyScheme { + return utils.MustEncode(Input{ + Symbols: r.Symbols, + Multiplier: BandPriceMultiplier, + }) + } + + return utils.MustEncode(SymbolInput{ + Symbols: r.Symbols, + MinimumSourceCount: uint8(r.MinSourceCount), + }) +} + +func IsLegacySchemeOracleScript(scriptID int64, params BandParams) bool { + for _, id := range params.LegacyOracleIds { + if id == scriptID { + return true + } + } + + return false +} + +// CheckPriceFeedThreshold returns true if the newPrice has changed beyond 100x or less than 1% of the last price +func CheckPriceFeedThreshold(lastPrice, newPrice math.LegacyDec) bool { + return newPrice.GT(lastPrice.Mul(math.LegacyNewDec(100))) || newPrice.LT(lastPrice.Quo(math.LegacyNewDec(100))) +} + +func DecodeOracleInput(data []byte) (OracleInput, error) { + var ( + legacyInput LegacyBandInput + newInput BandInput + err error + ) + + if err = utils.Decode(data, &legacyInput); err == nil { + return legacyInput, nil + } + + if err = utils.Decode(data, &newInput); err == nil { + return newInput, nil + } + + return nil, fmt.Errorf("failed to decode oracle input: %w", err) +} + +func DecodeOracleOutput(data []byte) (OracleOutput, error) { + var ( + legacyOutput LegacyBandOutput + newOutput BandOutput + err error + ) + + if err = utils.Decode(data, &legacyOutput); err == nil { + return legacyOutput, nil + } + + if err = utils.Decode(data, &newOutput); err == nil { + return newOutput, nil + } + + return nil, fmt.Errorf("failed to decode oracle output: %w", err) +} + +// it is assumed that the id of a symbol +// within OracleInput exists within OracleOutput + +type OracleInput interface { + PriceSymbols() []string + PriceMultiplier() uint64 +} + +type ( + LegacyBandInput Input + BandInput SymbolInput +) + +func (in LegacyBandInput) PriceSymbols() []string { + return in.Symbols +} + +func (in LegacyBandInput) PriceMultiplier() uint64 { + return in.Multiplier +} + +func (in BandInput) PriceSymbols() []string { + return in.Symbols +} + +func (in BandInput) PriceMultiplier() uint64 { + return BandPriceMultiplier +} + +type OracleOutput interface { + Rate(id int) uint64 + Valid(id int) bool +} + +type ( + LegacyBandOutput Output + BandOutput SymbolOutput +) + +func (out LegacyBandOutput) Rate(id int) uint64 { + return out.Pxs[id] +} + +func (out LegacyBandOutput) Valid(id int) bool { + return true +} + +func (out BandOutput) Rate(id int) uint64 { + return out.Responses[id].Rate +} + +func (out BandOutput) Valid(id int) bool { + return out.Responses[id].ResponseCode == 0 +} + +type SymbolInput struct { + Symbols []string `json:"symbols"` + MinimumSourceCount uint8 `json:"minimum_source_count"` +} + +type SymbolOutput struct { + Responses []Response `json:"responses"` +} + +type Response struct { + Symbol string `json:"symbol"` + ResponseCode uint8 `json:"response_code"` + Rate uint64 `json:"rate"` +} + +type Input struct { + Symbols []string `json:"symbols"` + Multiplier uint64 `json:"multiplier"` +} + +type Output struct { + Pxs []uint64 `json:"pxs"` +} + +type Price struct { + Symbol string `json:"symbol"` + Multiplier uint64 `json:"multiplier"` + Px uint64 `json:"px"` + RequestID RequestID `json:"request_id"` + ResolveTime int64 `json:"resolve_time"` +} + +func NewPrice(symbol string, multiplier, px uint64, reqID RequestID, resolveTime int64) Price { + return Price{ + Symbol: symbol, + Multiplier: multiplier, + Px: px, + RequestID: reqID, + ResolveTime: resolveTime, + } +} + +func NewPriceState(price math.LegacyDec, timestamp int64) *PriceState { + return &PriceState{ + Price: price, + Timestamp: timestamp, + } +} + +func (p *PriceState) UpdatePrice(price math.LegacyDec, timestamp int64) { + p.Timestamp = timestamp + p.Price = price +} diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index 26e58aba..137cfbe2 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -3,21 +3,40 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - // this line is used by starport scaffolding # 1 + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 +// RegisterLegacyAminoCodec registers the necessary x/oracle interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "oracle/MsgUpdateParams", nil) + cdc.RegisterConcrete(&MsgRequestBandRates{}, "oracle/MsgRequestBandRates", nil) + + cdc.RegisterConcrete(&UpdateBandParamsProposal{}, "oracle/UpdateBandParamsProposal", nil) + cdc.RegisterConcrete(&UpdateBandOracleRequestProposal{}, "oracle/UpdateBandOracleRequestProposal", nil) + cdc.RegisterConcrete(&DeleteBandOracleRequestProposal{}, "oracle/DeleteBandOracleRequestProposal", nil) +} +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateParams{}, + &MsgRequestBandRates{}, ) + + registry.RegisterImplementations((*govtypes.Content)(nil), + &UpdateBandParamsProposal{}, + &UpdateBandOracleRequestProposal{}, + &DeleteBandOracleRequestProposal{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( + amino = codec.NewLegacyAmino() // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec // should ONLY be used in certain instances of tests and for JSON encoding. // @@ -25,3 +44,9 @@ var ( // defined at the application level. ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) ) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} \ No newline at end of file diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index cc88d7f5..a47fdbf7 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -1,15 +1,25 @@ package types -// DONTCOVER - import ( sdkerrors "cosmossdk.io/errors" ) // x/oracle module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrInvalidPacketTimeout = sdkerrors.Register(ModuleName, 1500, "invalid packet timeout") - ErrInvalidVersion = sdkerrors.Register(ModuleName, 1501, "invalid version") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1, "expected gov account as only signer for proposal message") + ErrInvalidPacketTimeout = sdkerrors.Register(ModuleName, 2, "invalid packet timeout") + ErrInvalidVersion = sdkerrors.Register(ModuleName, 3, "invalid version") + ErrInvalidBandRequest = sdkerrors.Register(ModuleName, 4, "Invalid Band IBC Request") + ErrBandPortBind = sdkerrors.Register(ModuleName, 5, "could not claim port capability") + ErrBadRequestInterval = sdkerrors.Register(ModuleName, 6, "invalid Band IBC request interval") + ErrInvalidSourceChannel = sdkerrors.Register(ModuleName, 7, "invalid IBC source channel") + ErrBadSymbolsCount = sdkerrors.Register(ModuleName, 8, "invalid symbols count") + ErrTooLargeCalldata = sdkerrors.Register(ModuleName, 9, "too large calldata") + ErrInvalidMinCount = sdkerrors.Register(ModuleName, 10, "invalid min count") + ErrInvalidAskCount = sdkerrors.Register(ModuleName, 11, "invalid ask count") + ErrInvalidOwasmGas = sdkerrors.Register(ModuleName, 12, "invalid owasm gas") + ErrInvalidBandUpdateRequest = sdkerrors.Register(ModuleName, 13, "Invalid Band Update Request Proposal") + ErrBandRequestNotFound = sdkerrors.Register(ModuleName, 14, "Band Oracle Request not found") + ErrInvalidBandDeleteRequest = sdkerrors.Register(ModuleName, 15, "Invalid Band Delete Request Proposal") + ErrResolveStatusNotSuccess = sdkerrors.Register(ModuleName, 16, "Band Oracle request is not resolved successfully") ) diff --git a/x/oracle/types/events.pb.go b/x/oracle/types/events.pb.go new file mode 100644 index 00000000..86ee23d1 --- /dev/null +++ b/x/oracle/types/events.pb.go @@ -0,0 +1,1112 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/oracle/events.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 EventBandAckSuccess struct { + AckResult string `protobuf:"bytes,1,opt,name=ack_result,json=ackResult,proto3" json:"ack_result,omitempty"` + ClientId int64 `protobuf:"varint,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *EventBandAckSuccess) Reset() { *m = EventBandAckSuccess{} } +func (m *EventBandAckSuccess) String() string { return proto.CompactTextString(m) } +func (*EventBandAckSuccess) ProtoMessage() {} +func (*EventBandAckSuccess) Descriptor() ([]byte, []int) { + return fileDescriptor_5441448c19065114, []int{0} +} +func (m *EventBandAckSuccess) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBandAckSuccess) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBandAckSuccess.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 *EventBandAckSuccess) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBandAckSuccess.Merge(m, src) +} +func (m *EventBandAckSuccess) XXX_Size() int { + return m.Size() +} +func (m *EventBandAckSuccess) XXX_DiscardUnknown() { + xxx_messageInfo_EventBandAckSuccess.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBandAckSuccess proto.InternalMessageInfo + +func (m *EventBandAckSuccess) GetAckResult() string { + if m != nil { + return m.AckResult + } + return "" +} + +func (m *EventBandAckSuccess) GetClientId() int64 { + if m != nil { + return m.ClientId + } + return 0 +} + +type EventBandAckError struct { + AckError string `protobuf:"bytes,1,opt,name=ack_error,json=ackError,proto3" json:"ack_error,omitempty"` + ClientId int64 `protobuf:"varint,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *EventBandAckError) Reset() { *m = EventBandAckError{} } +func (m *EventBandAckError) String() string { return proto.CompactTextString(m) } +func (*EventBandAckError) ProtoMessage() {} +func (*EventBandAckError) Descriptor() ([]byte, []int) { + return fileDescriptor_5441448c19065114, []int{1} +} +func (m *EventBandAckError) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBandAckError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBandAckError.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 *EventBandAckError) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBandAckError.Merge(m, src) +} +func (m *EventBandAckError) XXX_Size() int { + return m.Size() +} +func (m *EventBandAckError) XXX_DiscardUnknown() { + xxx_messageInfo_EventBandAckError.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBandAckError proto.InternalMessageInfo + +func (m *EventBandAckError) GetAckError() string { + if m != nil { + return m.AckError + } + return "" +} + +func (m *EventBandAckError) GetClientId() int64 { + if m != nil { + return m.ClientId + } + return 0 +} + +type EventBandResponseTimeout struct { + ClientId int64 `protobuf:"varint,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *EventBandResponseTimeout) Reset() { *m = EventBandResponseTimeout{} } +func (m *EventBandResponseTimeout) String() string { return proto.CompactTextString(m) } +func (*EventBandResponseTimeout) ProtoMessage() {} +func (*EventBandResponseTimeout) Descriptor() ([]byte, []int) { + return fileDescriptor_5441448c19065114, []int{2} +} +func (m *EventBandResponseTimeout) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBandResponseTimeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBandResponseTimeout.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 *EventBandResponseTimeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBandResponseTimeout.Merge(m, src) +} +func (m *EventBandResponseTimeout) XXX_Size() int { + return m.Size() +} +func (m *EventBandResponseTimeout) XXX_DiscardUnknown() { + xxx_messageInfo_EventBandResponseTimeout.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBandResponseTimeout proto.InternalMessageInfo + +func (m *EventBandResponseTimeout) GetClientId() int64 { + if m != nil { + return m.ClientId + } + return 0 +} + +type SetBandPriceEvent struct { + Relayer string `protobuf:"bytes,1,opt,name=relayer,proto3" json:"relayer,omitempty"` + Symbols []string `protobuf:"bytes,2,rep,name=symbols,proto3" json:"symbols,omitempty"` + Prices []cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,rep,name=prices,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"prices"` + ResolveTime uint64 `protobuf:"varint,4,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + RequestId uint64 `protobuf:"varint,5,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ClientId int64 `protobuf:"varint,6,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *SetBandPriceEvent) Reset() { *m = SetBandPriceEvent{} } +func (m *SetBandPriceEvent) String() string { return proto.CompactTextString(m) } +func (*SetBandPriceEvent) ProtoMessage() {} +func (*SetBandPriceEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_5441448c19065114, []int{3} +} +func (m *SetBandPriceEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetBandPriceEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetBandPriceEvent.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 *SetBandPriceEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetBandPriceEvent.Merge(m, src) +} +func (m *SetBandPriceEvent) XXX_Size() int { + return m.Size() +} +func (m *SetBandPriceEvent) XXX_DiscardUnknown() { + xxx_messageInfo_SetBandPriceEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_SetBandPriceEvent proto.InternalMessageInfo + +func (m *SetBandPriceEvent) GetRelayer() string { + if m != nil { + return m.Relayer + } + return "" +} + +func (m *SetBandPriceEvent) GetSymbols() []string { + if m != nil { + return m.Symbols + } + return nil +} + +func (m *SetBandPriceEvent) GetResolveTime() uint64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *SetBandPriceEvent) GetRequestId() uint64 { + if m != nil { + return m.RequestId + } + return 0 +} + +func (m *SetBandPriceEvent) GetClientId() int64 { + if m != nil { + return m.ClientId + } + return 0 +} + +func init() { + proto.RegisterType((*EventBandAckSuccess)(nil), "reserve.oracle.EventBandAckSuccess") + proto.RegisterType((*EventBandAckError)(nil), "reserve.oracle.EventBandAckError") + proto.RegisterType((*EventBandResponseTimeout)(nil), "reserve.oracle.EventBandResponseTimeout") + proto.RegisterType((*SetBandPriceEvent)(nil), "reserve.oracle.SetBandPriceEvent") +} + +func init() { proto.RegisterFile("reserve/oracle/events.proto", fileDescriptor_5441448c19065114) } + +var fileDescriptor_5441448c19065114 = []byte{ + // 393 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x3f, 0x8f, 0xd3, 0x40, + 0x10, 0xc5, 0xbd, 0x97, 0x23, 0x9c, 0x17, 0x84, 0x74, 0x86, 0xc2, 0x22, 0xc2, 0x67, 0x8e, 0x26, + 0x95, 0x5d, 0x50, 0x50, 0x50, 0x11, 0x71, 0x45, 0x24, 0x90, 0xc0, 0x47, 0x45, 0x13, 0x6d, 0xd6, + 0x23, 0x9f, 0xe5, 0x3f, 0x63, 0x76, 0xd6, 0x11, 0xfe, 0x16, 0x7c, 0xac, 0x2b, 0xaf, 0x44, 0x14, + 0x27, 0x14, 0x7f, 0x11, 0xb4, 0x1b, 0x1b, 0x25, 0x91, 0xae, 0xf3, 0xbc, 0x37, 0xef, 0xa7, 0x7d, + 0xde, 0xe5, 0x33, 0x05, 0x04, 0x6a, 0x03, 0x31, 0x2a, 0x21, 0x4b, 0x88, 0x61, 0x03, 0xb5, 0xa6, + 0xa8, 0x51, 0xa8, 0xd1, 0x7b, 0x36, 0x98, 0xd1, 0xce, 0x7c, 0xf9, 0x22, 0xc3, 0x0c, 0xad, 0x15, + 0x9b, 0xaf, 0xdd, 0xd6, 0xe5, 0x57, 0xfe, 0xfc, 0xca, 0xa4, 0x16, 0xa2, 0x4e, 0x3f, 0xc8, 0xe2, + 0xba, 0x95, 0x12, 0x88, 0xbc, 0x57, 0x9c, 0x0b, 0x59, 0xac, 0x14, 0x50, 0x5b, 0x6a, 0x9f, 0x85, + 0x6c, 0xee, 0x26, 0xae, 0x90, 0x45, 0x62, 0x05, 0x6f, 0xc6, 0x5d, 0x59, 0xe6, 0x50, 0xeb, 0x55, + 0x9e, 0xfa, 0x27, 0x21, 0x9b, 0x4f, 0x92, 0xb3, 0x9d, 0xb0, 0x4c, 0x2f, 0x3f, 0xf3, 0xf3, 0x7d, + 0xe4, 0x95, 0x52, 0xa8, 0x4c, 0xc2, 0x00, 0xc1, 0x0c, 0x03, 0xef, 0x4c, 0xec, 0x99, 0x0f, 0xe3, + 0xde, 0x71, 0xff, 0x3f, 0x2e, 0x01, 0x6a, 0xb0, 0x26, 0xf8, 0x96, 0x57, 0x80, 0xed, 0xd1, 0x39, + 0xd8, 0x51, 0xb0, 0x67, 0xfc, 0xfc, 0x1a, 0x6c, 0xee, 0x8b, 0xca, 0x25, 0x58, 0x8a, 0xe7, 0xf3, + 0xc7, 0x0a, 0x4a, 0xd1, 0xc1, 0x78, 0x8c, 0x71, 0x34, 0x0e, 0x75, 0xd5, 0x1a, 0x4b, 0xf2, 0x4f, + 0xc2, 0x89, 0x71, 0x86, 0xd1, 0x7b, 0xcf, 0xa7, 0x8d, 0x21, 0x90, 0x3f, 0x31, 0xc6, 0xe2, 0xcd, + 0xed, 0xfd, 0x85, 0xf3, 0xe7, 0xfe, 0x62, 0x26, 0x91, 0x2a, 0x24, 0x4a, 0x8b, 0x28, 0xc7, 0xb8, + 0x12, 0xfa, 0x26, 0xfa, 0x04, 0x99, 0x90, 0xdd, 0x47, 0x90, 0xc9, 0x10, 0xf1, 0x5e, 0xf3, 0xa7, + 0x0a, 0x08, 0xcb, 0x0d, 0xac, 0x74, 0x5e, 0x81, 0x7f, 0x1a, 0xb2, 0xf9, 0x69, 0xf2, 0x64, 0xd0, + 0x4c, 0x13, 0xf3, 0xb7, 0x15, 0xfc, 0x68, 0x81, 0x6c, 0x8f, 0x47, 0x76, 0xc1, 0x1d, 0x94, 0x65, + 0x7a, 0xd8, 0x72, 0x7a, 0xd8, 0x72, 0xb1, 0xbc, 0xdd, 0x06, 0xec, 0x6e, 0x1b, 0xb0, 0xbf, 0xdb, + 0x80, 0xfd, 0xea, 0x03, 0xe7, 0xae, 0x0f, 0x9c, 0xdf, 0x7d, 0xe0, 0x7c, 0x8f, 0xb3, 0x5c, 0xdf, + 0xb4, 0xeb, 0x48, 0x62, 0x15, 0x63, 0x8d, 0x55, 0x67, 0x6f, 0x5c, 0x62, 0x19, 0x8f, 0xcf, 0xe6, + 0xe7, 0xf8, 0x70, 0x74, 0xd7, 0x00, 0xad, 0xa7, 0x76, 0xe1, 0xed, 0xbf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xa5, 0x56, 0xe4, 0xad, 0x57, 0x02, 0x00, 0x00, +} + +func (m *EventBandAckSuccess) 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 *EventBandAckSuccess) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBandAckSuccess) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClientId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ClientId)) + i-- + dAtA[i] = 0x10 + } + if len(m.AckResult) > 0 { + i -= len(m.AckResult) + copy(dAtA[i:], m.AckResult) + i = encodeVarintEvents(dAtA, i, uint64(len(m.AckResult))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBandAckError) 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 *EventBandAckError) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBandAckError) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClientId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ClientId)) + i-- + dAtA[i] = 0x10 + } + if len(m.AckError) > 0 { + i -= len(m.AckError) + copy(dAtA[i:], m.AckError) + i = encodeVarintEvents(dAtA, i, uint64(len(m.AckError))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBandResponseTimeout) 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 *EventBandResponseTimeout) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBandResponseTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClientId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ClientId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SetBandPriceEvent) 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 *SetBandPriceEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetBandPriceEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClientId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ClientId)) + i-- + dAtA[i] = 0x30 + } + if m.RequestId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.RequestId)) + i-- + dAtA[i] = 0x28 + } + if m.ResolveTime != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x20 + } + if len(m.Prices) > 0 { + for iNdEx := len(m.Prices) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Prices[iNdEx].Size() + i -= size + if _, err := m.Prices[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Symbols) > 0 { + for iNdEx := len(m.Symbols) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Symbols[iNdEx]) + copy(dAtA[i:], m.Symbols[iNdEx]) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Symbols[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Relayer) > 0 { + i -= len(m.Relayer) + copy(dAtA[i:], m.Relayer) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Relayer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventBandAckSuccess) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AckResult) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.ClientId != 0 { + n += 1 + sovEvents(uint64(m.ClientId)) + } + return n +} + +func (m *EventBandAckError) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AckError) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.ClientId != 0 { + n += 1 + sovEvents(uint64(m.ClientId)) + } + return n +} + +func (m *EventBandResponseTimeout) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ClientId != 0 { + n += 1 + sovEvents(uint64(m.ClientId)) + } + return n +} + +func (m *SetBandPriceEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Relayer) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if len(m.Symbols) > 0 { + for _, s := range m.Symbols { + l = len(s) + n += 1 + l + sovEvents(uint64(l)) + } + } + if len(m.Prices) > 0 { + for _, e := range m.Prices { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } + } + if m.ResolveTime != 0 { + n += 1 + sovEvents(uint64(m.ResolveTime)) + } + if m.RequestId != 0 { + n += 1 + sovEvents(uint64(m.RequestId)) + } + if m.ClientId != 0 { + n += 1 + sovEvents(uint64(m.ClientId)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventBandAckSuccess) 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 ErrIntOverflowEvents + } + 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: EventBandAckSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBandAckSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AckResult", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AckResult = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + m.ClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBandAckError) 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 ErrIntOverflowEvents + } + 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: EventBandAckError: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBandAckError: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AckError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AckError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + m.ClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBandResponseTimeout) 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 ErrIntOverflowEvents + } + 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: EventBandResponseTimeout: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBandResponseTimeout: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + m.ClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetBandPriceEvent) 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 ErrIntOverflowEvents + } + 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: SetBandPriceEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetBandPriceEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Relayer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Relayer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbols", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbols = append(m.Symbols, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.LegacyDec + m.Prices = append(m.Prices, v) + if err := m.Prices[len(m.Prices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + m.RequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + m.ClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(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, ErrIntOverflowEvents + } + 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, ErrIntOverflowEvents + } + 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, ErrIntOverflowEvents + } + 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, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index 77391d3a..075389a8 100644 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -1,29 +1,25 @@ package types -import ( - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - // this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +func NewGenesisState() GenesisState { + return GenesisState{} +} // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - PortId: PortID, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), + BandParams: DefaultBandParams(), + BandOracleRequestParams: DefaultBandOracelRequestParams(), } } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - if err := host.PortIdentifierValidator(gs.PortId); err != nil { + // TODO: validate stuff in genesis + if err := gs.Params.Validate(); err != nil { return err } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() + return nil } diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index b9af0422..be4c3ca5 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -4,7 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -27,8 +30,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the oracle module's genesis state. type GenesisState struct { // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + BandParams BandParams `protobuf:"bytes,2,opt,name=band_params,json=bandParams,proto3" json:"band_params"` + BandPriceStates []*BandPriceState `protobuf:"bytes,3,rep,name=band_price_states,json=bandPriceStates,proto3" json:"band_price_states,omitempty"` + BandOracleRequests []*BandOracleRequest `protobuf:"bytes,4,rep,name=band_oracle_requests,json=bandOracleRequests,proto3" json:"band_oracle_requests,omitempty"` + BandLatestClientId uint64 `protobuf:"varint,5,opt,name=band_latest_client_id,json=bandLatestClientId,proto3" json:"band_latest_client_id,omitempty"` + CalldataRecords []*CalldataRecord `protobuf:"bytes,6,rep,name=calldata_records,json=calldataRecords,proto3" json:"calldata_records,omitempty"` + BandLatestRequestId uint64 `protobuf:"varint,7,opt,name=band_latest_request_id,json=bandLatestRequestId,proto3" json:"band_latest_request_id,omitempty"` + BandOracleRequestParams BandOracleRequestParams `protobuf:"bytes,8,opt,name=band_oracle_request_params,json=bandOracleRequestParams,proto3" json:"band_oracle_request_params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,36 +80,377 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetPortId() string { +func (m *GenesisState) GetBandParams() BandParams { if m != nil { - return m.PortId + return m.BandParams + } + return BandParams{} +} + +func (m *GenesisState) GetBandPriceStates() []*BandPriceState { + if m != nil { + return m.BandPriceStates + } + return nil +} + +func (m *GenesisState) GetBandOracleRequests() []*BandOracleRequest { + if m != nil { + return m.BandOracleRequests + } + return nil +} + +func (m *GenesisState) GetBandLatestClientId() uint64 { + if m != nil { + return m.BandLatestClientId + } + return 0 +} + +func (m *GenesisState) GetCalldataRecords() []*CalldataRecord { + if m != nil { + return m.CalldataRecords + } + return nil +} + +func (m *GenesisState) GetBandLatestRequestId() uint64 { + if m != nil { + return m.BandLatestRequestId + } + return 0 +} + +func (m *GenesisState) GetBandOracleRequestParams() BandOracleRequestParams { + if m != nil { + return m.BandOracleRequestParams + } + return BandOracleRequestParams{} +} + +type BandOracleRequestParams struct { + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,1,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,2,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + FeeLimit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=fee_limit,json=feeLimit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee_limit"` + // PrepareGas is amount of gas to pay to prepare raw requests + PrepareGas uint64 `protobuf:"varint,4,opt,name=prepare_gas,json=prepareGas,proto3" json:"prepare_gas,omitempty"` + // ExecuteGas is amount of gas to reserve for executing + ExecuteGas uint64 `protobuf:"varint,5,opt,name=execute_gas,json=executeGas,proto3" json:"execute_gas,omitempty"` + // MinSourceCount is the minimum number of data sources that must be used by + // each validator + MinSourceCount uint64 `protobuf:"varint,6,opt,name=min_source_count,json=minSourceCount,proto3" json:"min_source_count,omitempty"` +} + +func (m *BandOracleRequestParams) Reset() { *m = BandOracleRequestParams{} } +func (m *BandOracleRequestParams) String() string { return proto.CompactTextString(m) } +func (*BandOracleRequestParams) ProtoMessage() {} +func (*BandOracleRequestParams) Descriptor() ([]byte, []int) { + return fileDescriptor_78a657bc7a2646c9, []int{1} +} +func (m *BandOracleRequestParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BandOracleRequestParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BandOracleRequestParams.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 *BandOracleRequestParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_BandOracleRequestParams.Merge(m, src) +} +func (m *BandOracleRequestParams) XXX_Size() int { + return m.Size() +} +func (m *BandOracleRequestParams) XXX_DiscardUnknown() { + xxx_messageInfo_BandOracleRequestParams.DiscardUnknown(m) +} + +var xxx_messageInfo_BandOracleRequestParams proto.InternalMessageInfo + +func (m *BandOracleRequestParams) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *BandOracleRequestParams) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *BandOracleRequestParams) GetFeeLimit() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeeLimit + } + return nil +} + +func (m *BandOracleRequestParams) GetPrepareGas() uint64 { + if m != nil { + return m.PrepareGas + } + return 0 +} + +func (m *BandOracleRequestParams) GetExecuteGas() uint64 { + if m != nil { + return m.ExecuteGas + } + return 0 +} + +func (m *BandOracleRequestParams) GetMinSourceCount() uint64 { + if m != nil { + return m.MinSourceCount + } + return 0 +} + +type BandPriceState struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Rate cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=rate,proto3,customtype=cosmossdk.io/math.Int" json:"rate"` + ResolveTime uint64 `protobuf:"varint,3,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + Request_ID uint64 `protobuf:"varint,4,opt,name=request_ID,json=requestID,proto3" json:"request_ID,omitempty"` + PriceState PriceState `protobuf:"bytes,5,opt,name=price_state,json=priceState,proto3" json:"price_state"` +} + +func (m *BandPriceState) Reset() { *m = BandPriceState{} } +func (m *BandPriceState) String() string { return proto.CompactTextString(m) } +func (*BandPriceState) ProtoMessage() {} +func (*BandPriceState) Descriptor() ([]byte, []int) { + return fileDescriptor_78a657bc7a2646c9, []int{2} +} +func (m *BandPriceState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BandPriceState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BandPriceState.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 *BandPriceState) XXX_Merge(src proto.Message) { + xxx_messageInfo_BandPriceState.Merge(m, src) +} +func (m *BandPriceState) XXX_Size() int { + return m.Size() +} +func (m *BandPriceState) XXX_DiscardUnknown() { + xxx_messageInfo_BandPriceState.DiscardUnknown(m) +} + +var xxx_messageInfo_BandPriceState proto.InternalMessageInfo + +func (m *BandPriceState) GetSymbol() string { + if m != nil { + return m.Symbol } return "" } +func (m *BandPriceState) GetResolveTime() uint64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *BandPriceState) GetRequest_ID() uint64 { + if m != nil { + return m.Request_ID + } + return 0 +} + +func (m *BandPriceState) GetPriceState() PriceState { + if m != nil { + return m.PriceState + } + return PriceState{} +} + +type PriceState struct { + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (m *PriceState) Reset() { *m = PriceState{} } +func (m *PriceState) String() string { return proto.CompactTextString(m) } +func (*PriceState) ProtoMessage() {} +func (*PriceState) Descriptor() ([]byte, []int) { + return fileDescriptor_78a657bc7a2646c9, []int{3} +} +func (m *PriceState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PriceState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PriceState.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 *PriceState) XXX_Merge(src proto.Message) { + xxx_messageInfo_PriceState.Merge(m, src) +} +func (m *PriceState) XXX_Size() int { + return m.Size() +} +func (m *PriceState) XXX_DiscardUnknown() { + xxx_messageInfo_PriceState.DiscardUnknown(m) +} + +var xxx_messageInfo_PriceState proto.InternalMessageInfo + +func (m *PriceState) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +type CalldataRecord struct { + ClientId uint64 `protobuf:"varint,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Calldata []byte `protobuf:"bytes,2,opt,name=calldata,proto3" json:"calldata,omitempty"` +} + +func (m *CalldataRecord) Reset() { *m = CalldataRecord{} } +func (m *CalldataRecord) String() string { return proto.CompactTextString(m) } +func (*CalldataRecord) ProtoMessage() {} +func (*CalldataRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_78a657bc7a2646c9, []int{4} +} +func (m *CalldataRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CalldataRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CalldataRecord.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 *CalldataRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_CalldataRecord.Merge(m, src) +} +func (m *CalldataRecord) XXX_Size() int { + return m.Size() +} +func (m *CalldataRecord) XXX_DiscardUnknown() { + xxx_messageInfo_CalldataRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_CalldataRecord proto.InternalMessageInfo + +func (m *CalldataRecord) GetClientId() uint64 { + if m != nil { + return m.ClientId + } + return 0 +} + +func (m *CalldataRecord) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "reserve.oracle.GenesisState") + proto.RegisterType((*BandOracleRequestParams)(nil), "reserve.oracle.BandOracleRequestParams") + proto.RegisterType((*BandPriceState)(nil), "reserve.oracle.BandPriceState") + proto.RegisterType((*PriceState)(nil), "reserve.oracle.PriceState") + proto.RegisterType((*CalldataRecord)(nil), "reserve.oracle.CalldataRecord") } func init() { proto.RegisterFile("reserve/oracle/genesis.proto", fileDescriptor_78a657bc7a2646c9) } var fileDescriptor_78a657bc7a2646c9 = []byte{ - // 233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x4a, 0x2d, 0x4e, - 0x2d, 0x2a, 0x4b, 0xd5, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, - 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x41, 0x64, 0xa5, - 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x89, 0x94, 0x48, 0x7a, 0x7e, 0x7a, - 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xa5, 0xd1, 0x8c, 0x2d, 0x48, 0x2c, 0x4a, 0xcc, 0x85, - 0x9a, 0xaa, 0x94, 0xc4, 0xc5, 0xe3, 0x0e, 0xb1, 0x26, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x92, - 0x8b, 0x0d, 0x22, 0x2f, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa6, 0x87, 0x6a, 0xad, 0x5e, - 0x00, 0x58, 0xd6, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, 0x06, 0x41, - 0x35, 0x08, 0x89, 0x73, 0xb1, 0x17, 0xe4, 0x17, 0x95, 0xc4, 0x67, 0xa6, 0x48, 0x30, 0x29, 0x30, - 0x6a, 0x70, 0x06, 0xb1, 0x81, 0xb8, 0x9e, 0x29, 0x4e, 0x9e, 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, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, - 0x9f, 0x9f, 0x97, 0x9f, 0x5b, 0x09, 0x76, 0x54, 0x72, 0x7e, 0x8e, 0x3e, 0xcc, 0xcd, 0x15, 0x30, - 0x57, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x15, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x2d, 0xfc, 0x04, 0xb6, 0x2b, 0x01, 0x00, 0x00, + // 776 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0x8e, 0x9b, 0xdc, 0x90, 0x4c, 0xaa, 0xdc, 0x7b, 0x87, 0x7b, 0x7b, 0x43, 0x7a, 0xeb, 0xf4, + 0x86, 0x05, 0x11, 0x12, 0x36, 0x69, 0x57, 0x5d, 0x92, 0x54, 0xaa, 0x8c, 0x2a, 0x81, 0x5c, 0x56, + 0x6c, 0xac, 0xf1, 0xf8, 0x34, 0x1d, 0x62, 0x7b, 0x8c, 0x67, 0x52, 0x35, 0x6f, 0xc1, 0x63, 0x00, + 0x2b, 0x1e, 0xa3, 0x0b, 0x16, 0x5d, 0x22, 0x16, 0xa5, 0x6a, 0x17, 0xbc, 0x06, 0x9a, 0x9f, 0x34, + 0x3f, 0x04, 0xb1, 0x49, 0x3c, 0xe7, 0x3b, 0xe7, 0x9b, 0xf3, 0xcd, 0x7c, 0x67, 0xd0, 0xfb, 0x12, + 0x04, 0x94, 0xd7, 0xe0, 0xf3, 0x92, 0xd0, 0x14, 0xfc, 0x09, 0xe4, 0x20, 0x98, 0xf0, 0x8a, 0x92, + 0x4b, 0x8e, 0xdb, 0x16, 0xf5, 0x0c, 0xda, 0x7d, 0x4d, 0x32, 0x96, 0x73, 0x5f, 0xff, 0x9a, 0x94, + 0xee, 0x9b, 0x09, 0x9f, 0x70, 0xfd, 0xe9, 0xab, 0x2f, 0x1b, 0xdd, 0xdf, 0xa0, 0x2d, 0x48, 0x49, + 0x32, 0xcb, 0xda, 0x75, 0x29, 0x17, 0x19, 0x17, 0x7e, 0x4c, 0x04, 0xf8, 0xd7, 0xc3, 0x18, 0x24, + 0x19, 0xfa, 0x94, 0xb3, 0xdc, 0xe2, 0x07, 0x9b, 0xc5, 0x25, 0x2f, 0xb8, 0x20, 0xa9, 0x81, 0xfb, + 0xbf, 0xd7, 0xd0, 0xee, 0x99, 0x69, 0xf3, 0x42, 0x12, 0x09, 0xf8, 0x04, 0xd5, 0x0d, 0x7f, 0xc7, + 0x39, 0x74, 0x06, 0xad, 0xa3, 0x3d, 0x6f, 0xbd, 0x6d, 0xef, 0x5b, 0x8d, 0x8e, 0x9a, 0xb7, 0xf7, + 0xbd, 0xca, 0xcf, 0x7f, 0xff, 0xf6, 0xb9, 0x13, 0xda, 0x02, 0xfc, 0x15, 0x6a, 0xc5, 0x24, 0x4f, + 0x22, 0x5b, 0xbf, 0xa3, 0xeb, 0xbb, 0x9b, 0xf5, 0x23, 0x92, 0x27, 0x96, 0xa3, 0xa6, 0x38, 0x42, + 0x14, 0x3f, 0x47, 0xf0, 0xd7, 0xe8, 0xb5, 0xa1, 0x28, 0x19, 0x85, 0x48, 0xa8, 0x8e, 0x44, 0xa7, + 0x7a, 0x58, 0x1d, 0xb4, 0x8e, 0xdc, 0xad, 0x44, 0x2a, 0x4f, 0x37, 0x1e, 0xbe, 0x8c, 0xd7, 0xd6, + 0x02, 0x5f, 0xa0, 0x37, 0x9a, 0xcb, 0xa4, 0x47, 0x25, 0xfc, 0x38, 0x03, 0x21, 0x45, 0xa7, 0xa6, + 0xe9, 0x3e, 0x6c, 0xa3, 0xfb, 0x46, 0x7f, 0x86, 0x26, 0x33, 0xc4, 0xf1, 0x66, 0x48, 0xe0, 0x21, + 0x7a, 0xab, 0x49, 0x53, 0xb5, 0x85, 0x8c, 0x68, 0xca, 0x20, 0x97, 0x11, 0x4b, 0x3a, 0x2f, 0x0e, + 0x9d, 0x41, 0xcd, 0x94, 0x9c, 0x6b, 0x6c, 0xac, 0xa1, 0x20, 0xc1, 0x01, 0x7a, 0x45, 0x49, 0x9a, + 0x26, 0x44, 0x92, 0xa8, 0x04, 0xca, 0xcb, 0x44, 0x74, 0xea, 0xdb, 0x25, 0x8d, 0x6d, 0x5e, 0xa8, + 0xd3, 0xc2, 0x97, 0x74, 0x6d, 0x2d, 0xf0, 0x31, 0xda, 0x5b, 0xdd, 0xdd, 0x4a, 0x52, 0xdb, 0x7f, + 0xa4, 0xb7, 0xff, 0x78, 0xb9, 0xbd, 0xed, 0x38, 0x48, 0xf0, 0x0f, 0xa8, 0xbb, 0xe5, 0x1c, 0x16, + 0xb7, 0xd4, 0xd0, 0xb7, 0xf4, 0xd9, 0xff, 0x9e, 0xc6, 0xda, 0x95, 0xbd, 0x8b, 0xb7, 0xc3, 0xfd, + 0x5f, 0x76, 0xd0, 0xbb, 0xff, 0x28, 0xc5, 0xfb, 0xa8, 0x49, 0xc4, 0x34, 0xa2, 0x7c, 0x96, 0x4b, + 0x6d, 0xae, 0x5a, 0xd8, 0x20, 0x62, 0x3a, 0x56, 0x6b, 0x05, 0x66, 0x2c, 0xb7, 0xe0, 0x8e, 0x01, + 0x33, 0x96, 0x1b, 0xf0, 0x0a, 0x35, 0x2f, 0x01, 0xa2, 0x94, 0x65, 0x4c, 0x5a, 0x37, 0x7c, 0xe2, + 0x19, 0xdf, 0x7b, 0xca, 0xf7, 0x9e, 0xf5, 0xbd, 0x37, 0xe6, 0x2c, 0x1f, 0x7d, 0xa9, 0x5a, 0xfc, + 0xf5, 0xaf, 0xde, 0x60, 0xc2, 0xe4, 0xd5, 0x2c, 0xf6, 0x28, 0xcf, 0x7c, 0x3b, 0x24, 0xe6, 0xef, + 0x0b, 0x91, 0x4c, 0x7d, 0x39, 0x2f, 0x40, 0xe8, 0x02, 0x11, 0x36, 0x2e, 0x01, 0xce, 0x15, 0x39, + 0xee, 0xa1, 0x56, 0x51, 0x42, 0x41, 0x4a, 0x88, 0x26, 0x44, 0x59, 0x45, 0x35, 0x82, 0x6c, 0xe8, + 0x8c, 0x08, 0x95, 0x00, 0x37, 0x40, 0x67, 0xd2, 0x24, 0x98, 0x5b, 0x47, 0x36, 0xa4, 0x12, 0x06, + 0xe8, 0x95, 0x12, 0x22, 0xf8, 0xac, 0xa4, 0x60, 0xf5, 0xd4, 0x75, 0x56, 0x3b, 0x63, 0xf9, 0x85, + 0x0e, 0x6b, 0x55, 0xfd, 0x07, 0x07, 0xb5, 0xd7, 0x3d, 0x8c, 0xf7, 0x50, 0x5d, 0xcc, 0xb3, 0x98, + 0xa7, 0xfa, 0x7c, 0x9a, 0xa1, 0x5d, 0xe1, 0x21, 0xaa, 0x95, 0x44, 0x82, 0x3e, 0x98, 0xe6, 0xe8, + 0x40, 0x09, 0xfc, 0xf3, 0xbe, 0xf7, 0xd6, 0xc8, 0x11, 0xc9, 0xd4, 0x63, 0xdc, 0xcf, 0x88, 0xbc, + 0xf2, 0x82, 0x5c, 0x86, 0x3a, 0x15, 0x7f, 0x40, 0xbb, 0x25, 0x08, 0x9e, 0x5e, 0x43, 0x24, 0x59, + 0x06, 0x9d, 0xaa, 0xee, 0xa1, 0x65, 0x63, 0xdf, 0xb1, 0x0c, 0xf0, 0x01, 0x42, 0x0b, 0x33, 0x04, + 0xa7, 0x56, 0x6b, 0xd3, 0x46, 0x82, 0x53, 0x35, 0xce, 0x2b, 0x63, 0xa8, 0xa5, 0x6e, 0x19, 0xe7, + 0x65, 0xf7, 0x8b, 0x71, 0x2e, 0x9e, 0x23, 0x7d, 0x40, 0x68, 0x45, 0xdd, 0x09, 0x7a, 0xa1, 0x31, + 0x23, 0x6e, 0xf4, 0xa9, 0x95, 0xb1, 0xff, 0x6f, 0x19, 0xe7, 0x30, 0x21, 0x74, 0x7e, 0x0a, 0x34, + 0x34, 0x15, 0xf8, 0x3d, 0x6a, 0x2a, 0x15, 0x42, 0x92, 0xac, 0xd0, 0xa7, 0x50, 0x0d, 0x97, 0x81, + 0x7e, 0x80, 0xda, 0xeb, 0x93, 0xa3, 0xec, 0xb4, 0x1c, 0x4d, 0xeb, 0x35, 0xba, 0x18, 0xc8, 0x2e, + 0x6a, 0x2c, 0x06, 0x4b, 0x73, 0xed, 0x86, 0xcf, 0xeb, 0x51, 0x70, 0xfb, 0xe8, 0x3a, 0x77, 0x8f, + 0xae, 0xf3, 0xf0, 0xe8, 0x3a, 0x3f, 0x3d, 0xb9, 0x95, 0xbb, 0x27, 0xb7, 0xf2, 0xc7, 0x93, 0x5b, + 0xf9, 0xde, 0x5f, 0xb1, 0x13, 0xcf, 0x79, 0x36, 0xd7, 0x0f, 0x28, 0xe5, 0xa9, 0xbf, 0x78, 0x61, + 0x6f, 0x16, 0x6f, 0xac, 0xf6, 0x56, 0x5c, 0xd7, 0x09, 0xc7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x6d, 0x01, 0x01, 0xe5, 0x16, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -123,13 +473,78 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.PortId) > 0 { - i -= len(m.PortId) - copy(dAtA[i:], m.PortId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.PortId))) + { + size, err := m.BandOracleRequestParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if m.BandLatestRequestId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.BandLatestRequestId)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x38 + } + if len(m.CalldataRecords) > 0 { + for iNdEx := len(m.CalldataRecords) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CalldataRecords[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.BandLatestClientId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.BandLatestClientId)) + i-- + dAtA[i] = 0x28 + } + if len(m.BandOracleRequests) > 0 { + for iNdEx := len(m.BandOracleRequests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BandOracleRequests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.BandPriceStates) > 0 { + for iNdEx := len(m.BandPriceStates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BandPriceStates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.BandParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -143,39 +558,809 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *BandOracleRequestParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } + +func (m *BandOracleRequestParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BandOracleRequestParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = len(m.PortId) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) + if m.MinSourceCount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.MinSourceCount)) + i-- + dAtA[i] = 0x30 } - return n + if m.ExecuteGas != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.ExecuteGas)) + i-- + dAtA[i] = 0x28 + } + if m.PrepareGas != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.PrepareGas)) + i-- + dAtA[i] = 0x20 + } + if len(m.FeeLimit) > 0 { + for iNdEx := len(m.FeeLimit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeeLimit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.MinCount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x10 + } + if m.AskCount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *BandPriceState) 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 sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *BandPriceState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BandPriceState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.PriceState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Request_ID != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Request_ID)) + i-- + dAtA[i] = 0x20 + } + if m.ResolveTime != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x18 + } + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PriceState) 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 *PriceState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriceState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Timestamp != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x10 + } + { + size := m.Price.Size() + i -= size + if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CalldataRecord) 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 *CalldataRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CalldataRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x12 + } + if m.ClientId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.ClientId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.BandParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.BandPriceStates) > 0 { + for _, e := range m.BandPriceStates { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BandOracleRequests) > 0 { + for _, e := range m.BandOracleRequests { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.BandLatestClientId != 0 { + n += 1 + sovGenesis(uint64(m.BandLatestClientId)) + } + if len(m.CalldataRecords) > 0 { + for _, e := range m.CalldataRecords { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.BandLatestRequestId != 0 { + n += 1 + sovGenesis(uint64(m.BandLatestRequestId)) + } + l = m.BandOracleRequestParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func (m *BandOracleRequestParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AskCount != 0 { + n += 1 + sovGenesis(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovGenesis(uint64(m.MinCount)) + } + if len(m.FeeLimit) > 0 { + for _, e := range m.FeeLimit { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.PrepareGas != 0 { + n += 1 + sovGenesis(uint64(m.PrepareGas)) + } + if m.ExecuteGas != 0 { + n += 1 + sovGenesis(uint64(m.ExecuteGas)) + } + if m.MinSourceCount != 0 { + n += 1 + sovGenesis(uint64(m.MinSourceCount)) + } + return n +} + +func (m *BandPriceState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = m.Rate.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.ResolveTime != 0 { + n += 1 + sovGenesis(uint64(m.ResolveTime)) + } + if m.Request_ID != 0 { + n += 1 + sovGenesis(uint64(m.Request_ID)) + } + l = m.PriceState.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func (m *PriceState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Price.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.Timestamp != 0 { + n += 1 + sovGenesis(uint64(m.Timestamp)) + } + return n +} + +func (m *CalldataRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ClientId != 0 { + n += 1 + sovGenesis(uint64(m.ClientId)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BandParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BandParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BandPriceStates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BandPriceStates = append(m.BandPriceStates, &BandPriceState{}) + if err := m.BandPriceStates[len(m.BandPriceStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BandOracleRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BandOracleRequests = append(m.BandOracleRequests, &BandOracleRequest{}) + if err := m.BandOracleRequests[len(m.BandOracleRequests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BandLatestClientId", wireType) + } + m.BandLatestClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BandLatestClientId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CalldataRecords", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CalldataRecords = append(m.CalldataRecords, &CalldataRecord{}) + if err := m.CalldataRecords[len(m.CalldataRecords)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BandLatestRequestId", wireType) + } + m.BandLatestRequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BandLatestRequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BandOracleRequestParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BandOracleRequestParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BandOracleRequestParams) 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 ErrIntOverflowGenesis + } + 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: BandOracleRequestParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BandOracleRequestParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeLimit = append(m.FeeLimit, types.Coin{}) + if err := m.FeeLimit[len(m.FeeLimit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrepareGas", wireType) + } + m.PrepareGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrepareGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecuteGas", wireType) + } + m.ExecuteGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecuteGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSourceCount", wireType) + } + m.MinSourceCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinSourceCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *GenesisState) Unmarshal(dAtA []byte) error { +func (m *BandPriceState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -198,15 +1383,119 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + return fmt.Errorf("proto: BandPriceState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BandPriceState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Request_ID", wireType) + } + m.Request_ID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Request_ID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceState", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -233,13 +1522,63 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PriceState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriceState) 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 ErrIntOverflowGenesis + } + 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: PriceState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriceState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -267,7 +1606,131 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PortId = string(dAtA[iNdEx:postIndex]) + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CalldataRecord) 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 ErrIntOverflowGenesis + } + 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: CalldataRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CalldataRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + m.ClientId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/oracle/types/genesis_test.go b/x/oracle/types/genesis_test.go index 525bfefb..88998ff1 100644 --- a/x/oracle/types/genesis_test.go +++ b/x/oracle/types/genesis_test.go @@ -3,40 +3,40 @@ package types_test import ( "testing" - "github.com/onomyprotocol/reserve/x/oracle/types" + // "github.com/onomyprotocol/reserve/x/oracle/types" - "github.com/stretchr/testify/require" + // "github.com/stretchr/testify/require" ) func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - PortId: types.PortID, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } + // tests := []struct { + // desc string + // genState *types.GenesisState + // valid bool + // }{ + // { + // desc: "default is valid", + // genState: types.DefaultGenesis(), + // valid: true, + // }, + // { + // desc: "valid genesis state", + // genState: &types.GenesisState{ + // PortId: types.PortID, + // // this line is used by starport scaffolding # types/genesis/validField + // }, + // valid: true, + // }, + // // this line is used by starport scaffolding # types/genesis/testcase + // } + // for _, tc := range tests { + // t.Run(tc.desc, func(t *testing.T) { + // err := tc.genState.Validate() + // if tc.valid { + // require.NoError(t, err) + // } else { + // require.Error(t, err) + // } + // }) + // } } diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 45304fdb..8401bfb8 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -1,5 +1,9 @@ package types +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + const ( // ModuleName defines the module name ModuleName = "oracle" @@ -11,14 +15,21 @@ const ( MemStoreKey = "mem_oracle" // Version defines the current version the IBC module supports - Version = "oracle-1" + // Version = "oracle-1" // PortID is the default port id that module binds to PortID = "oracle" ) var ( - ParamsKey = []byte("p_oracle") + ParamsKey = []byte("p_oracle") + BandParamsKey = []byte{0x01} + BandCallDataRecordKey = []byte{0x02} + LatestClientIDKey = []byte{0x03} + BandOracleRequestIDKey = []byte{0x04} + BandPriceKey = []byte{0x05} + LatestRequestIDKey = []byte{0x06} + BandOracleRequestParamsKey = []byte{0x07} ) var ( @@ -26,6 +37,18 @@ var ( PortKey = KeyPrefix("oracle-port-") ) +func GetBandCallDataRecordKey(clientID uint64) []byte { + return append(BandCallDataRecordKey, sdk.Uint64ToBigEndian(clientID)...) +} + +func GetBandOracleRequestIDKey(requestID uint64) []byte { + return append(BandOracleRequestIDKey, sdk.Uint64ToBigEndian(requestID)...) +} + +func GetBandPriceStoreKey(symbol string) []byte { + return append(BandPriceKey, []byte(symbol)...) +} + func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/oracle/types/msgs.go b/x/oracle/types/msgs.go new file mode 100644 index 00000000..d0ebeb8a --- /dev/null +++ b/x/oracle/types/msgs.go @@ -0,0 +1,92 @@ +package types + +import ( + "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// oracle message types +const ( + RouterKey = ModuleName + TypeMsgRequestBandRates = "requestBandRates" + TypeMsgUpdateParams = "updateParams" +) + +var ( + _ sdk.Msg = &MsgRequestBandRates{} + _ sdk.Msg = &MsgUpdateParams{} +) + +func (msg MsgUpdateParams) Route() string { return RouterKey } + +func (msg MsgUpdateParams) Type() string { return TypeMsgUpdateParams } + +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshal(msg)) +} + +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// NewMsgRequestBandRates creates a new MsgRequestBandRates instance. +func NewMsgRequestBandRates( + sender sdk.AccAddress, + requestID uint64, +) *MsgRequestBandRates { + return &MsgRequestBandRates{ + Sender: sender.String(), + RequestId: requestID, + } +} + +// Route implements the sdk.Msg interface for MsgRequestBandRates. +func (msg MsgRequestBandRates) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface for MsgRequestBandRates. +func (msg MsgRequestBandRates) Type() string { return TypeMsgRequestBandRates } + +// ValidateBasic implements the sdk.Msg interface for MsgRequestBandRates. +func (msg MsgRequestBandRates) ValidateBasic() error { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return err + } + if sender.Empty() { + return errors.Wrapf(ErrInvalidBandRequest, "MsgRequestBandRates: Sender address must not be empty.") + } + + if msg.RequestId == 0 { + return errors.Wrapf(ErrInvalidBandRequest, "MsgRequestBandRates: requestID should be greater than zero") + } + return nil +} + +// GetSigners implements the sdk.Msg interface for MsgRequestBandRates. +func (msg MsgRequestBandRates) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface for MsgRequestBandRates. +func (msg MsgRequestBandRates) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} diff --git a/x/oracle/types/packet.pb.go b/x/oracle/types/packet.pb.go index e33191e2..2b65e6b0 100644 --- a/x/oracle/types/packet.pb.go +++ b/x/oracle/types/packet.pb.go @@ -4,7 +4,11 @@ package types import ( + bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -22,25 +26,82 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type OraclePacketData struct { - // Types that are valid to be assigned to Packet: - // - // *OraclePacketData_NoData - Packet isOraclePacketData_Packet `protobuf_oneof:"packet"` +// ResolveStatus encodes the status of an oracle request. +type ResolveStatus int32 + +const ( + // Open - the request is not yet resolved. + RESOLVE_STATUS_OPEN ResolveStatus = 0 + // Success - the request has been resolved successfully with no errors. + RESOLVE_STATUS_SUCCESS ResolveStatus = 1 + // Failure - an error occured during the request's resolve call. + RESOLVE_STATUS_FAILURE ResolveStatus = 2 + // Expired - the request does not get enough reports from validator within the + // timeframe. + RESOLVE_STATUS_EXPIRED ResolveStatus = 3 +) + +var ResolveStatus_name = map[int32]string{ + 0: "RESOLVE_STATUS_OPEN_UNSPECIFIED", + 1: "RESOLVE_STATUS_SUCCESS", + 2: "RESOLVE_STATUS_FAILURE", + 3: "RESOLVE_STATUS_EXPIRED", +} + +var ResolveStatus_value = map[string]int32{ + "RESOLVE_STATUS_OPEN_UNSPECIFIED": 0, + "RESOLVE_STATUS_SUCCESS": 1, + "RESOLVE_STATUS_FAILURE": 2, + "RESOLVE_STATUS_EXPIRED": 3, +} + +func (x ResolveStatus) String() string { + return proto.EnumName(ResolveStatus_name, int32(x)) } -func (m *OraclePacketData) Reset() { *m = OraclePacketData{} } -func (m *OraclePacketData) String() string { return proto.CompactTextString(m) } -func (*OraclePacketData) ProtoMessage() {} -func (*OraclePacketData) Descriptor() ([]byte, []int) { +func (ResolveStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_dacd96e030a6c748, []int{0} } -func (m *OraclePacketData) XXX_Unmarshal(b []byte) error { + +type OracleRequestPacketData struct { + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptID uint64 `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3" json:"oracle_script_id,omitempty"` + // Calldata is the OBI-encoded calldata bytes available for oracle executor to + // read. + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + FeeLimit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=fee_limit,json=feeLimit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee_limit"` + // PrepareGas is amount of gas to pay to prepare raw requests + PrepareGas uint64 `protobuf:"varint,7,opt,name=prepare_gas,json=prepareGas,proto3" json:"prepare_gas,omitempty"` + // ExecuteGas is amount of gas to reserve for executing + ExecuteGas uint64 `protobuf:"varint,8,opt,name=execute_gas,json=executeGas,proto3" json:"execute_gas,omitempty"` +} + +func (m *OracleRequestPacketData) Reset() { *m = OracleRequestPacketData{} } +func (m *OracleRequestPacketData) String() string { return proto.CompactTextString(m) } +func (*OracleRequestPacketData) ProtoMessage() {} +func (*OracleRequestPacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_dacd96e030a6c748, []int{0} +} +func (m *OracleRequestPacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *OraclePacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OracleRequestPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_OraclePacketData.Marshal(b, m, deterministic) + return xxx_messageInfo_OracleRequestPacketData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -50,66 +111,112 @@ func (m *OraclePacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *OraclePacketData) XXX_Merge(src proto.Message) { - xxx_messageInfo_OraclePacketData.Merge(m, src) +func (m *OracleRequestPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleRequestPacketData.Merge(m, src) } -func (m *OraclePacketData) XXX_Size() int { +func (m *OracleRequestPacketData) XXX_Size() int { return m.Size() } -func (m *OraclePacketData) XXX_DiscardUnknown() { - xxx_messageInfo_OraclePacketData.DiscardUnknown(m) +func (m *OracleRequestPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_OracleRequestPacketData.DiscardUnknown(m) } -var xxx_messageInfo_OraclePacketData proto.InternalMessageInfo +var xxx_messageInfo_OracleRequestPacketData proto.InternalMessageInfo -type isOraclePacketData_Packet interface { - isOraclePacketData_Packet() - MarshalTo([]byte) (int, error) - Size() int +func (m *OracleRequestPacketData) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" } -type OraclePacketData_NoData struct { - NoData *NoData `protobuf:"bytes,1,opt,name=noData,proto3,oneof" json:"noData,omitempty"` +func (m *OracleRequestPacketData) GetOracleScriptID() uint64 { + if m != nil { + return m.OracleScriptID + } + return 0 } -func (*OraclePacketData_NoData) isOraclePacketData_Packet() {} - -func (m *OraclePacketData) GetPacket() isOraclePacketData_Packet { +func (m *OracleRequestPacketData) GetCalldata() []byte { if m != nil { - return m.Packet + return m.Calldata } return nil } -func (m *OraclePacketData) GetNoData() *NoData { - if x, ok := m.GetPacket().(*OraclePacketData_NoData); ok { - return x.NoData +func (m *OracleRequestPacketData) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *OracleRequestPacketData) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *OracleRequestPacketData) GetFeeLimit() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeeLimit } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*OraclePacketData) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*OraclePacketData_NoData)(nil), +func (m *OracleRequestPacketData) GetPrepareGas() uint64 { + if m != nil { + return m.PrepareGas } + return 0 } -type NoData struct { +func (m *OracleRequestPacketData) GetExecuteGas() uint64 { + if m != nil { + return m.ExecuteGas + } + return 0 } -func (m *NoData) Reset() { *m = NoData{} } -func (m *NoData) String() string { return proto.CompactTextString(m) } -func (*NoData) ProtoMessage() {} -func (*NoData) Descriptor() ([]byte, []int) { +// OracleResponsePacketData encodes an oracle response from BandChain to the +// requester. +type OracleResponsePacketData struct { + // ClientID is the unique identifier matched with that of the oracle request + // packet. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // RequestID is BandChain's unique identifier for this oracle request. + RequestID uint64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + AnsCount uint64 `protobuf:"varint,3,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + RequestTime int64 `protobuf:"varint,4,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + ResolveTime int64 `protobuf:"varint,5,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=reserve.oracle.ResolveStatus" json:"resolve_status,omitempty"` + // Result is the final aggregated value encoded in OBI format. Only available + // if status if OK. + Result []byte `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *OracleResponsePacketData) Reset() { *m = OracleResponsePacketData{} } +func (m *OracleResponsePacketData) String() string { return proto.CompactTextString(m) } +func (*OracleResponsePacketData) ProtoMessage() {} +func (*OracleResponsePacketData) Descriptor() ([]byte, []int) { return fileDescriptor_dacd96e030a6c748, []int{1} } -func (m *NoData) XXX_Unmarshal(b []byte) error { +func (m *OracleResponsePacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OracleResponsePacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_NoData.Marshal(b, m, deterministic) + return xxx_messageInfo_OracleResponsePacketData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -119,42 +226,214 @@ func (m *NoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *NoData) XXX_Merge(src proto.Message) { - xxx_messageInfo_NoData.Merge(m, src) +func (m *OracleResponsePacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleResponsePacketData.Merge(m, src) } -func (m *NoData) XXX_Size() int { +func (m *OracleResponsePacketData) XXX_Size() int { return m.Size() } -func (m *NoData) XXX_DiscardUnknown() { - xxx_messageInfo_NoData.DiscardUnknown(m) +func (m *OracleResponsePacketData) XXX_DiscardUnknown() { + xxx_messageInfo_OracleResponsePacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleResponsePacketData proto.InternalMessageInfo + +func (m *OracleResponsePacketData) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *OracleResponsePacketData) GetRequestID() uint64 { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *OracleResponsePacketData) GetAnsCount() uint64 { + if m != nil { + return m.AnsCount + } + return 0 +} + +func (m *OracleResponsePacketData) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *OracleResponsePacketData) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *OracleResponsePacketData) GetResolveStatus() ResolveStatus { + if m != nil { + return m.ResolveStatus + } + return RESOLVE_STATUS_OPEN } -var xxx_messageInfo_NoData proto.InternalMessageInfo +func (m *OracleResponsePacketData) GetResult() []byte { + if m != nil { + return m.Result + } + return nil +} func init() { - proto.RegisterType((*OraclePacketData)(nil), "reserve.oracle.OraclePacketData") - proto.RegisterType((*NoData)(nil), "reserve.oracle.NoData") + proto.RegisterEnum("reserve.oracle.ResolveStatus", ResolveStatus_name, ResolveStatus_value) + proto.RegisterType((*OracleRequestPacketData)(nil), "reserve.oracle.OracleRequestPacketData") + proto.RegisterType((*OracleResponsePacketData)(nil), "reserve.oracle.OracleResponsePacketData") } func init() { proto.RegisterFile("reserve/oracle/packet.proto", fileDescriptor_dacd96e030a6c748) } var fileDescriptor_dacd96e030a6c748 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x4a, 0x2d, 0x4e, - 0x2d, 0x2a, 0x4b, 0xd5, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x48, 0x4c, 0xce, 0x4e, - 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0x95, 0xfc, - 0xb8, 0x04, 0xfc, 0xc1, 0xac, 0x00, 0xb0, 0x2a, 0x97, 0xc4, 0x92, 0x44, 0x21, 0x03, 0x2e, 0xb6, - 0xbc, 0x7c, 0x10, 0x4b, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x4c, 0x0f, 0x55, 0x93, 0x9e, - 0x1f, 0x58, 0xd6, 0x83, 0x21, 0x08, 0xaa, 0xce, 0x89, 0x83, 0x8b, 0x0d, 0x62, 0x8b, 0x12, 0x07, - 0x17, 0x1b, 0x44, 0xd6, 0xc9, 0xf3, 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, - 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf3, 0xf2, 0x73, - 0x2b, 0xc1, 0x4e, 0x4b, 0xce, 0xcf, 0xd1, 0x87, 0xb9, 0xbc, 0x02, 0xe6, 0xf6, 0x92, 0xca, 0x82, - 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x02, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, 0x28, 0x41, - 0xe2, 0xda, 0x00, 0x00, 0x00, -} - -func (m *OraclePacketData) Marshal() (dAtA []byte, err error) { + // 661 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x4e, 0xdb, 0x4a, + 0x14, 0x86, 0x63, 0x12, 0x72, 0x93, 0x21, 0x44, 0x91, 0xef, 0x15, 0xe4, 0x06, 0x5d, 0xdb, 0x97, + 0x55, 0x5a, 0xb5, 0x76, 0xa1, 0x52, 0x17, 0x15, 0x1b, 0x12, 0x1b, 0x64, 0x09, 0x41, 0x34, 0x26, + 0x55, 0xd5, 0x8d, 0x35, 0x71, 0x86, 0x60, 0xc5, 0xf6, 0xb8, 0x9e, 0x09, 0x82, 0x37, 0xa8, 0x58, + 0xf5, 0x05, 0x90, 0x2a, 0x75, 0xd7, 0x47, 0xe8, 0x13, 0xb0, 0x64, 0xd9, 0x55, 0x5a, 0x85, 0x4d, + 0xdf, 0xa1, 0x9b, 0xca, 0x33, 0x93, 0x16, 0xaa, 0x74, 0xd3, 0x55, 0x72, 0xce, 0xff, 0xfd, 0xc7, + 0xd6, 0x7f, 0xc6, 0x03, 0x36, 0x32, 0x4c, 0x71, 0x76, 0x86, 0x2d, 0x92, 0xa1, 0x20, 0xc2, 0x56, + 0x8a, 0x82, 0x31, 0x66, 0x66, 0x9a, 0x11, 0x46, 0xd4, 0xba, 0x14, 0x4d, 0x21, 0xb6, 0xfe, 0x19, + 0x91, 0x11, 0xe1, 0x92, 0x95, 0xff, 0x13, 0x54, 0x4b, 0x0b, 0x08, 0x8d, 0x09, 0xb5, 0x06, 0x88, + 0x62, 0xeb, 0x6c, 0x6b, 0x80, 0x19, 0xda, 0xb2, 0x02, 0x12, 0x26, 0x42, 0xdf, 0xbc, 0x2c, 0x82, + 0xf5, 0x23, 0x3e, 0x00, 0xe2, 0xd7, 0x13, 0x4c, 0x59, 0x8f, 0x3f, 0xc3, 0x46, 0x0c, 0xa9, 0x0f, + 0x40, 0x35, 0x88, 0x42, 0x9c, 0x30, 0x3f, 0x1c, 0x36, 0x15, 0x43, 0x69, 0x57, 0x3b, 0xb5, 0xd9, + 0x54, 0xaf, 0x74, 0x79, 0xd3, 0xb5, 0x61, 0x45, 0xc8, 0xee, 0x50, 0xdd, 0x01, 0x0d, 0xf1, 0x1a, + 0x3e, 0x0d, 0xb2, 0x30, 0xe5, 0x8e, 0x25, 0x43, 0x69, 0x97, 0x3a, 0xea, 0x6c, 0xaa, 0xd7, 0xc5, + 0x13, 0x3c, 0x2e, 0xb9, 0x36, 0xac, 0x93, 0xbb, 0xf5, 0x50, 0x6d, 0x81, 0x4a, 0x80, 0xa2, 0x68, + 0x88, 0x18, 0x6a, 0x16, 0x0d, 0xa5, 0x5d, 0x83, 0x3f, 0x6a, 0x75, 0x03, 0x54, 0x11, 0x1d, 0xfb, + 0x01, 0x99, 0x24, 0xac, 0x59, 0xca, 0x47, 0xc2, 0x0a, 0xa2, 0xe3, 0x6e, 0x5e, 0xe7, 0x62, 0x1c, + 0x26, 0x52, 0x5c, 0x16, 0x62, 0x1c, 0x26, 0x42, 0x3c, 0x05, 0xd5, 0x13, 0x8c, 0xfd, 0x28, 0x8c, + 0x43, 0xd6, 0x2c, 0x1b, 0xc5, 0xf6, 0xca, 0xf6, 0xbf, 0xa6, 0x88, 0xc3, 0xcc, 0xe3, 0x30, 0x65, + 0x1c, 0x66, 0x97, 0x84, 0x49, 0xe7, 0xc9, 0xf5, 0x54, 0x2f, 0x7c, 0xf8, 0xac, 0xb7, 0x47, 0x21, + 0x3b, 0x9d, 0x0c, 0xcc, 0x80, 0xc4, 0x96, 0xcc, 0x4e, 0xfc, 0x3c, 0xa6, 0xc3, 0xb1, 0xc5, 0x2e, + 0x52, 0x4c, 0xb9, 0x81, 0xc2, 0xca, 0x09, 0xc6, 0x07, 0xf9, 0x70, 0x55, 0x07, 0x2b, 0x69, 0x86, + 0x53, 0x94, 0x61, 0x7f, 0x84, 0x68, 0xf3, 0x2f, 0xfe, 0x22, 0x40, 0xb6, 0xf6, 0x11, 0xcd, 0x01, + 0x7c, 0x8e, 0x83, 0x09, 0x13, 0x40, 0x45, 0x00, 0xb2, 0xb5, 0x8f, 0xe8, 0xf3, 0xd2, 0xd7, 0x77, + 0xba, 0xb2, 0xf9, 0x71, 0x09, 0x34, 0xe7, 0xcb, 0xa0, 0x29, 0x49, 0x28, 0xfe, 0xb3, 0x6d, 0x3c, + 0x02, 0x20, 0x13, 0xdb, 0xfc, 0xb9, 0x87, 0xd5, 0xd9, 0x54, 0xaf, 0xca, 0x1d, 0xbb, 0x36, 0xac, + 0x4a, 0xc0, 0x1d, 0xf2, 0x84, 0x13, 0x2a, 0x43, 0x2c, 0xca, 0x84, 0x13, 0x2a, 0x42, 0xfc, 0x1f, + 0xd4, 0xe6, 0xa3, 0x58, 0x18, 0x63, 0xbe, 0x81, 0x22, 0x5c, 0x91, 0xbd, 0xe3, 0x30, 0xc6, 0x02, + 0xa1, 0x24, 0x3a, 0xc3, 0x02, 0x59, 0x9e, 0x23, 0xbc, 0xc7, 0x11, 0x1b, 0xd4, 0xe7, 0x08, 0x65, + 0x88, 0x4d, 0x68, 0xb3, 0x6c, 0x28, 0xed, 0xfa, 0xf6, 0x7f, 0xe6, 0xfd, 0x43, 0x6c, 0x42, 0x41, + 0x79, 0x1c, 0x82, 0xab, 0xd9, 0xdd, 0x52, 0x5d, 0x03, 0xe5, 0x0c, 0xd3, 0x49, 0xc4, 0x78, 0xc2, + 0x35, 0x28, 0x2b, 0x11, 0xde, 0xc3, 0x6f, 0x0a, 0x58, 0xbd, 0x67, 0x57, 0x77, 0x80, 0x0e, 0x1d, + 0xef, 0xe8, 0xe0, 0x85, 0xe3, 0x7b, 0xc7, 0xbb, 0xc7, 0x7d, 0xcf, 0x3f, 0xea, 0x39, 0x87, 0x7e, + 0xff, 0xd0, 0xeb, 0x39, 0x5d, 0x77, 0xcf, 0x75, 0xec, 0x46, 0xa1, 0xb5, 0x7e, 0x79, 0x65, 0xfc, + 0xbd, 0x00, 0x53, 0x9f, 0x81, 0xb5, 0x5f, 0xda, 0x5e, 0xbf, 0xdb, 0x75, 0x3c, 0xaf, 0xa1, 0xb4, + 0x5a, 0x97, 0x57, 0xc6, 0x6f, 0xd4, 0x05, 0xbe, 0xbd, 0x5d, 0xf7, 0xa0, 0x0f, 0x9d, 0xc6, 0xd2, + 0x42, 0x9f, 0x54, 0x17, 0xf8, 0x9c, 0x97, 0x3d, 0x17, 0x3a, 0x76, 0xa3, 0xb8, 0xd0, 0x27, 0xd5, + 0x56, 0xe9, 0xcd, 0x7b, 0xad, 0xd0, 0x71, 0xaf, 0x67, 0x9a, 0x72, 0x33, 0xd3, 0x94, 0x2f, 0x33, + 0x4d, 0x79, 0x7b, 0xab, 0x15, 0x6e, 0x6e, 0xb5, 0xc2, 0xa7, 0x5b, 0xad, 0xf0, 0xca, 0xba, 0x73, + 0xa0, 0x49, 0x42, 0xe2, 0x0b, 0xfe, 0xe1, 0x07, 0x24, 0xb2, 0xe6, 0xb7, 0xcb, 0xf9, 0xfc, 0x7e, + 0xe1, 0xa7, 0x7b, 0x50, 0xe6, 0xc0, 0xd3, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x14, 0xcb, + 0xbf, 0x7e, 0x04, 0x00, 0x00, +} + +func (this *OracleRequestPacketData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleRequestPacketData) + if !ok { + that2, ok := that.(OracleRequestPacketData) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if this.AskCount != that1.AskCount { + return false + } + if this.MinCount != that1.MinCount { + return false + } + if len(this.FeeLimit) != len(that1.FeeLimit) { + return false + } + for i := range this.FeeLimit { + if !this.FeeLimit[i].Equal(&that1.FeeLimit[i]) { + return false + } + } + if this.PrepareGas != that1.PrepareGas { + return false + } + if this.ExecuteGas != that1.ExecuteGas { + return false + } + return true +} +func (this *OracleResponsePacketData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleResponsePacketData) + if !ok { + that2, ok := that.(OracleResponsePacketData) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.AnsCount != that1.AnsCount { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ResolveTime != that1.ResolveTime { + return false + } + if this.ResolveStatus != that1.ResolveStatus { + return false + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + return true +} +func (m *OracleRequestPacketData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -164,50 +443,73 @@ func (m *OraclePacketData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OraclePacketData) MarshalTo(dAtA []byte) (int, error) { +func (m *OracleRequestPacketData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OraclePacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OracleRequestPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Packet != nil { - { - size := m.Packet.Size() - i -= size - if _, err := m.Packet.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } + if m.ExecuteGas != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.ExecuteGas)) + i-- + dAtA[i] = 0x40 } - return len(dAtA) - i, nil -} - -func (m *OraclePacketData_NoData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OraclePacketData_NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.NoData != nil { - { - size, err := m.NoData.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.PrepareGas != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.PrepareGas)) + i-- + dAtA[i] = 0x38 + } + if len(m.FeeLimit) > 0 { + for iNdEx := len(m.FeeLimit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeeLimit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPacket(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintPacket(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 } + } + if m.MinCount != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintPacket(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.OracleScriptID != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintPacket(dAtA, i, uint64(len(m.ClientID))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *NoData) Marshal() (dAtA []byte, err error) { + +func (m *OracleResponsePacketData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -217,16 +519,55 @@ func (m *NoData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NoData) MarshalTo(dAtA []byte) (int, error) { +func (m *OracleResponsePacketData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OracleResponsePacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintPacket(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x3a + } + if m.ResolveStatus != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.ResolveStatus)) + i-- + dAtA[i] = 0x30 + } + if m.ResolveTime != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x28 + } + if m.RequestTime != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x20 + } + if m.AnsCount != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.AnsCount)) + i-- + dAtA[i] = 0x18 + } + if m.RequestID != 0 { + i = encodeVarintPacket(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintPacket(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -241,36 +582,73 @@ func encodeVarintPacket(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *OraclePacketData) Size() (n int) { +func (m *OracleRequestPacketData) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Packet != nil { - n += m.Packet.Size() + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovPacket(uint64(l)) + } + if m.OracleScriptID != 0 { + n += 1 + sovPacket(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovPacket(uint64(l)) + } + if m.AskCount != 0 { + n += 1 + sovPacket(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovPacket(uint64(m.MinCount)) + } + if len(m.FeeLimit) > 0 { + for _, e := range m.FeeLimit { + l = e.Size() + n += 1 + l + sovPacket(uint64(l)) + } + } + if m.PrepareGas != 0 { + n += 1 + sovPacket(uint64(m.PrepareGas)) + } + if m.ExecuteGas != 0 { + n += 1 + sovPacket(uint64(m.ExecuteGas)) } return n } -func (m *OraclePacketData_NoData) Size() (n int) { +func (m *OracleResponsePacketData) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.NoData != nil { - l = m.NoData.Size() + l = len(m.ClientID) + if l > 0 { n += 1 + l + sovPacket(uint64(l)) } - return n -} -func (m *NoData) Size() (n int) { - if m == nil { - return 0 + if m.RequestID != 0 { + n += 1 + sovPacket(uint64(m.RequestID)) + } + if m.AnsCount != 0 { + n += 1 + sovPacket(uint64(m.AnsCount)) + } + if m.RequestTime != 0 { + n += 1 + sovPacket(uint64(m.RequestTime)) + } + if m.ResolveTime != 0 { + n += 1 + sovPacket(uint64(m.ResolveTime)) + } + if m.ResolveStatus != 0 { + n += 1 + sovPacket(uint64(m.ResolveStatus)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovPacket(uint64(l)) } - var l int - _ = l return n } @@ -280,7 +658,7 @@ func sovPacket(x uint64) (n int) { func sozPacket(x uint64) (n int) { return sovPacket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *OraclePacketData) Unmarshal(dAtA []byte) error { +func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -303,15 +681,138 @@ func (m *OraclePacketData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OraclePacketData: wiretype end group for non-group") + return fmt.Errorf("proto: OracleRequestPacketData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OraclePacketData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OracleRequestPacketData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NoData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + 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 ErrInvalidLengthPacket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPacket + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeLimit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -338,12 +839,49 @@ func (m *OraclePacketData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &NoData{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FeeLimit = append(m.FeeLimit, types.Coin{}) + if err := m.FeeLimit[len(m.FeeLimit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Packet = &OraclePacketData_NoData{v} iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrepareGas", wireType) + } + m.PrepareGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrepareGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecuteGas", wireType) + } + m.ExecuteGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecuteGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPacket(dAtA[iNdEx:]) @@ -365,7 +903,7 @@ func (m *OraclePacketData) Unmarshal(dAtA []byte) error { } return nil } -func (m *NoData) Unmarshal(dAtA []byte) error { +func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -388,12 +926,173 @@ func (m *NoData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NoData: wiretype end group for non-group") + return fmt.Errorf("proto: OracleResponsePacketData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NoData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OracleResponsePacketData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + 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 ErrInvalidLengthPacket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) + } + m.AnsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) + } + m.ResolveStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveStatus |= ResolveStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPacket + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPacket(dAtA[iNdEx:]) diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 4f3215e3..c361c559 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -1,11 +1,31 @@ package types import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) var _ paramtypes.ParamSet = (*Params)(nil) +var ( + // Each value below is the default value for each parameter when generating the default + // genesis file. + DefaultBandRequestInterval = int64(1) // every 1 block + DefaultBandSourceChannel = "channel-0" + DefaultBandVersion = "bandchain-1" + DefaultBandPortID = "oracle" + + // DefaultBandOracleRequestParams + // TODO: Check these params + DefaultAskCount = uint64(16) + DefaultMinCount = uint64(10) + DefaultFeeLimit = sdk.Coins{sdk.NewCoin("uband", sdkmath.NewInt(100))} + DefaultPrepareGas = uint64(20000) + DefaultExecuteGas = uint64(100000) + DefaultMinSourceCount = uint64(3) +) + // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) @@ -26,7 +46,42 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{} } +// DefaultBandParams returns the default BandParams +func DefaultBandParams() BandParams { + return BandParams{ + IbcRequestInterval: DefaultBandRequestInterval, + IbcSourceChannel: DefaultBandSourceChannel, + IbcVersion: DefaultBandVersion, + IbcPortId: DefaultBandPortID, + } +} + +// DefaultBandOracelRequestParams return the default BandOracelRequestParams +func DefaultBandOracelRequestParams() BandOracleRequestParams { + return BandOracleRequestParams{ + AskCount: DefaultAskCount, + MinCount: DefaultMinCount, + FeeLimit: DefaultFeeLimit, + PrepareGas: DefaultPrepareGas, + ExecuteGas: DefaultExecuteGas, + MinSourceCount: DefaultMinSourceCount, + } +} + // Validate validates the set of params func (p Params) Validate() error { return nil } + +func DefaultTestBandIbcParams() *BandParams { + return &BandParams{ + // block request interval to send Band IBC prices + IbcRequestInterval: 10, + // band IBC source channel + IbcSourceChannel: "channel-0", + // band IBC version + IbcVersion: "bandchain-1", + // band IBC portID + IbcPortId: "oracle", + } +} diff --git a/x/oracle/types/proposal.go b/x/oracle/types/proposal.go new file mode 100644 index 00000000..a78f0cc0 --- /dev/null +++ b/x/oracle/types/proposal.go @@ -0,0 +1,146 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/onomyprotocol/reserve/x/oracle/utils" +) + +// constants +const ( + ProposalUpdateBandParams string = "ProposalUpdateBandParams" + ProposalUpdateBandOracleRequest string = "ProposalUpdateBandOracleRequest" + ProposalDeleteBandOracleRequest string = "ProposalDeleteBandOracleRequest" +) + +func init() { + govtypes.RegisterProposalType(ProposalUpdateBandParams) + govtypes.RegisterProposalType(ProposalUpdateBandOracleRequest) + govtypes.RegisterProposalType(ProposalDeleteBandOracleRequest) +} + +// Implements Proposal Interface +var _ govtypes.Content = &UpdateBandParamsProposal{} +var _ govtypes.Content = &UpdateBandOracleRequestProposal{} +var _ govtypes.Content = &DeleteBandOracleRequestProposal{} + +// GetTitle returns the title of this proposal. +func (p *UpdateBandParamsProposal) GetTitle() string { + return p.Title +} + +// GetDescription returns the description of this proposal. +func (p *UpdateBandParamsProposal) GetDescription() string { + return p.Description +} + +// ProposalRoute returns router key of this proposal. +func (p *UpdateBandParamsProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type of this proposal. +func (p *UpdateBandParamsProposal) ProposalType() string { + return ProposalUpdateBandParams +} + +// ValidateBasic returns ValidateBasic result of this proposal. +func (p *UpdateBandParamsProposal) ValidateBasic() error { + + if p.BandParams.IbcRequestInterval == 0 { + return ErrBadRequestInterval + } + + if p.BandParams.IbcSourceChannel == "" { + return errorsmod.Wrap(ErrInvalidSourceChannel, "UpdateBandParamsProposal: IBC Source Channel must not be empty.") + } + if p.BandParams.IbcVersion == "" { + return errorsmod.Wrap(ErrInvalidVersion, "UpdateBandParamsProposal: IBC Version must not be empty.") + } + + return govtypes.ValidateAbstract(p) +} + +// GetTitle returns the title of this proposal. +func (p *UpdateBandOracleRequestProposal) GetTitle() string { + return p.Title +} + +// GetDescription returns the description of this proposal. +func (p *UpdateBandOracleRequestProposal) GetDescription() string { + return p.Description +} + +// ProposalRoute returns router key of this proposal. +func (p *UpdateBandOracleRequestProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type of this proposal. +func (p *UpdateBandOracleRequestProposal) ProposalType() string { + return ProposalUpdateBandOracleRequest +} + +// ValidateBasic returns ValidateBasic result of this proposal. +func (p *UpdateBandOracleRequestProposal) ValidateBasic() error { + if p.UpdateOracleRequest == nil { + return ErrInvalidBandUpdateRequest + } + + if p.UpdateOracleRequest != nil && len(p.UpdateOracleRequest.Symbols) > 0 { + callData, err := utils.Encode(SymbolInput{ + Symbols: p.UpdateOracleRequest.Symbols, + MinimumSourceCount: uint8(p.UpdateOracleRequest.MinCount), + }) + + if err != nil { + return err + } + + if len(callData) > MaxDataSize { + return errorsmod.Wrapf(ErrTooLargeCalldata, "got: %d, maximum: %d", len(callData), MaxDataSize) + } + } + + if p.UpdateOracleRequest != nil && p.UpdateOracleRequest.AskCount > 0 && p.UpdateOracleRequest.MinCount > 0 && p.UpdateOracleRequest.AskCount < p.UpdateOracleRequest.MinCount { + return errorsmod.Wrapf(ErrInvalidAskCount, "UpdateBandOracleRequestProposal: Request validator count (%d) must not be less than sufficient validator count (%d).", p.UpdateOracleRequest.AskCount, p.UpdateOracleRequest.MinCount) + } + + if p.UpdateOracleRequest != nil && p.UpdateOracleRequest.FeeLimit != nil && !p.UpdateOracleRequest.FeeLimit.IsValid() { + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "UpdateBandOracleRequestProposal: Invalid Fee Limit (%s)", p.UpdateOracleRequest.GetFeeLimit().String()) + } + + if p.UpdateOracleRequest != nil && p.UpdateOracleRequest.PrepareGas <= 0 && p.UpdateOracleRequest.ExecuteGas > 0 { + return errorsmod.Wrapf(ErrInvalidOwasmGas, "UpdateBandOracleRequestProposal: Invalid Prepare Gas (%d)", p.UpdateOracleRequest.PrepareGas) + } + + if p.UpdateOracleRequest != nil && p.UpdateOracleRequest.ExecuteGas <= 0 { + return errorsmod.Wrapf(ErrInvalidOwasmGas, "UpdateBandOracleRequestProposal: Invalid Execute Gas (%d)", p.UpdateOracleRequest.ExecuteGas) + } + + return govtypes.ValidateAbstract(p) +} + +// GetTitle returns the title of this proposal. +func (p *DeleteBandOracleRequestProposal) GetTitle() string { + return p.Title +} + +// GetDescription returns the description of this proposal. +func (p *DeleteBandOracleRequestProposal) GetDescription() string { + return p.Description +} + +// ProposalRoute returns router key of this proposal. +func (p *DeleteBandOracleRequestProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type of this proposal. +func (p *DeleteBandOracleRequestProposal) ProposalType() string { + return ProposalDeleteBandOracleRequest +} + +// ValidateBasic returns ValidateBasic result of this proposal. +func (p *DeleteBandOracleRequestProposal) ValidateBasic() error { + if len(p.DeleteRequestIds) == 0 { + return ErrInvalidBandDeleteRequest + } + + return govtypes.ValidateAbstract(p) +} diff --git a/x/oracle/types/proposal.pb.go b/x/oracle/types/proposal.pb.go new file mode 100644 index 00000000..bc694138 --- /dev/null +++ b/x/oracle/types/proposal.pb.go @@ -0,0 +1,1925 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/oracle/proposal.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 UpdateBandParamsProposal 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"` + BandParams BandParams `protobuf:"bytes,3,opt,name=band_params,json=bandParams,proto3" json:"band_params"` +} + +func (m *UpdateBandParamsProposal) Reset() { *m = UpdateBandParamsProposal{} } +func (m *UpdateBandParamsProposal) String() string { return proto.CompactTextString(m) } +func (*UpdateBandParamsProposal) ProtoMessage() {} +func (*UpdateBandParamsProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_b7efcb1ff26f229a, []int{0} +} +func (m *UpdateBandParamsProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateBandParamsProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateBandParamsProposal.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 *UpdateBandParamsProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateBandParamsProposal.Merge(m, src) +} +func (m *UpdateBandParamsProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdateBandParamsProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateBandParamsProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateBandParamsProposal proto.InternalMessageInfo + +type UpdateBandOracleRequestProposal 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"` + UpdateOracleRequest *BandOracleRequest `protobuf:"bytes,4,opt,name=update_oracle_request,json=updateOracleRequest,proto3" json:"update_oracle_request,omitempty"` +} + +func (m *UpdateBandOracleRequestProposal) Reset() { *m = UpdateBandOracleRequestProposal{} } +func (m *UpdateBandOracleRequestProposal) String() string { return proto.CompactTextString(m) } +func (*UpdateBandOracleRequestProposal) ProtoMessage() {} +func (*UpdateBandOracleRequestProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_b7efcb1ff26f229a, []int{1} +} +func (m *UpdateBandOracleRequestProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateBandOracleRequestProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateBandOracleRequestProposal.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 *UpdateBandOracleRequestProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateBandOracleRequestProposal.Merge(m, src) +} +func (m *UpdateBandOracleRequestProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdateBandOracleRequestProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateBandOracleRequestProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateBandOracleRequestProposal proto.InternalMessageInfo + +type DeleteBandOracleRequestProposal 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"` + DeleteRequestIds []uint64 `protobuf:"varint,3,rep,packed,name=delete_request_ids,json=deleteRequestIds,proto3" json:"delete_request_ids,omitempty"` +} + +func (m *DeleteBandOracleRequestProposal) Reset() { *m = DeleteBandOracleRequestProposal{} } +func (m *DeleteBandOracleRequestProposal) String() string { return proto.CompactTextString(m) } +func (*DeleteBandOracleRequestProposal) ProtoMessage() {} +func (*DeleteBandOracleRequestProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_b7efcb1ff26f229a, []int{2} +} +func (m *DeleteBandOracleRequestProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteBandOracleRequestProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteBandOracleRequestProposal.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 *DeleteBandOracleRequestProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteBandOracleRequestProposal.Merge(m, src) +} +func (m *DeleteBandOracleRequestProposal) XXX_Size() int { + return m.Size() +} +func (m *DeleteBandOracleRequestProposal) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteBandOracleRequestProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteBandOracleRequestProposal proto.InternalMessageInfo + +type BandParams struct { + // block request interval to send Band IBC prices + IbcRequestInterval int64 `protobuf:"varint,1,opt,name=ibc_request_interval,json=ibcRequestInterval,proto3" json:"ibc_request_interval,omitempty"` + // band IBC source channel + IbcSourceChannel string `protobuf:"bytes,2,opt,name=ibc_source_channel,json=ibcSourceChannel,proto3" json:"ibc_source_channel,omitempty"` + // band IBC version + IbcVersion string `protobuf:"bytes,3,opt,name=ibc_version,json=ibcVersion,proto3" json:"ibc_version,omitempty"` + // band IBC portID + IbcPortId string `protobuf:"bytes,4,opt,name=ibc_port_id,json=ibcPortId,proto3" json:"ibc_port_id,omitempty"` + // legacy oracle scheme ids + LegacyOracleIds []int64 `protobuf:"varint,5,rep,packed,name=legacy_oracle_ids,json=legacyOracleIds,proto3" json:"legacy_oracle_ids,omitempty"` +} + +func (m *BandParams) Reset() { *m = BandParams{} } +func (m *BandParams) String() string { return proto.CompactTextString(m) } +func (*BandParams) ProtoMessage() {} +func (*BandParams) Descriptor() ([]byte, []int) { + return fileDescriptor_b7efcb1ff26f229a, []int{3} +} +func (m *BandParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BandParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BandParams.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 *BandParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_BandParams.Merge(m, src) +} +func (m *BandParams) XXX_Size() int { + return m.Size() +} +func (m *BandParams) XXX_DiscardUnknown() { + xxx_messageInfo_BandParams.DiscardUnknown(m) +} + +var xxx_messageInfo_BandParams proto.InternalMessageInfo + +func (m *BandParams) GetIbcRequestInterval() int64 { + if m != nil { + return m.IbcRequestInterval + } + return 0 +} + +func (m *BandParams) GetIbcSourceChannel() string { + if m != nil { + return m.IbcSourceChannel + } + return "" +} + +func (m *BandParams) GetIbcVersion() string { + if m != nil { + return m.IbcVersion + } + return "" +} + +func (m *BandParams) GetIbcPortId() string { + if m != nil { + return m.IbcPortId + } + return "" +} + +func (m *BandParams) GetLegacyOracleIds() []int64 { + if m != nil { + return m.LegacyOracleIds + } + return nil +} + +type BandOracleRequest struct { + // Unique Identifier for band ibc oracle request + RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptId int64 `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3" json:"oracle_script_id,omitempty"` + // Symbols is the list of symbols to prepare in the calldata + Symbols []string `protobuf:"bytes,3,rep,name=symbols,proto3" json:"symbols,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // FeeLimit is the maximum tokens that will be paid to all data source + // providers. + FeeLimit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=fee_limit,json=feeLimit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee_limit"` + // PrepareGas is amount of gas to pay to prepare raw requests + PrepareGas uint64 `protobuf:"varint,7,opt,name=prepare_gas,json=prepareGas,proto3" json:"prepare_gas,omitempty"` + // ExecuteGas is amount of gas to reserve for executing + ExecuteGas uint64 `protobuf:"varint,8,opt,name=execute_gas,json=executeGas,proto3" json:"execute_gas,omitempty"` + // MinSourceCount is the minimum number of data sources that must be used by + // each validator + MinSourceCount uint64 `protobuf:"varint,9,opt,name=min_source_count,json=minSourceCount,proto3" json:"min_source_count,omitempty"` +} + +func (m *BandOracleRequest) Reset() { *m = BandOracleRequest{} } +func (m *BandOracleRequest) String() string { return proto.CompactTextString(m) } +func (*BandOracleRequest) ProtoMessage() {} +func (*BandOracleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b7efcb1ff26f229a, []int{4} +} +func (m *BandOracleRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BandOracleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BandOracleRequest.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 *BandOracleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BandOracleRequest.Merge(m, src) +} +func (m *BandOracleRequest) XXX_Size() int { + return m.Size() +} +func (m *BandOracleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BandOracleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BandOracleRequest proto.InternalMessageInfo + +func (m *BandOracleRequest) GetRequestId() uint64 { + if m != nil { + return m.RequestId + } + return 0 +} + +func (m *BandOracleRequest) GetOracleScriptId() int64 { + if m != nil { + return m.OracleScriptId + } + return 0 +} + +func (m *BandOracleRequest) GetSymbols() []string { + if m != nil { + return m.Symbols + } + return nil +} + +func (m *BandOracleRequest) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *BandOracleRequest) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *BandOracleRequest) GetFeeLimit() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeeLimit + } + return nil +} + +func (m *BandOracleRequest) GetPrepareGas() uint64 { + if m != nil { + return m.PrepareGas + } + return 0 +} + +func (m *BandOracleRequest) GetExecuteGas() uint64 { + if m != nil { + return m.ExecuteGas + } + return 0 +} + +func (m *BandOracleRequest) GetMinSourceCount() uint64 { + if m != nil { + return m.MinSourceCount + } + return 0 +} + +func init() { + proto.RegisterType((*UpdateBandParamsProposal)(nil), "reserve.oracle.UpdateBandParamsProposal") + proto.RegisterType((*UpdateBandOracleRequestProposal)(nil), "reserve.oracle.UpdateBandOracleRequestProposal") + proto.RegisterType((*DeleteBandOracleRequestProposal)(nil), "reserve.oracle.DeleteBandOracleRequestProposal") + proto.RegisterType((*BandParams)(nil), "reserve.oracle.BandParams") + proto.RegisterType((*BandOracleRequest)(nil), "reserve.oracle.BandOracleRequest") +} + +func init() { proto.RegisterFile("reserve/oracle/proposal.proto", fileDescriptor_b7efcb1ff26f229a) } + +var fileDescriptor_b7efcb1ff26f229a = []byte{ + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4d, 0x4f, 0xe3, 0x46, + 0x18, 0xc7, 0x63, 0x1c, 0x5e, 0x3c, 0x91, 0x68, 0x70, 0xa9, 0x64, 0x52, 0x61, 0xa7, 0x39, 0x54, + 0x16, 0x2a, 0x36, 0xd0, 0x1b, 0xb7, 0x86, 0x4a, 0x55, 0xaa, 0x4a, 0xa5, 0x46, 0xf4, 0xd0, 0x8b, + 0x35, 0x1e, 0x0f, 0x61, 0x84, 0x3d, 0xe3, 0xce, 0x38, 0x11, 0x39, 0x57, 0xaa, 0xaa, 0x9e, 0xfa, + 0x11, 0x38, 0xf7, 0xd4, 0x43, 0x3f, 0x04, 0xda, 0x13, 0xc7, 0xdd, 0x3d, 0xec, 0x0b, 0x1c, 0x76, + 0x3f, 0xc6, 0x6a, 0x5e, 0xbc, 0x01, 0xc1, 0x4a, 0x2b, 0xad, 0xb8, 0x24, 0x9e, 0xe7, 0xff, 0x9f, + 0xc7, 0xcf, 0xef, 0x79, 0xc6, 0x03, 0x36, 0x39, 0x16, 0x98, 0x4f, 0x71, 0xcc, 0x38, 0x44, 0x05, + 0x8e, 0x2b, 0xce, 0x2a, 0x26, 0x60, 0x11, 0x55, 0x9c, 0xd5, 0xcc, 0x5d, 0x35, 0x72, 0xa4, 0xe5, + 0xde, 0x1a, 0x2c, 0x09, 0x65, 0xb1, 0xfa, 0xd5, 0x96, 0xde, 0xfa, 0x98, 0x8d, 0x99, 0x7a, 0x8c, + 0xe5, 0x93, 0x89, 0x6e, 0x20, 0x26, 0x4a, 0x26, 0x52, 0x2d, 0xe8, 0x85, 0x91, 0x7c, 0xbd, 0x8a, + 0x33, 0x28, 0x70, 0x3c, 0xdd, 0xcd, 0x70, 0x0d, 0x77, 0x63, 0xc4, 0x08, 0xd5, 0xfa, 0xe0, 0xb5, + 0x05, 0xbc, 0xe3, 0x2a, 0x87, 0x35, 0x1e, 0x42, 0x9a, 0x1f, 0x42, 0x0e, 0x4b, 0x71, 0x68, 0xca, + 0x72, 0xd7, 0xc1, 0x62, 0x4d, 0xea, 0x02, 0x7b, 0x56, 0xdf, 0x0a, 0x9d, 0x44, 0x2f, 0xdc, 0x3e, + 0xe8, 0xe4, 0x58, 0x20, 0x4e, 0xaa, 0x9a, 0x30, 0xea, 0x2d, 0x28, 0xed, 0x76, 0xc8, 0xfd, 0x0e, + 0x74, 0x32, 0x48, 0xf3, 0xb4, 0x52, 0xe9, 0x3c, 0xbb, 0x6f, 0x85, 0x9d, 0xbd, 0x5e, 0x74, 0x17, + 0x2f, 0x9a, 0xbf, 0x70, 0xd8, 0xbe, 0x7c, 0x11, 0xb4, 0x12, 0x90, 0xbd, 0x8f, 0xec, 0xff, 0xf8, + 0xd7, 0x45, 0xd0, 0x7a, 0x7b, 0x11, 0xb4, 0x9e, 0xfc, 0xbf, 0xdd, 0x33, 0x44, 0x63, 0x36, 0x8d, + 0x0c, 0x42, 0x74, 0xc0, 0x68, 0x8d, 0x69, 0xfd, 0xf7, 0x9b, 0xff, 0xb6, 0x02, 0xd3, 0xcd, 0x0f, + 0x61, 0x0c, 0xfe, 0x58, 0x00, 0xc1, 0x5c, 0xfc, 0x59, 0xb9, 0x13, 0xfc, 0xfb, 0x04, 0x8b, 0xfa, + 0x93, 0x51, 0x8f, 0xc1, 0x17, 0x13, 0x95, 0x3a, 0xd5, 0x55, 0xa4, 0x5c, 0x27, 0xf6, 0xda, 0x0a, + 0xfa, 0xab, 0x87, 0xa0, 0xef, 0x54, 0x90, 0x7c, 0xae, 0xf7, 0xdf, 0x09, 0xee, 0xff, 0xf2, 0xf1, + 0xf8, 0x5f, 0xdf, 0xc3, 0x7f, 0x90, 0x70, 0xf0, 0xdc, 0x02, 0xc1, 0xf7, 0xb8, 0xc0, 0x8f, 0xd1, + 0x85, 0x6f, 0x80, 0x9b, 0xab, 0xd4, 0x0d, 0x7e, 0x4a, 0x72, 0x39, 0x77, 0x3b, 0x6c, 0x27, 0x5d, + 0xad, 0x98, 0x57, 0x8d, 0x72, 0xf1, 0x18, 0x70, 0xcf, 0x2c, 0x00, 0xe6, 0x93, 0x77, 0x77, 0xc0, + 0x3a, 0xc9, 0xd0, 0xbc, 0x18, 0x5a, 0x63, 0x3e, 0x85, 0x85, 0xc2, 0xb2, 0x13, 0x97, 0x64, 0xa8, + 0x29, 0xc7, 0x28, 0x92, 0x40, 0xee, 0x10, 0x6c, 0xc2, 0x11, 0x4e, 0xd1, 0x29, 0xa4, 0x14, 0x17, + 0x06, 0xb5, 0x4b, 0x32, 0x74, 0xa4, 0x84, 0x03, 0x1d, 0x77, 0x03, 0xd0, 0x91, 0xee, 0x29, 0xe6, + 0x42, 0x76, 0xc4, 0x56, 0x36, 0x40, 0x32, 0xf4, 0xab, 0x8e, 0xb8, 0xbe, 0x36, 0x54, 0x8c, 0xcb, + 0x56, 0xa8, 0xc3, 0xe0, 0x24, 0x0e, 0xc9, 0xd0, 0x21, 0xe3, 0xf5, 0x28, 0x77, 0xb7, 0xc0, 0x5a, + 0x81, 0xc7, 0x10, 0xcd, 0x9a, 0x63, 0x23, 0xfb, 0xb5, 0xd8, 0xb7, 0x43, 0x3b, 0xf9, 0x4c, 0x0b, + 0x9a, 0x73, 0x94, 0x8b, 0xc1, 0x9f, 0x36, 0x58, 0xbb, 0x47, 0xee, 0x6e, 0x02, 0x30, 0xef, 0xb5, + 0x02, 0x6b, 0x27, 0x0e, 0x6f, 0x9a, 0xec, 0x86, 0xa0, 0x6b, 0x32, 0xeb, 0x29, 0x49, 0xd3, 0x82, + 0xa2, 0x5f, 0xd5, 0xf1, 0x23, 0x15, 0x1e, 0xe5, 0xae, 0x07, 0x96, 0xc5, 0xac, 0xcc, 0x58, 0xa1, + 0x07, 0xe6, 0x24, 0xcd, 0xd2, 0xfd, 0x12, 0x38, 0x50, 0x9c, 0xa5, 0x88, 0x4d, 0xa8, 0x3e, 0xcf, + 0xed, 0x64, 0x05, 0x8a, 0xb3, 0x03, 0xb9, 0x96, 0x62, 0x49, 0xa8, 0x11, 0x17, 0xb5, 0x58, 0x12, + 0xaa, 0xc5, 0x53, 0xe0, 0x9c, 0x60, 0x9c, 0x16, 0xa4, 0x24, 0xb5, 0xb7, 0xd4, 0xb7, 0xc3, 0xce, + 0xde, 0x46, 0x64, 0x26, 0x2d, 0x6f, 0xa2, 0x5b, 0xa3, 0x26, 0x74, 0xb8, 0x23, 0xbf, 0xfe, 0x7f, + 0x5f, 0x06, 0xe1, 0x98, 0xd4, 0xa7, 0x93, 0x2c, 0x42, 0xac, 0x34, 0x97, 0x98, 0xf9, 0xdb, 0x16, + 0xf9, 0x59, 0x5c, 0xcf, 0x2a, 0x2c, 0xd4, 0x06, 0x91, 0xac, 0x9c, 0x60, 0xfc, 0x93, 0x4c, 0x2e, + 0x27, 0x51, 0x71, 0x5c, 0x41, 0x8e, 0xd3, 0x31, 0x14, 0xde, 0xb2, 0x2a, 0x04, 0x98, 0xd0, 0x0f, + 0x50, 0x48, 0x03, 0x3e, 0xc7, 0x68, 0x52, 0x6b, 0xc3, 0x8a, 0x36, 0x98, 0x90, 0x34, 0x84, 0xa0, + 0x2b, 0x41, 0x9a, 0xc9, 0x2b, 0x1e, 0x47, 0xb9, 0x56, 0x4b, 0x42, 0xcd, 0xdc, 0x65, 0x74, 0x38, + 0xba, 0xbc, 0xf6, 0xad, 0xab, 0x6b, 0xdf, 0x7a, 0x75, 0xed, 0x5b, 0xff, 0xdc, 0xf8, 0xad, 0xab, + 0x1b, 0xbf, 0xf5, 0xf4, 0xc6, 0x6f, 0xfd, 0x16, 0xdf, 0xaa, 0x9c, 0x51, 0x56, 0xce, 0xd4, 0xe5, + 0x8a, 0x58, 0x11, 0x37, 0x37, 0xfe, 0x79, 0x73, 0xe7, 0x2b, 0x8c, 0x6c, 0x49, 0x19, 0xbe, 0x7d, + 0x17, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x35, 0x5a, 0x66, 0x12, 0x06, 0x00, 0x00, +} + +func (m *UpdateBandParamsProposal) 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 *UpdateBandParamsProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateBandParamsProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BandParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + 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 *UpdateBandOracleRequestProposal) 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 *UpdateBandOracleRequestProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateBandOracleRequestProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.UpdateOracleRequest != nil { + { + size, err := m.UpdateOracleRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + 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 *DeleteBandOracleRequestProposal) 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 *DeleteBandOracleRequestProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteBandOracleRequestProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DeleteRequestIds) > 0 { + dAtA4 := make([]byte, len(m.DeleteRequestIds)*10) + var j3 int + for _, num := range m.DeleteRequestIds { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintProposal(dAtA, i, uint64(j3)) + 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 *BandParams) 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 *BandParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BandParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LegacyOracleIds) > 0 { + dAtA6 := make([]byte, len(m.LegacyOracleIds)*10) + var j5 int + for _, num1 := range m.LegacyOracleIds { + num := uint64(num1) + for num >= 1<<7 { + dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j5++ + } + dAtA6[j5] = uint8(num) + j5++ + } + i -= j5 + copy(dAtA[i:], dAtA6[:j5]) + i = encodeVarintProposal(dAtA, i, uint64(j5)) + i-- + dAtA[i] = 0x2a + } + if len(m.IbcPortId) > 0 { + i -= len(m.IbcPortId) + copy(dAtA[i:], m.IbcPortId) + i = encodeVarintProposal(dAtA, i, uint64(len(m.IbcPortId))) + i-- + dAtA[i] = 0x22 + } + if len(m.IbcVersion) > 0 { + i -= len(m.IbcVersion) + copy(dAtA[i:], m.IbcVersion) + i = encodeVarintProposal(dAtA, i, uint64(len(m.IbcVersion))) + i-- + dAtA[i] = 0x1a + } + if len(m.IbcSourceChannel) > 0 { + i -= len(m.IbcSourceChannel) + copy(dAtA[i:], m.IbcSourceChannel) + i = encodeVarintProposal(dAtA, i, uint64(len(m.IbcSourceChannel))) + i-- + dAtA[i] = 0x12 + } + if m.IbcRequestInterval != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.IbcRequestInterval)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BandOracleRequest) 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 *BandOracleRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BandOracleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinSourceCount != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.MinSourceCount)) + i-- + dAtA[i] = 0x48 + } + if m.ExecuteGas != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.ExecuteGas)) + i-- + dAtA[i] = 0x40 + } + if m.PrepareGas != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.PrepareGas)) + i-- + dAtA[i] = 0x38 + } + if len(m.FeeLimit) > 0 { + for iNdEx := len(m.FeeLimit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeeLimit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.MinCount != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Symbols) > 0 { + for iNdEx := len(m.Symbols) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Symbols[iNdEx]) + copy(dAtA[i:], m.Symbols[iNdEx]) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Symbols[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.OracleScriptId != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.OracleScriptId)) + i-- + dAtA[i] = 0x10 + } + if m.RequestId != 0 { + i = encodeVarintProposal(dAtA, i, uint64(m.RequestId)) + i-- + dAtA[i] = 0x8 + } + 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 *UpdateBandParamsProposal) 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 = m.BandParams.Size() + n += 1 + l + sovProposal(uint64(l)) + return n +} + +func (m *UpdateBandOracleRequestProposal) 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)) + } + if m.UpdateOracleRequest != nil { + l = m.UpdateOracleRequest.Size() + n += 1 + l + sovProposal(uint64(l)) + } + return n +} + +func (m *DeleteBandOracleRequestProposal) 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)) + } + if len(m.DeleteRequestIds) > 0 { + l = 0 + for _, e := range m.DeleteRequestIds { + l += sovProposal(uint64(e)) + } + n += 1 + sovProposal(uint64(l)) + l + } + return n +} + +func (m *BandParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IbcRequestInterval != 0 { + n += 1 + sovProposal(uint64(m.IbcRequestInterval)) + } + l = len(m.IbcSourceChannel) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.IbcVersion) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.IbcPortId) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + if len(m.LegacyOracleIds) > 0 { + l = 0 + for _, e := range m.LegacyOracleIds { + l += sovProposal(uint64(e)) + } + n += 1 + sovProposal(uint64(l)) + l + } + return n +} + +func (m *BandOracleRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestId != 0 { + n += 1 + sovProposal(uint64(m.RequestId)) + } + if m.OracleScriptId != 0 { + n += 1 + sovProposal(uint64(m.OracleScriptId)) + } + if len(m.Symbols) > 0 { + for _, s := range m.Symbols { + l = len(s) + n += 1 + l + sovProposal(uint64(l)) + } + } + if m.AskCount != 0 { + n += 1 + sovProposal(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovProposal(uint64(m.MinCount)) + } + if len(m.FeeLimit) > 0 { + for _, e := range m.FeeLimit { + l = e.Size() + n += 1 + l + sovProposal(uint64(l)) + } + } + if m.PrepareGas != 0 { + n += 1 + sovProposal(uint64(m.PrepareGas)) + } + if m.ExecuteGas != 0 { + n += 1 + sovProposal(uint64(m.ExecuteGas)) + } + if m.MinSourceCount != 0 { + n += 1 + sovProposal(uint64(m.MinSourceCount)) + } + 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 *UpdateBandParamsProposal) 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: UpdateBandParamsProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateBandParamsProposal: 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 BandParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BandParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *UpdateBandOracleRequestProposal) 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: UpdateBandOracleRequestProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateBandOracleRequestProposal: 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 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateOracleRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpdateOracleRequest == nil { + m.UpdateOracleRequest = &BandOracleRequest{} + } + if err := m.UpdateOracleRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *DeleteBandOracleRequestProposal) 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: DeleteBandOracleRequestProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteBandOracleRequestProposal: 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 == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DeleteRequestIds = append(m.DeleteRequestIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.DeleteRequestIds) == 0 { + m.DeleteRequestIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DeleteRequestIds = append(m.DeleteRequestIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DeleteRequestIds", wireType) + } + 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 *BandParams) 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: BandParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BandParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IbcRequestInterval", wireType) + } + m.IbcRequestInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IbcRequestInterval |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IbcSourceChannel", 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.IbcSourceChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IbcVersion", 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.IbcVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IbcPortId", 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.IbcPortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LegacyOracleIds = append(m.LegacyOracleIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.LegacyOracleIds) == 0 { + m.LegacyOracleIds = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LegacyOracleIds = append(m.LegacyOracleIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field LegacyOracleIds", wireType) + } + 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 *BandOracleRequest) 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: BandOracleRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BandOracleRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + m.RequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptId", wireType) + } + m.OracleScriptId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbols", 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.Symbols = append(m.Symbols, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeLimit = append(m.FeeLimit, types.Coin{}) + if err := m.FeeLimit[len(m.FeeLimit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrepareGas", wireType) + } + m.PrepareGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrepareGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecuteGas", wireType) + } + m.ExecuteGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecuteGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSourceCount", wireType) + } + m.MinSourceCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinSourceCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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") +) diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index fc139447..66944a81 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -114,35 +113,126 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryBandPriceStatesRequest is the request type for the +// Query/BandPriceStates RPC method. +type QueryBandPriceStatesRequest struct { +} + +func (m *QueryBandPriceStatesRequest) Reset() { *m = QueryBandPriceStatesRequest{} } +func (m *QueryBandPriceStatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBandPriceStatesRequest) ProtoMessage() {} +func (*QueryBandPriceStatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5be66edb02a359da, []int{2} +} +func (m *QueryBandPriceStatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBandPriceStatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBandPriceStatesRequest.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 *QueryBandPriceStatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBandPriceStatesRequest.Merge(m, src) +} +func (m *QueryBandPriceStatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBandPriceStatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBandPriceStatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBandPriceStatesRequest proto.InternalMessageInfo + +// QueryBandPriceStatesResponse is the response type for the +// Query/BandPriceStates RPC method. +type QueryBandPriceStatesResponse struct { + PriceStates []*BandPriceState `protobuf:"bytes,1,rep,name=price_states,json=priceStates,proto3" json:"price_states,omitempty"` +} + +func (m *QueryBandPriceStatesResponse) Reset() { *m = QueryBandPriceStatesResponse{} } +func (m *QueryBandPriceStatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBandPriceStatesResponse) ProtoMessage() {} +func (*QueryBandPriceStatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5be66edb02a359da, []int{3} +} +func (m *QueryBandPriceStatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBandPriceStatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBandPriceStatesResponse.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 *QueryBandPriceStatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBandPriceStatesResponse.Merge(m, src) +} +func (m *QueryBandPriceStatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBandPriceStatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBandPriceStatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBandPriceStatesResponse proto.InternalMessageInfo + +func (m *QueryBandPriceStatesResponse) GetPriceStates() []*BandPriceState { + if m != nil { + return m.PriceStates + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "reserve.oracle.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "reserve.oracle.QueryParamsResponse") + proto.RegisterType((*QueryBandPriceStatesRequest)(nil), "reserve.oracle.QueryBandPriceStatesRequest") + proto.RegisterType((*QueryBandPriceStatesResponse)(nil), "reserve.oracle.QueryBandPriceStatesResponse") } func init() { proto.RegisterFile("reserve/oracle/query.proto", fileDescriptor_5be66edb02a359da) } var fileDescriptor_5be66edb02a359da = []byte{ - // 315 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0xc3, 0x40, - 0x14, 0xc7, 0x13, 0xc1, 0x82, 0x11, 0x04, 0x63, 0x29, 0x25, 0xca, 0x29, 0x71, 0x91, 0x0e, 0x79, - 0xb4, 0x4e, 0xae, 0xdd, 0xdc, 0x6a, 0x47, 0xb7, 0x4b, 0x38, 0xce, 0x40, 0x73, 0xef, 0x7a, 0x77, - 0x2d, 0xd6, 0xd1, 0x4f, 0x20, 0xf8, 0x25, 0x1c, 0xfd, 0x18, 0x1d, 0x0b, 0x2e, 0x4e, 0x22, 0x8d, - 0xe0, 0xd7, 0x90, 0xde, 0x9d, 0x42, 0xab, 0xb8, 0x84, 0xc7, 0xfb, 0xff, 0xfe, 0xff, 0xfc, 0xdf, - 0x45, 0x89, 0x62, 0x9a, 0xa9, 0x29, 0x03, 0x54, 0xb4, 0x18, 0x31, 0x18, 0x4f, 0x98, 0x9a, 0x65, - 0x52, 0xa1, 0xc1, 0x78, 0xcf, 0x6b, 0x99, 0xd3, 0x92, 0x7d, 0x5a, 0x95, 0x02, 0xc1, 0x7e, 0x1d, - 0x92, 0x34, 0x39, 0x72, 0xb4, 0x23, 0xac, 0x26, 0xbf, 0x3d, 0xe2, 0x88, 0x7c, 0xc4, 0x80, 0xca, - 0x12, 0xa8, 0x10, 0x68, 0xa8, 0x29, 0x51, 0x68, 0xaf, 0x76, 0x0a, 0xd4, 0x15, 0x6a, 0xc8, 0xa9, - 0xf6, 0xff, 0x83, 0x69, 0x37, 0x67, 0x86, 0x76, 0x41, 0x52, 0x5e, 0x0a, 0x0b, 0x7b, 0xf6, 0x70, - 0xa3, 0x9e, 0xa4, 0x8a, 0x56, 0x3e, 0x28, 0x6d, 0x46, 0xf1, 0xd5, 0xca, 0x3e, 0xb0, 0xcb, 0x21, - 0x1b, 0x4f, 0x98, 0x36, 0xe9, 0x20, 0x3a, 0x58, 0xdb, 0x6a, 0x89, 0x42, 0xb3, 0xf8, 0x22, 0x6a, - 0x38, 0x73, 0x3b, 0x3c, 0x09, 0xcf, 0x76, 0x7b, 0xad, 0x6c, 0xfd, 0xba, 0xcc, 0xf1, 0xfd, 0x9d, - 0xf9, 0xdb, 0x71, 0xf0, 0xf4, 0xf9, 0xdc, 0x09, 0x87, 0xde, 0xd0, 0xbb, 0x8b, 0xb6, 0x6d, 0x62, - 0x3c, 0x8e, 0x1a, 0x8e, 0x8a, 0xd3, 0x4d, 0xf7, 0xef, 0x22, 0xc9, 0xe9, 0xbf, 0x8c, 0xab, 0x95, - 0x92, 0xfb, 0x97, 0x8f, 0xc7, 0xad, 0x76, 0xdc, 0x82, 0x3f, 0x2f, 0xed, 0x5f, 0xce, 0x97, 0x24, - 0x5c, 0x2c, 0x49, 0xf8, 0xbe, 0x24, 0xe1, 0x43, 0x4d, 0x82, 0x45, 0x4d, 0x82, 0xd7, 0x9a, 0x04, - 0xd7, 0xc0, 0x4b, 0x73, 0x33, 0xc9, 0xb3, 0x02, 0x2b, 0x40, 0x81, 0xd5, 0xcc, 0x3e, 0x4a, 0x81, - 0xa3, 0x9f, 0xa4, 0xdb, 0xef, 0x2c, 0x33, 0x93, 0x4c, 0xe7, 0x0d, 0x0b, 0x9c, 0x7f, 0x05, 0x00, - 0x00, 0xff, 0xff, 0xa8, 0x9f, 0x5c, 0x1f, 0xf3, 0x01, 0x00, 0x00, + // 388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x4b, 0xc3, 0x30, + 0x1c, 0x6d, 0x26, 0x0e, 0xcc, 0x44, 0x31, 0x8e, 0x31, 0xba, 0x19, 0x67, 0x77, 0x99, 0x7f, 0x68, + 0x60, 0x9e, 0x3c, 0xba, 0x9b, 0xb7, 0x39, 0x6f, 0x5e, 0x46, 0xd6, 0x85, 0x5a, 0x58, 0x93, 0xae, + 0xc9, 0xc4, 0x5d, 0xfd, 0x04, 0x82, 0x82, 0x5f, 0xc1, 0xa3, 0x1f, 0x63, 0xc7, 0x81, 0x17, 0x4f, + 0x22, 0x9b, 0xe0, 0xd7, 0x90, 0xa5, 0xdd, 0x74, 0xb5, 0x88, 0x97, 0x12, 0xde, 0x7b, 0xbf, 0xf7, + 0x5e, 0x7e, 0x0d, 0x34, 0x43, 0x26, 0x59, 0x78, 0xcd, 0x88, 0x08, 0xa9, 0xd3, 0x63, 0xa4, 0x3f, + 0x60, 0xe1, 0xd0, 0x0e, 0x42, 0xa1, 0x04, 0xda, 0x88, 0x39, 0x3b, 0xe2, 0xcc, 0x2d, 0xea, 0x7b, + 0x5c, 0x10, 0xfd, 0x8d, 0x24, 0x66, 0xde, 0x15, 0xae, 0xd0, 0x47, 0x32, 0x3b, 0xc5, 0x68, 0xd9, + 0x15, 0xc2, 0xed, 0x31, 0x42, 0x03, 0x8f, 0x50, 0xce, 0x85, 0xa2, 0xca, 0x13, 0x5c, 0xc6, 0x6c, + 0x29, 0x11, 0x19, 0xd0, 0x90, 0xfa, 0x73, 0xb2, 0x9c, 0x20, 0x5d, 0xc6, 0x99, 0xf4, 0x62, 0xd6, + 0xca, 0x43, 0x74, 0x3e, 0x2b, 0xd8, 0xd4, 0x23, 0x2d, 0xd6, 0x1f, 0x30, 0xa9, 0xac, 0x26, 0xdc, + 0x5e, 0x42, 0x65, 0x20, 0xb8, 0x64, 0xe8, 0x04, 0x66, 0x23, 0xeb, 0x22, 0xa8, 0x80, 0x5a, 0xae, + 0x5e, 0xb0, 0x97, 0xef, 0x63, 0x47, 0xfa, 0xc6, 0xda, 0xe8, 0x6d, 0xd7, 0x78, 0xfa, 0x7c, 0x3e, + 0x00, 0xad, 0x78, 0xc0, 0xda, 0x81, 0x25, 0xed, 0xd8, 0xa0, 0xbc, 0xdb, 0x0c, 0x3d, 0x87, 0x5d, + 0x28, 0xaa, 0xd8, 0x22, 0x90, 0xc2, 0x72, 0x3a, 0x1d, 0x27, 0x9f, 0xc2, 0xf5, 0x60, 0x06, 0xb7, + 0xa5, 0xc6, 0x8b, 0xa0, 0xb2, 0x52, 0xcb, 0xd5, 0x71, 0x32, 0x7f, 0x79, 0xbc, 0x95, 0x0b, 0xbe, + 0xad, 0xea, 0x0f, 0x19, 0xb8, 0xaa, 0x33, 0x50, 0x1f, 0x66, 0xa3, 0xa2, 0xc8, 0x4a, 0x1a, 0xfc, + 0xde, 0x85, 0x59, 0xfd, 0x53, 0x13, 0xf5, 0xb3, 0xf0, 0xed, 0xcb, 0xc7, 0x7d, 0xa6, 0x88, 0x0a, + 0x24, 0xf5, 0x57, 0xa0, 0x47, 0x00, 0x37, 0x13, 0x77, 0x43, 0x87, 0xa9, 0xc6, 0xe9, 0x0b, 0x32, + 0x8f, 0xfe, 0x27, 0x8e, 0xeb, 0xec, 0xeb, 0x3a, 0x55, 0xb4, 0x97, 0xac, 0xd3, 0xa1, 0xbc, 0xdb, + 0xfe, 0xb9, 0xc9, 0xc6, 0xd9, 0x68, 0x82, 0xc1, 0x78, 0x82, 0xc1, 0xfb, 0x04, 0x83, 0xbb, 0x29, + 0x36, 0xc6, 0x53, 0x6c, 0xbc, 0x4e, 0xb1, 0x71, 0x49, 0x5c, 0x4f, 0x5d, 0x0d, 0x3a, 0xb6, 0x23, + 0x7c, 0x22, 0xb8, 0xf0, 0x87, 0xfa, 0xc5, 0x38, 0xa2, 0xb7, 0x30, 0xbd, 0x99, 0xdb, 0xaa, 0x61, + 0xc0, 0x64, 0x27, 0xab, 0x05, 0xc7, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x59, 0xb3, 0x47, 0x63, + 0x02, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -159,6 +249,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Retrieves the state for all band price feeds + BandPriceStates(ctx context.Context, in *QueryBandPriceStatesRequest, opts ...grpc.CallOption) (*QueryBandPriceStatesResponse, error) } type queryClient struct { @@ -178,10 +270,21 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) BandPriceStates(ctx context.Context, in *QueryBandPriceStatesRequest, opts ...grpc.CallOption) (*QueryBandPriceStatesResponse, error) { + out := new(QueryBandPriceStatesResponse) + err := c.cc.Invoke(ctx, "/reserve.oracle.Query/BandPriceStates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Retrieves the state for all band price feeds + BandPriceStates(context.Context, *QueryBandPriceStatesRequest) (*QueryBandPriceStatesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -191,6 +294,9 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) BandPriceStates(ctx context.Context, req *QueryBandPriceStatesRequest) (*QueryBandPriceStatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BandPriceStates not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -214,6 +320,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_BandPriceStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBandPriceStatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BandPriceStates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.oracle.Query/BandPriceStates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BandPriceStates(ctx, req.(*QueryBandPriceStatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "reserve.oracle.Query", HandlerType: (*QueryServer)(nil), @@ -222,6 +346,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "BandPriceStates", + Handler: _Query_BandPriceStates_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "reserve/oracle/query.proto", @@ -283,6 +411,66 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryBandPriceStatesRequest) 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 *QueryBandPriceStatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBandPriceStatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryBandPriceStatesResponse) 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 *QueryBandPriceStatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBandPriceStatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PriceStates) > 0 { + for iNdEx := len(m.PriceStates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PriceStates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -314,6 +502,30 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryBandPriceStatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryBandPriceStatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PriceStates) > 0 { + for _, e := range m.PriceStates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -453,6 +665,140 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryBandPriceStatesRequest) 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 ErrIntOverflowQuery + } + 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: QueryBandPriceStatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBandPriceStatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBandPriceStatesResponse) 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 ErrIntOverflowQuery + } + 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: QueryBandPriceStatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBandPriceStatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceStates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriceStates = append(m.PriceStates, &BandPriceState{}) + if err := m.PriceStates[len(m.PriceStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index 94c4c60d..37ff374f 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -51,6 +51,24 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_BandPriceStates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBandPriceStatesRequest + var metadata runtime.ServerMetadata + + msg, err := client.BandPriceStates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BandPriceStates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBandPriceStatesRequest + var metadata runtime.ServerMetadata + + msg, err := server.BandPriceStates(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +98,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_BandPriceStates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BandPriceStates_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BandPriceStates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +182,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_BandPriceStates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BandPriceStates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BandPriceStates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "oracle", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BandPriceStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "oracle", "band_price_states"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_BandPriceStates_0 = runtime.ForwardResponseMessage ) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 7032854b..4a37be1c 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -127,15 +127,94 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgRequestBandRates defines a SDK message for requesting data from +// BandChain using IBC. +type MsgRequestBandRates struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + RequestId uint64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (m *MsgRequestBandRates) Reset() { *m = MsgRequestBandRates{} } +func (m *MsgRequestBandRates) String() string { return proto.CompactTextString(m) } +func (*MsgRequestBandRates) ProtoMessage() {} +func (*MsgRequestBandRates) Descriptor() ([]byte, []int) { + return fileDescriptor_2ca24ac8eaee815d, []int{2} +} +func (m *MsgRequestBandRates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRequestBandRates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRequestBandRates.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 *MsgRequestBandRates) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestBandRates.Merge(m, src) +} +func (m *MsgRequestBandRates) XXX_Size() int { + return m.Size() +} +func (m *MsgRequestBandRates) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestBandRates.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRequestBandRates proto.InternalMessageInfo + +// MsgRequestBandRatesResponse defines the Msg/RequestBandRates response type. +type MsgRequestBandRatesResponse struct { +} + +func (m *MsgRequestBandRatesResponse) Reset() { *m = MsgRequestBandRatesResponse{} } +func (m *MsgRequestBandRatesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRequestBandRatesResponse) ProtoMessage() {} +func (*MsgRequestBandRatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ca24ac8eaee815d, []int{3} +} +func (m *MsgRequestBandRatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRequestBandRatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRequestBandRatesResponse.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 *MsgRequestBandRatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestBandRatesResponse.Merge(m, src) +} +func (m *MsgRequestBandRatesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRequestBandRatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestBandRatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRequestBandRatesResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "reserve.oracle.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.oracle.MsgUpdateParamsResponse") + proto.RegisterType((*MsgRequestBandRates)(nil), "reserve.oracle.MsgRequestBandRates") + proto.RegisterType((*MsgRequestBandRatesResponse)(nil), "reserve.oracle.MsgRequestBandRatesResponse") } func init() { proto.RegisterFile("reserve/oracle/tx.proto", fileDescriptor_2ca24ac8eaee815d) } var fileDescriptor_2ca24ac8eaee815d = []byte{ - // 343 bytes of a gzipped FileDescriptorProto + // 452 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x4a, 0x2d, 0x4e, 0x2d, 0x2a, 0x4b, 0xd5, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0xa4, 0x04, 0x13, 0x73, 0x33, 0xf3, @@ -150,14 +229,21 @@ var fileDescriptor_2ca24ac8eaee815d = []byte{ 0x23, 0x31, 0x3d, 0x54, 0x6f, 0xea, 0x41, 0xcc, 0x77, 0xe2, 0x3c, 0x71, 0x4f, 0x9e, 0x61, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x0d, 0x56, 0xc6, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0x8c, 0xea, 0x7a, 0xbe, 0x41, 0x4b, 0x01, 0xe6, 0xec, 0x0a, 0x98, 0xc3, 0xd1, 0xdc, 0xa9, 0x24, 0xc9, 0x25, - 0x8e, 0x26, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, 0x94, 0xc6, 0xc5, 0xec, 0x5b, - 0x9c, 0x2e, 0x14, 0xc1, 0xc5, 0x83, 0xe2, 0x33, 0x79, 0x74, 0x17, 0xa1, 0xe9, 0x97, 0x52, 0x27, - 0xa0, 0x00, 0x66, 0x81, 0x14, 0x6b, 0x03, 0xc8, 0xfd, 0x4e, 0x9e, 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, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, - 0xab, 0x9f, 0x9f, 0x97, 0x9f, 0x5b, 0x09, 0x0e, 0xef, 0xe4, 0xfc, 0x1c, 0x7d, 0x0c, 0x7f, 0x95, - 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x15, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdb, - 0xe4, 0x20, 0x8c, 0x35, 0x02, 0x00, 0x00, + 0x8e, 0x26, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0xd4, 0xc0, 0xc8, 0x25, 0xec, + 0x5b, 0x9c, 0x1e, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0xe2, 0x94, 0x98, 0x97, 0x12, 0x94, 0x58, + 0x92, 0x5a, 0x2c, 0x24, 0xc6, 0xc5, 0x56, 0x9c, 0x9a, 0x97, 0x92, 0x5a, 0x04, 0xf1, 0x57, 0x10, + 0x94, 0x27, 0x24, 0xcb, 0xc5, 0x55, 0x04, 0x51, 0x1b, 0x9f, 0x99, 0x02, 0x76, 0x3e, 0x4b, 0x10, + 0x27, 0x54, 0xc4, 0x33, 0xc5, 0xca, 0xa8, 0x63, 0x81, 0x3c, 0xc3, 0x8b, 0x05, 0xf2, 0x0c, 0x20, + 0x67, 0x42, 0xf5, 0x80, 0xdc, 0x28, 0x85, 0x70, 0x19, 0xba, 0x55, 0x4a, 0xb2, 0x5c, 0xd2, 0x58, + 0x84, 0x61, 0x2e, 0x34, 0x3a, 0xc3, 0xc8, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x14, 0xc1, 0xc5, 0x83, + 0x12, 0xf8, 0xf2, 0xe8, 0x81, 0x86, 0xe6, 0x45, 0x29, 0x75, 0x02, 0x0a, 0x60, 0x36, 0x08, 0xa5, + 0x70, 0x09, 0x60, 0xf8, 0x5f, 0x19, 0x8b, 0x66, 0x74, 0x45, 0x52, 0xda, 0x44, 0x28, 0x82, 0xd9, + 0x22, 0xc5, 0xda, 0x00, 0x8a, 0x48, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, + 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, + 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, + 0xcb, 0xcf, 0xad, 0x04, 0x27, 0xbc, 0xe4, 0xfc, 0x1c, 0x7d, 0x8c, 0x08, 0x2e, 0xa9, 0x2c, 0x48, + 0x2d, 0x4e, 0x62, 0x03, 0x2b, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x10, 0x9a, 0x30, 0xaf, + 0x3e, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -175,6 +261,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + RequestBandRates(ctx context.Context, in *MsgRequestBandRates, opts ...grpc.CallOption) (*MsgRequestBandRatesResponse, error) } type msgClient struct { @@ -194,11 +281,21 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) RequestBandRates(ctx context.Context, in *MsgRequestBandRates, opts ...grpc.CallOption) (*MsgRequestBandRatesResponse, error) { + out := new(MsgRequestBandRatesResponse) + err := c.cc.Invoke(ctx, "/reserve.oracle.Msg/RequestBandRates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + RequestBandRates(context.Context, *MsgRequestBandRates) (*MsgRequestBandRatesResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -208,6 +305,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) RequestBandRates(ctx context.Context, req *MsgRequestBandRates) (*MsgRequestBandRatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestBandRates not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -231,6 +331,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_RequestBandRates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRequestBandRates) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RequestBandRates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.oracle.Msg/RequestBandRates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RequestBandRates(ctx, req.(*MsgRequestBandRates)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "reserve.oracle.Msg", HandlerType: (*MsgServer)(nil), @@ -239,6 +357,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "RequestBandRates", + Handler: _Msg_RequestBandRates_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "reserve/oracle/tx.proto", @@ -307,6 +429,64 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgRequestBandRates) 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 *MsgRequestBandRates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestBandRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RequestId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RequestId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRequestBandRatesResponse) 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 *MsgRequestBandRatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestBandRatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -342,6 +522,31 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgRequestBandRates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.RequestId != 0 { + n += 1 + sovTx(uint64(m.RequestId)) + } + return n +} + +func (m *MsgRequestBandRatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -513,6 +718,157 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRequestBandRates) 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: MsgRequestBandRates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestBandRates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + m.RequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 (m *MsgRequestBandRatesResponse) 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: MsgRequestBandRatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestBandRatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 diff --git a/x/oracle/utils/packet_utils.go b/x/oracle/utils/packet_utils.go new file mode 100644 index 00000000..6c43a771 --- /dev/null +++ b/x/oracle/utils/packet_utils.go @@ -0,0 +1,323 @@ +package utils + +import ( + "encoding/binary" + "fmt" + "reflect" + "errors" +) + +// ENCODE + +// Encode uses obi encoding scheme to encode the given input into bytes. +func encodeImpl(v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) + switch rv.Kind() { + case reflect.Uint8: + return EncodeUnsigned8(uint8(rv.Uint())), nil + case reflect.Uint16: + return EncodeUnsigned16(uint16(rv.Uint())), nil + case reflect.Uint32: + return EncodeUnsigned32(uint32(rv.Uint())), nil + case reflect.Uint64: + return EncodeUnsigned64(uint64(rv.Uint())), nil + case reflect.Int8: + return EncodeSigned8(int8(rv.Int())), nil + case reflect.Int16: + return EncodeSigned16(int16(rv.Int())), nil + case reflect.Int32: + return EncodeSigned32(int32(rv.Int())), nil + case reflect.Int64: + return EncodeSigned64(int64(rv.Int())), nil + case reflect.String: + return EncodeString(rv.String()), nil + case reflect.Slice: + if rv.Type().Elem().Kind() == reflect.Uint8 { + return EncodeBytes(rv.Bytes()), nil + } + + res := EncodeUnsigned32(uint32(rv.Len())) + for idx := 0; idx < rv.Len(); idx++ { + each, err := Encode(rv.Index(idx).Interface()) + if err != nil { + return nil, err + } + res = append(res, each...) + } + return res, nil + case reflect.Struct: + res := []byte{} + for idx := 0; idx < rv.NumField(); idx++ { + each, err := Encode(rv.Field(idx).Interface()) + if err != nil { + return nil, err + } + res = append(res, each...) + } + return res, nil + default: + return nil, fmt.Errorf("obi: unsupported value type: %s", rv.Kind()) + } +} + +// Encode uses obi encoding scheme to encode the given input(s) into bytes. +func Encode(v ...interface{}) ([]byte, error) { + res := []byte{} + for _, each := range v { + encoded, err := encodeImpl(each) + if err != nil { + return nil, err + } + res = append(res, encoded...) + } + return res, nil +} + +// MustEncode uses obi encoding scheme to encode the given input into bytes. Panics on error. +func MustEncode(v ...interface{}) []byte { + res, err := Encode(v...) + if err != nil { + panic(err) + } + return res +} + +// EncodeUnsigned8 takes an `uint8` variable and encodes it into a byte array +func EncodeUnsigned8(v uint8) []byte { + return []byte{v} +} + +// EncodeUnsigned16 takes an `uint16` variable and encodes it into a byte array +func EncodeUnsigned16(v uint16) []byte { + bytes := make([]byte, 2) + binary.BigEndian.PutUint16(bytes, v) + return bytes +} + +// EncodeUnsigned32 takes an `uint32` variable and encodes it into a byte array +func EncodeUnsigned32(v uint32) []byte { + bytes := make([]byte, 4) + binary.BigEndian.PutUint32(bytes, v) + return bytes +} + +// EncodeUnsigned64 takes an `uint64` variable and encodes it into a byte array +func EncodeUnsigned64(v uint64) []byte { + bytes := make([]byte, 8) + binary.BigEndian.PutUint64(bytes, v) + return bytes +} + +// EncodeSigned8 takes an `int8` variable and encodes it into a byte array +func EncodeSigned8(v int8) []byte { + return EncodeUnsigned8(uint8(v)) +} + +// EncodeSigned16 takes an `int16` variable and encodes it into a byte array +func EncodeSigned16(v int16) []byte { + return EncodeUnsigned16(uint16(v)) +} + +// EncodeSigned32 takes an `int32` variable and encodes it into a byte array +func EncodeSigned32(v int32) []byte { + return EncodeUnsigned32(uint32(v)) +} + +// EncodeSigned64 takes an `int64` variable and encodes it into a byte array +func EncodeSigned64(v int64) []byte { + return EncodeUnsigned64(uint64(v)) +} + +// EncodeBytes takes a `[]byte` variable and encodes it into a byte array +func EncodeBytes(v []byte) []byte { + return append(EncodeUnsigned32(uint32(len(v))), v...) +} + +// EncodeString takes a `string` variable and encodes it into a byte array +func EncodeString(v string) []byte { + return append(EncodeUnsigned32(uint32(len(v))), []byte(v)...) +} + +// DECODE + +func decodeImpl(data []byte, v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return nil, errors.New("obi: decode into non-ptr type") + } + ev := rv.Elem() + switch ev.Kind() { + case reflect.Uint8: + val, rem, err := DecodeUnsigned8(data) + ev.SetUint(uint64(val)) + return rem, err + case reflect.Uint16: + val, rem, err := DecodeUnsigned16(data) + ev.SetUint(uint64(val)) + return rem, err + case reflect.Uint32: + val, rem, err := DecodeUnsigned32(data) + ev.SetUint(uint64(val)) + return rem, err + case reflect.Uint64: + val, rem, err := DecodeUnsigned64(data) + ev.SetUint(uint64(val)) + return rem, err + case reflect.Int8: + val, rem, err := DecodeSigned8(data) + ev.SetInt(int64(val)) + return rem, err + case reflect.Int16: + val, rem, err := DecodeSigned16(data) + ev.SetInt(int64(val)) + return rem, err + case reflect.Int32: + val, rem, err := DecodeSigned32(data) + ev.SetInt(int64(val)) + return rem, err + case reflect.Int64: + val, rem, err := DecodeSigned64(data) + ev.SetInt(int64(val)) + return rem, err + case reflect.String: + val, rem, err := DecodeString(data) + ev.SetString(val) + return rem, err + case reflect.Slice: + if ev.Type().Elem().Kind() == reflect.Uint8 { + val, rem, err := DecodeBytes(data) + ev.SetBytes(val) + return rem, err + } + length, rem, err := DecodeUnsigned32(data) + if err != nil { + return nil, err + } + slice := reflect.MakeSlice(ev.Type(), int(length), int(length)) + for idx := 0; idx < int(length); idx++ { + var err error + rem, err = decodeImpl(rem, slice.Index(idx).Addr().Interface()) + if err != nil { + return nil, err + } + } + ev.Set(slice) + return rem, nil + case reflect.Struct: + rem := data + for idx := 0; idx < ev.NumField(); idx++ { + var err error + rem, err = decodeImpl(rem, ev.Field(idx).Addr().Interface()) + if err != nil { + return nil, err + } + } + return rem, nil + default: + return nil, fmt.Errorf("obi: unsupported value type: %s", ev.Kind()) + } +} + +// Decode uses obi encoding scheme to decode the given input(s). +func Decode(data []byte, v ...interface{}) error { + var err error + rem := data + for _, each := range v { + rem, err = decodeImpl(rem, each) + if err != nil { + return err + } + } + if len(rem) != 0 { + return errors.New("obi: not all data was consumed while decoding") + } + return nil +} + +// MustDecode uses obi encoding scheme to decode the given input. Panics on error. +func MustDecode(data []byte, v ...interface{}) { + err := Decode(data, v...) + if err != nil { + panic(err) + } +} + +// DecodeUnsigned16 decodes the input bytes into `uint8` and returns the remaining bytes. +func DecodeUnsigned8(data []byte) (uint8, []byte, error) { + if len(data) < 1 { + return 0, nil, errors.New("obi: out of range") + } + return data[0], data[1:], nil +} + +// DecodeUnsigned16 decodes the input bytes into `uint16` and returns the remaining bytes. +func DecodeUnsigned16(data []byte) (uint16, []byte, error) { + if len(data) < 2 { + return 0, nil, errors.New("obi: out of range") + } + return binary.BigEndian.Uint16(data[:2]), data[2:], nil +} + +// DecodeUnsigned32 decodes the input bytes into `uint32` and returns the remaining bytes. +func DecodeUnsigned32(data []byte) (uint32, []byte, error) { + if len(data) < 4 { + return 0, nil, errors.New("obi: out of range") + } + return binary.BigEndian.Uint32(data[:4]), data[4:], nil +} + +// DecodeUnsigned64 decodes the input bytes into `uint64` and returns the remaining bytes. +func DecodeUnsigned64(data []byte) (uint64, []byte, error) { + if len(data) < 8 { + return 0, nil, errors.New("obi: out of range") + } + return binary.BigEndian.Uint64(data[:8]), data[8:], nil +} + +// DecodeSigned8 decodes the input bytes into `uint64` and returns the remaining bytes. +func DecodeSigned8(data []byte) (int8, []byte, error) { + unsigned, rem, err := DecodeUnsigned8(data) + return int8(unsigned), rem, err +} + +// DecodeSigned16 decodes the input bytes into `uint64` and returns the remaining bytes. +func DecodeSigned16(data []byte) (int16, []byte, error) { + unsigned, rem, err := DecodeUnsigned16(data) + return int16(unsigned), rem, err +} + +// DecodeSigned32 decodes the input bytes into `uint64` and returns the remaining bytes. +func DecodeSigned32(data []byte) (int32, []byte, error) { + unsigned, rem, err := DecodeUnsigned32(data) + return int32(unsigned), rem, err +} + +// DecodeSigned64 decodes the input bytes into `uint64` and returns the remaining bytes. +func DecodeSigned64(data []byte) (int64, []byte, error) { + unsigned, rem, err := DecodeUnsigned64(data) + return int64(unsigned), rem, err +} + +// DecodeBytes decodes the input bytes and returns bytes result and the remaining bytes. +func DecodeBytes(data []byte) ([]byte, []byte, error) { + length, rem, err := DecodeUnsigned32(data) + if err != nil { + return nil, nil, err + } + if uint32(len(rem)) < length { + return nil, nil, errors.New("obi: out of range") + } + return rem[:length], rem[length:], nil +} + +// DecodeString decodes the input bytes and returns string result and the remaining bytes. +func DecodeString(data []byte) (string, []byte, error) { + length, rem, err := DecodeUnsigned32(data) + if err != nil { + return "", nil, err + } + if uint32(len(rem)) < length { + return "", nil, errors.New("obi: out of range") + } + return string(rem[:length]), rem[length:], nil +} diff --git a/x/psm/client/cli/query.go b/x/psm/client/cli/query.go new file mode 100644 index 00000000..4eb0796c --- /dev/null +++ b/x/psm/client/cli/query.go @@ -0,0 +1,76 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + // Group dao queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, // nolint:gomnd + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdCheckStablecoin()) + cmd.AddCommand(CmdGetAllStablecoin()) + return cmd +} + +func CmdCheckStablecoin() *cobra.Command { + cmd := &cobra.Command{ + Use: "stablecoin [denom]", + Short: "shows info price, fee in, fee out, swapable quantity of the stablecoin", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Stablecoin(context.Background(), &types.QueryStablecoinRequest{Denom: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdGetAllStablecoin() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-stablecoin", + Short: "shows info price, fee in, fee out, swapable quantity of all stablecoin", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.AllStablecoin(context.Background(), &types.QueryAllStablecoinRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/psm/client/cli/tx.go b/x/psm/client/cli/tx.go new file mode 100644 index 00000000..d1902b7b --- /dev/null +++ b/x/psm/client/cli/tx.go @@ -0,0 +1,94 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, // nolint:gomnd + RunE: client.ValidateCmd, + } + + cmd.AddCommand(NewSwapToStablecoinCmd()) + cmd.AddCommand(NewSwapTonomUSDCmd()) + + return cmd +} + +func NewSwapTonomUSDCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap-to-nomUSD [stablecoin]", + Args: cobra.ExactArgs(1), + Short: "swap stablecoin to $nomUSD ", + Long: `swap stablecoin to $nomUSD. + + Example: + $ onomyd tx psm swap-to-nomUSD 1000usdt --from mykey + `, + + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + stablecoin, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + + addr := clientCtx.GetFromAddress() + msg := types.NewMsgSwapTonomUSD(addr.String(), &stablecoin) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func NewSwapToStablecoinCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap-to-stablecoin [stable-coin-type] [amount-nomUSD]", + Args: cobra.ExactArgs(2), + Short: "swap $nomUSD to stablecoin ", + Long: `swap $nomUSD to stablecoin. + + Example: + $ onomyd tx psm swap-to-stablecoin usdt 10000nomUSD --from mykey + `, + + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + nomUSDcoin, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + addr := clientCtx.GetFromAddress() + msg := types.NewMsgSwapToStablecoin(addr.String(), args[0], nomUSDcoin.Amount) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/psm/keeper/abci.go b/x/psm/keeper/abci.go new file mode 100644 index 00000000..7c74d87e --- /dev/null +++ b/x/psm/keeper/abci.go @@ -0,0 +1,95 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (k Keeper) BeginBlocker(ctx context.Context) error { + return k.UpdatesStablecoinEpoch(ctx) +} + +func (k Keeper) UpdatesStablecoinEpoch(ctx context.Context) error { + updatePrice := func(red types.Stablecoin) bool { + price := k.OracleKeeper.GetPrice(ctx, red.Denom, types.DenomStable) + if price == nil { + return false + } + + sc := k.stablecoinUpdate(ctx, *price, red) + err := k.SetStablecoin(ctx, sc) + if err != nil { + return false + } + return false + } + + return k.IterateStablecoin(ctx, updatePrice) +} + +// price is $nomUSD amount to exchange for 1 $stabalecoin +// price taget = 1 +// ex: +// oldPrice:1 +// feeIn : 0.01 +// feeOut : 0.01 +// maxFee = 0.02 +// k = AdjustmentFeeIn = 40 +// ---------------------------------------------------------------------------------------- +// case 1: +// newPrice: 1.01 (1.01$nomUSD = 1USDT) +// rate = 1/1.01 = 0.990099 +// newfeeOut = 0.01/(0.990099)**k = 0.01 * (1.01**40)= 0.014888637335882209 +// newfeeIn = 0.02 - 0.014888637335882209 = 0.005111362664117791 + +// So $USDT swap to $nomUSD will be cheaper than $nomUSD swap to $USDT +// ---------------------------------------------------------------------------------------- +// case 2: +// newPrice: 0.99 (0.98$nomUSD = 1USDT) +// rate = 1/0.99 = 1.0101010101 +// deltaP < 0 +// newfeeIn = 0.01 * (1.0101010101)**40 = 0.014948314143157351 +// newfeeOut = 0.02 - 0.014948314143157351 = 0.005051685856842649 +// So $nomUSD swap to $USDT will be cheaper than $USDT swap to $nomUSD + +func (k Keeper) stablecoinUpdate(ctx context.Context, newPrice math.LegacyDec, stablecoin types.Stablecoin) types.Stablecoin { + params, err := k.GetParams(ctx) + if err != nil { + panic(err) + } + deltaP := newPrice.Sub(math.LegacyMustNewDecFromStr("1")) + if deltaP.Abs().LT(params.AcceptablePriceRatio) { + return stablecoin + } + // fee in anf out < fee_in +fee_out + feeMax, err := k.FeeMaxStablecoin.Get(ctx, stablecoin.Denom) + if err != nil { + panic(err) + } + + rate := math.LegacyOneDec().Quo(newPrice) + if rate.LT(math.LegacyOneDec()) { + feeOut := math.LegacyMustNewDecFromStr(feeMax).QuoInt64(2) + for i := 0; i < int(params.AdjustmentFee); i++ { + feeOut = feeOut.Quo(rate) + } + feeOut = math.LegacyMinDec(feeOut, math.LegacyMustNewDecFromStr(feeMax)) + feeIn := math.LegacyMustNewDecFromStr(feeMax).Sub(feeOut) + + stablecoin.FeeIn = feeIn + stablecoin.FeeOut = feeOut + } else { + feeIn := math.LegacyMustNewDecFromStr(feeMax).QuoInt64(2) + for i := 0; i < int(params.AdjustmentFee); i++ { + feeIn = feeIn.Mul(rate) + } + feeIn = math.LegacyMinDec(feeIn, math.LegacyMustNewDecFromStr(feeMax)) + feeOut := math.LegacyMustNewDecFromStr(feeMax).Sub(feeIn) + + stablecoin.FeeIn = feeIn + stablecoin.FeeOut = feeOut + } + return stablecoin +} diff --git a/x/psm/keeper/abci_test.go b/x/psm/keeper/abci_test.go new file mode 100644 index 00000000..4ba687a7 --- /dev/null +++ b/x/psm/keeper/abci_test.go @@ -0,0 +1,69 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestUpdatesStablecoinEpoch() { + s.SetupTest() + + tests := []struct { + name string + priceCurrent math.LegacyDec + feeIn math.LegacyDec + feeOut math.LegacyDec + priceUpdate math.LegacyDec + + expectFeeIn math.LegacyDec + expectFeeOut math.LegacyDec + }{ + { + name: "normal", + priceCurrent: math.LegacyMustNewDecFromStr("1"), + feeIn: math.LegacyMustNewDecFromStr("0.01"), + feeOut: math.LegacyMustNewDecFromStr("0.01"), + priceUpdate: math.LegacyMustNewDecFromStr("1.01"), + expectFeeIn: math.LegacyMustNewDecFromStr("0.005111362664117791"), + expectFeeOut: math.LegacyMustNewDecFromStr("0.014888637335882209"), + }, + { + name: "fluctuation", + priceCurrent: math.LegacyMustNewDecFromStr("1"), + feeIn: math.LegacyMustNewDecFromStr("0.01"), + feeOut: math.LegacyMustNewDecFromStr("0.01"), + priceUpdate: math.LegacyMustNewDecFromStr("0.99"), + expectFeeIn: math.LegacyMustNewDecFromStr("0.014948314143157351"), + expectFeeOut: math.LegacyMustNewDecFromStr("0.005051685856842649"), + }, + } + + for _, t := range tests { + s.Run(t.name, func() { + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: t.priceCurrent, + FeeIn: t.feeIn, + FeeOut: t.feeOut, + } + s.mockOracleKeeper.SetPrice(s.Ctx, sc.Denom, t.priceCurrent) + s.k.FeeMaxStablecoin.Set(s.Ctx, usdt, t.feeIn.Add(t.feeOut).String()) + + err := s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + s.mockOracleKeeper.SetPrice(s.Ctx, usdt, t.priceUpdate) + + err = s.k.UpdatesStablecoinEpoch(s.Ctx) + s.Require().NoError(err) + + scUpdate, found := s.k.GetStablecoin(s.Ctx, usdt) + s.Require().True(found) + // s.Require().Equal(t.priceUpdate, scUpdate.Price) + s.Require().Equal(t.expectFeeIn.String(), scUpdate.FeeIn.String()) + s.Require().Equal(t.expectFeeOut.String(), scUpdate.FeeOut.String()) + }) + } + +} diff --git a/x/psm/keeper/keeper.go b/x/psm/keeper/keeper.go new file mode 100644 index 00000000..e14c6085 --- /dev/null +++ b/x/psm/keeper/keeper.go @@ -0,0 +1,109 @@ +package keeper + +import ( + "fmt" + + "context" + + "cosmossdk.io/collections" + "cosmossdk.io/core/address" + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "cosmossdk.io/math" + + // "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + addressCodec address.Codec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. + // Typically, this should be the x/gov module account. + authority string + + Schema collections.Schema + Params collections.Item[types.Params] + // this line is used by starport scaffolding # collection/type + + BankKeeper types.BankKeeper + AccountKeeper types.AccountKeeper + OracleKeeper types.OracleKeeper + + // stablecoin / totalStablecoinLock + totalStablecoinLock collections.Map[string, math.Int] + FeeMaxStablecoin collections.Map[string, string] + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + // addressCodec address.Codec, + storeService store.KVStoreService, + // logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, + accountKeeper types.AccountKeeper, + oracleKeeper types.OracleKeeper, +) Keeper { + // if _, err := addressCodec.StringToBytes(authority); err != nil { + // panic(fmt.Sprintf("invalid authority address %s: %s", authority, err)) + // } + + sb := collections.NewSchemaBuilder(storeService) + + k := Keeper{ + cdc: cdc, + // addressCodec: addressCodec, + storeService: storeService, + authority: authority, + // logger: logger, + + BankKeeper: bankKeeper, + AccountKeeper: accountKeeper, + OracleKeeper: oracleKeeper, + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + totalStablecoinLock: collections.NewMap(sb, types.KeyTotalStablecoinLock, "total_stablecoin_lock", collections.StringKey, sdk.IntValue), + FeeMaxStablecoin: collections.NewMap(sb, types.KeyFeeMax, "fee_max_stablecoin", collections.StringKey, collections.StringValue), + // this line is used by starport scaffolding # collection/instantiate + } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + + return k +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +func (k Keeper) TotalStablecoinLock(ctx context.Context, nameStablecoin string) (math.Int, error) { + total := math.ZeroInt() + + k.totalStablecoinLock.Walk(ctx, nil, func(key string, value math.Int) (stop bool, err error) { + if key == nameStablecoin { + total.Add(value) + } + return false, nil + }) + + return total, nil +} diff --git a/x/psm/keeper/keeper_test.go b/x/psm/keeper/keeper_test.go new file mode 100644 index 00000000..10bfb898 --- /dev/null +++ b/x/psm/keeper/keeper_test.go @@ -0,0 +1,93 @@ +package keeper_test + +import ( + "context" + "cosmossdk.io/math" + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/onomyprotocol/reserve/app/apptesting" + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +var ( + usdt = "usdt" + usdc = "usdc" + + limitUSDT = math.NewInt(1000000) + limitUSDC = math.NewInt(1000000) +) + +type MockOracleKeeper struct { + prices map[string]math.LegacyDec +} + +func (m MockOracleKeeper) SetPrice(ctx context.Context, denom string, price math.LegacyDec) { + m.prices[denom] = price +} + +func (s MockOracleKeeper) GetPrice(ctx context.Context, denom1 string, denom2 string) *math.LegacyDec { + price1, ok := s.prices[denom1] + + if !ok { + panic("not found price " + denom1) + } + price2, ok := s.prices[denom2] + if !ok { + panic("not found price " + denom2) + } + p := price1.Quo(price2) + return &p +} + +func (s MockOracleKeeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + _, ok := s.prices[symbol] + + if !ok { + s.SetPrice(ctx, symbol, math.LegacyMustNewDecFromStr("1")) + } + return nil +} + +type KeeperTestSuite struct { + apptesting.KeeperTestHelper + + k keeper.Keeper + msgServer types.MsgServer + queryServer types.QueryServer + mockOracleKeeper *MockOracleKeeper +} + +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + + mockOracleKeeper := MockOracleKeeper{ + prices: make(map[string]math.LegacyDec), + } + mockOracleKeeper.SetPrice(s.Ctx, types.DenomStable, math.LegacyMustNewDecFromStr("1")) + + s.App.PSMKeeper.OracleKeeper = mockOracleKeeper + s.mockOracleKeeper = &mockOracleKeeper + + s.k = s.App.PSMKeeper + s.msgServer = keeper.NewMsgServerImpl(s.k) + s.queryServer = keeper.NewQueryServerImpl(s.k) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) TestParams() { + s.SetupTest() + + err := s.k.SetParams(s.Ctx, types.DefaultParams()) + s.Require().NoError(err) + + p, err := s.k.GetParams(s.Ctx) + s.Require().NoError(err) + s.Require().Equal(p.LimitTotal, types.DefaultLimitTotal) + s.Require().Equal(p.AcceptablePriceRatio, types.DefaultAcceptablePriceRatio) +} diff --git a/x/psm/keeper/msg_server.go b/x/psm/keeper/msg_server.go new file mode 100644 index 00000000..97308d87 --- /dev/null +++ b/x/psm/keeper/msg_server.go @@ -0,0 +1,248 @@ +package keeper + +import ( + "context" + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +type msgServer struct { + keeper Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if _, err := k.keeper.addressCodec.StringToBytes(req.Authority); err != nil { + return nil, errorsmod.Wrap(err, "invalid authority address") + } + + if k.keeper.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.keeper.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + if err := k.keeper.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + +func (k msgServer) SwapTonomUSD(ctx context.Context, msg *types.MsgSwapTonomUSD) (*types.MsgSwapTonomUSDResponse, error) { + // validate msg + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // check stablecoin is suport + _, found := k.keeper.GetStablecoin(ctx, msg.Coin.Denom) + if !found { + return nil, fmt.Errorf("%s not in list stablecoin supported", msg.Coin.Denom) + } + + // check limit swap + err := k.keeper.checkLimitTotalStablecoin(ctx, msg.Coin.Denom, msg.Coin.Amount) + if err != nil { + return nil, err + } + + // check balance user and calculate amount of coins received + addr := sdk.MustAccAddressFromBech32(msg.Address) + receiveAmountnomUSD, fee_in, err := k.keeper.SwapTonomUSD(ctx, addr, *msg.Coin) + if err != nil { + return nil, err + } + + // lock coin + totalStablecoinLock, err := k.keeper.totalStablecoinLock.Get(ctx, msg.Coin.Denom) + if err != nil { + return nil, err + } + newTotalStablecoinLock := totalStablecoinLock.Add(msg.Coin.Amount) + k.keeper.totalStablecoinLock.Set(ctx, msg.Coin.Denom, newTotalStablecoinLock) + + // send stablecoin to module + err = k.keeper.BankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.NewCoins(*msg.Coin)) + if err != nil { + return nil, err + } + + // mint nomUSD + coinsMint := sdk.NewCoins(sdk.NewCoin(types.DenomStable, receiveAmountnomUSD)) + err = k.keeper.BankKeeper.MintCoins(ctx, types.ModuleName, coinsMint) + if err != nil { + return nil, err + } + // send to user + err = k.keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coinsMint) + if err != nil { + return nil, err + } + + // event + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSwapTonomUSD, + sdk.NewAttribute(types.AttributeAmount, msg.Coin.String()), + sdk.NewAttribute(types.AttributeReceive, coinsMint.String()), + sdk.NewAttribute(types.AttributeFeeIn, fee_in.String()), + ), + ) + return &types.MsgSwapTonomUSDResponse{}, nil +} + +func (k msgServer) SwapToStablecoin(ctx context.Context, msg *types.MsgSwapToStablecoin) (*types.MsgSwapToStablecoinResponse, error) { + // validate basic + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // check stablecoin is suport + _, found := k.keeper.GetStablecoin(ctx, msg.ToDenom) + if !found { + return nil, fmt.Errorf("%s not in list stablecoin supported", msg.ToDenom) + } + + // check lock Coin of user + totalStablecoinLock, err := k.keeper.totalStablecoinLock.Get(ctx, msg.ToDenom) + if err != nil { + return nil, err + } + + // check balace and calculate amount of coins received + addr := sdk.MustAccAddressFromBech32(msg.Address) + receiveAmountStablecoin, fee_out, err := k.keeper.SwapToStablecoin(ctx, addr, msg.Amount, msg.ToDenom) + if err != nil { + return nil, err + } + + // locked stablecoin is greater than the amount desired + if totalStablecoinLock.LT(receiveAmountStablecoin) { + return nil, fmt.Errorf("amount %s locked lesser than amount desired", msg.ToDenom) + } + + // burn nomUSD + coinsBurn := sdk.NewCoins(sdk.NewCoin(types.DenomStable, msg.Amount)) + err = k.keeper.BankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, coinsBurn) + if err != nil { + return nil, err + } + err = k.keeper.BankKeeper.BurnCoins(ctx, types.ModuleName, coinsBurn) + if err != nil { + return nil, err + } + + // unlock + stablecoinReceive := sdk.NewCoin(msg.ToDenom, receiveAmountStablecoin) + newTotalStablecoinLock := totalStablecoinLock.Sub(receiveAmountStablecoin) + k.keeper.totalStablecoinLock.Set(ctx, msg.ToDenom, newTotalStablecoinLock) + + // send stablecoin to user + err = k.keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, sdk.NewCoins(stablecoinReceive)) + if err != nil { + return nil, err + } + + // event + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSwapToStablecoin, + sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()+types.DenomStable), + sdk.NewAttribute(types.AttributeReceive, stablecoinReceive.String()), + sdk.NewAttribute(types.AttributeFeeOut, fee_out.String()), + ), + ) + return &types.MsgSwapToStablecoinResponse{}, nil +} + +func (k msgServer) AddStableCoinProposal(ctx context.Context, msg *types.MsgAddStableCoin) (*types.MsgAddStableCoinResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if err := msg.ValidateBasic(); err != nil { + return &types.MsgAddStableCoinResponse{}, err + } + + _, found := k.keeper.GetStablecoin(ctx, msg.Denom) + if found { + return &types.MsgAddStableCoinResponse{}, fmt.Errorf("%s has existed", msg.Denom) + } + + err := k.keeper.SetStablecoin(ctx, types.GetMsgStablecoin(msg)) + if err != nil { + return &types.MsgAddStableCoinResponse{}, err + } + + err = k.keeper.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, msg.Denom, 1) + if err != nil { + return &types.MsgAddStableCoinResponse{}, err + } + + k.keeper.totalStablecoinLock.Set(ctx, msg.Denom, math.ZeroInt()) + k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventAddStablecoin, + sdk.NewAttribute(types.AttributeStablecoinName, msg.Denom), + ), + ) + return &types.MsgAddStableCoinResponse{}, nil +} + +func (k msgServer) UpdatesStableCoinProposal(ctx context.Context, msg *types.MsgUpdatesStableCoin) (*types.MsgUpdatesStableCoinResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if err := msg.ValidateBasic(); err != nil { + return &types.MsgUpdatesStableCoinResponse{}, err + } + + _, found := k.keeper.GetStablecoin(ctx, msg.Denom) + if !found { + return &types.MsgUpdatesStableCoinResponse{}, fmt.Errorf("%s not existed", msg.Denom) + } + + err := k.keeper.SetStablecoin(ctx, types.GetMsgStablecoin(msg)) + if err != nil { + return &types.MsgUpdatesStableCoinResponse{}, err + } + k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventAddStablecoin, + sdk.NewAttribute(types.AttributeStablecoinName, msg.Denom), + ), + ) + return &types.MsgUpdatesStableCoinResponse{}, nil +} + +func (k Keeper) checkLimitTotalStablecoin(ctx context.Context, denom string, amountSwap math.Int) error { + totalStablecoinLock, err := k.TotalStablecoinLock(ctx, denom) + if err != nil { + return err + } + + totalLimit, err := k.GetTotalLimitWithDenomStablecoin(ctx, denom) + if err != nil { + return err + } + if (totalStablecoinLock.Add(amountSwap)).GT(totalLimit) { + return fmt.Errorf("unable to perform %s token swap transaction because the amount of %s you want to swap exceeds the allowed limit, can only swap up to %s%s", denom, denom, (totalLimit).Sub(totalStablecoinLock).String(), denom) + } + + return nil +} diff --git a/x/psm/keeper/msg_server_test.go b/x/psm/keeper/msg_server_test.go new file mode 100644 index 00000000..9f3577ac --- /dev/null +++ b/x/psm/keeper/msg_server_test.go @@ -0,0 +1,175 @@ +package keeper_test + +import ( + "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestMsgServerSwapTonomUSD() { + s.SetupTest() + + tests := []struct { + name string + addr sdk.AccAddress + setup func(ctx context.Context, keeper keeper.Keeper) *types.MsgSwapTonomUSD + + expectPass bool + expectedReceive math.Int + }{ + { + name: "success", + addr: s.TestAccs[0], + setup: func(ctx context.Context, keeper keeper.Keeper) *types.MsgSwapTonomUSD { + coinsMint := sdk.NewCoins(sdk.NewCoin(usdt, math.NewInt(1000000))) + err := keeper.BankKeeper.MintCoins(ctx, types.ModuleName, coinsMint) + s.Require().NoError(err) + err = keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, s.TestAccs[0], coinsMint) + s.Require().NoError(err) + + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err = s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + + amountSwap := sdk.NewCoin(usdt, math.NewInt(1000)) + return &types.MsgSwapTonomUSD{ + Address: s.TestAccs[0].String(), + Coin: &amountSwap, + } + }, + + expectPass: true, + expectedReceive: math.NewInt(999), + }, + { + name: "insufficient balance", + addr: s.TestAccs[1], + setup: func(ctx context.Context, keeper keeper.Keeper) *types.MsgSwapTonomUSD { + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err := s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + + amountSwap := sdk.NewCoin(usdt, math.NewInt(1000)) + return &types.MsgSwapTonomUSD{ + Address: s.TestAccs[1].String(), + Coin: &amountSwap, + } + }, + + expectPass: false, + expectedReceive: math.NewInt(999), + }, + } + + for _, t := range tests { + s.Run(t.name, func() { + msg := t.setup(s.Ctx, s.k) + + _, err := s.msgServer.SwapTonomUSD(s.Ctx, msg) + if t.expectPass { + s.Require().NoError(err) + balance := s.k.BankKeeper.GetBalance(s.Ctx, t.addr, types.DenomStable) + s.Require().Equal(t.expectedReceive, balance.Amount) + + } else { + s.Require().Error(err) + } + + }) + } +} + +func (s *KeeperTestSuite) TestMsgSwapToStablecoin() { + s.SetupTest() + + tests := []struct { + name string + addr sdk.AccAddress + setup func(ctx context.Context, keeper keeper.Keeper) *types.MsgSwapToStablecoin + + expectPass bool + expectedBalancenomUSD math.Int + }{ + { + name: "success", + addr: s.TestAccs[0], + setup: func(ctx context.Context, keeper keeper.Keeper) *types.MsgSwapToStablecoin { + // swaptonomUSD + coinsMint := sdk.NewCoins(sdk.NewCoin(usdt, math.NewInt(1000000))) + err := keeper.BankKeeper.MintCoins(ctx, types.ModuleName, coinsMint) + s.Require().NoError(err) + err = keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, s.TestAccs[0], coinsMint) + s.Require().NoError(err) + + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err = s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + + amountSwap := sdk.NewCoin(usdt, math.NewInt(1001)) + msg := &types.MsgSwapTonomUSD{ + Address: s.TestAccs[0].String(), + Coin: &amountSwap, + } + _, err = s.msgServer.SwapTonomUSD(s.Ctx, msg) + s.Require().NoError(err) + + return &types.MsgSwapToStablecoin{ + Address: s.TestAccs[0].String(), + ToDenom: usdt, + Amount: math.NewInt(1000), + } + }, + + expectPass: true, + expectedBalancenomUSD: math.NewInt(0), + }, + } + + for _, t := range tests { + s.Run(t.name, func() { + msg := t.setup(s.Ctx, s.k) + + _, err := s.msgServer.SwapToStablecoin(s.Ctx, msg) + if t.expectPass { + s.Require().NoError(err) + balance := s.k.BankKeeper.GetBalance(s.Ctx, t.addr, types.DenomStable) + s.Require().Equal(t.expectedBalancenomUSD.String(), balance.Amount.String()) + + } else { + s.Require().Error(err) + } + + }) + } +} diff --git a/x/psm/keeper/params.go b/x/psm/keeper/params.go new file mode 100644 index 00000000..c84c2e70 --- /dev/null +++ b/x/psm/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := k.storeService.OpenKVStore(ctx) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + return store.Set(types.ParamsKey, bz) +} + +// GetParams gets the x/staking module parameters. +func (k Keeper) GetParams(ctx context.Context) (params types.Params, err error) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.ParamsKey) + if err != nil { + return params, err + } + + if bz == nil { + return params, nil + } + + err = k.cdc.Unmarshal(bz, ¶ms) + return params, err +} diff --git a/x/psm/keeper/proposals_test.go b/x/psm/keeper/proposals_test.go new file mode 100644 index 00000000..68e80e1f --- /dev/null +++ b/x/psm/keeper/proposals_test.go @@ -0,0 +1,66 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestAddStableCoinProposal() { + s.SetupTest() + + proAdd := types.MsgAddStableCoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + + _, err := s.msgServer.AddStableCoinProposal(s.Ctx, &proAdd) + s.Require().NoError(err) + + stablecoin, found := s.k.GetStablecoin(s.Ctx, proAdd.Denom) + s.Require().True(found) + s.Require().Equal(stablecoin.Denom, proAdd.Denom) + s.Require().Equal(stablecoin.LimitTotal, limitUSDT) +} + +func (s *KeeperTestSuite) TestUpdateStableCoinProposal() { + s.SetupTest() + + proAdd := types.MsgAddStableCoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + + _, err := s.msgServer.AddStableCoinProposal(s.Ctx, &proAdd) + s.Require().NoError(err) + + stablecoin, found := s.k.GetStablecoin(s.Ctx, proAdd.Denom) + s.Require().True(found) + s.Require().Equal(stablecoin.Denom, proAdd.Denom) + s.Require().Equal(stablecoin.LimitTotal, limitUSDT) + + // update stablecoin + limitTotalUpdates := math.NewInt(2000000) + + proUpdates := types.MsgUpdatesStableCoin{ + Denom: usdt, + LimitTotal: limitTotalUpdates, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + + _, err = s.msgServer.UpdatesStableCoinProposal(s.Ctx, &proUpdates) + s.Require().NoError(err) + + stablecoin, found = s.k.GetStablecoin(s.Ctx, proAdd.Denom) + s.Require().True(found) + s.Require().Equal(stablecoin.Denom, proAdd.Denom) + s.Require().Equal(stablecoin.LimitTotal, limitTotalUpdates) + +} diff --git a/x/psm/keeper/query.go b/x/psm/keeper/query.go new file mode 100644 index 00000000..64235b8b --- /dev/null +++ b/x/psm/keeper/query.go @@ -0,0 +1,92 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/collections" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +var _ types.QueryServer = queryServer{} + +// NewQueryServerImpl returns an implementation of the QueryServer interface +// for the provided Keeper. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k} +} + +type queryServer struct { + keeper Keeper +} + +func (q queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + params, err := q.keeper.GetParams(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return nil, status.Error(codes.NotFound, "not found") + } + + return nil, status.Error(codes.Internal, "internal error") + } + + return &types.QueryParamsResponse{Params: params}, nil +} + +func (q queryServer) Stablecoin(ctx context.Context, req *types.QueryStablecoinRequest) (*types.QueryStablecoinResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + stablecoin, found := q.keeper.GetStablecoin(ctx, req.Denom) + if !found { + return nil, status.Errorf(codes.NotFound, "not found stablecoin %s", req.Denom) + } + + totalStablecoinLock, err := q.keeper.TotalStablecoinLock(ctx, req.Denom) + if err != nil { + return nil, err + } + + return &types.QueryStablecoinResponse{ + Stablecoin: stablecoin, + CurrentTotal: totalStablecoinLock, + SwapableQuantity: stablecoin.LimitTotal.Sub(totalStablecoinLock), + }, nil +} + +func (q queryServer) AllStablecoin(c context.Context, req *types.QueryAllStablecoinRequest) (*types.QueryAllStablecoinResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + allStablecoins := []*types.StablecoinResponse{} + + adder := func(s types.Stablecoin) { + totalStablecoinLock, err := q.keeper.TotalStablecoinLock(c, s.Denom) + if err != nil { + panic(err) + } + + newStablecoinResponse := types.StablecoinResponse{ + Stablecoin: s, + CurrentTotal: totalStablecoinLock, + SwapableQuantity: s.LimitTotal.Sub(totalStablecoinLock), + } + allStablecoins = append(allStablecoins, &newStablecoinResponse) + } + + q.keeper.IterateStablecoin(c, func(red types.Stablecoin) (stop bool) { + adder(red) + return false + }) + + return &types.QueryAllStablecoinResponse{AllStablecoinResponse: allStablecoins}, nil +} diff --git a/x/psm/keeper/query_test.go b/x/psm/keeper/query_test.go new file mode 100644 index 00000000..bcd63de9 --- /dev/null +++ b/x/psm/keeper/query_test.go @@ -0,0 +1,34 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestQueryParams() { + s.SetupTest() + + rp, err := s.queryServer.Params(s.Ctx, &types.QueryParamsRequest{}) + s.Require().NoError(err) + s.Require().Equal(rp.Params.LimitTotal, types.DefaultLimitTotal) +} + +func (s *KeeperTestSuite) TestStablecoin() { + s.SetupTest() + + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err := s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + rp, err := s.queryServer.Stablecoin(s.Ctx, &types.QueryStablecoinRequest{Denom: usdt}) + s.Require().NoError(err) + s.Require().Equal(rp.Stablecoin, sc) + s.Require().Equal(rp.CurrentTotal, math.ZeroInt()) + s.Require().Equal(rp.SwapableQuantity, limitUSDT) +} diff --git a/x/psm/keeper/stablecoin.go b/x/psm/keeper/stablecoin.go new file mode 100644 index 00000000..87ed9d5b --- /dev/null +++ b/x/psm/keeper/stablecoin.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (k Keeper) SetStablecoin(ctx context.Context, s types.Stablecoin) error { + store := k.storeService.OpenKVStore(ctx) + + key := types.GetKeyStableCoin(s.Denom) + bz := k.cdc.MustMarshal(&s) + + return store.Set(key, bz) +} + +func (k Keeper) GetStablecoin(ctx context.Context, denom string) (types.Stablecoin, bool) { + store := k.storeService.OpenKVStore(ctx) + + key := types.GetKeyStableCoin(denom) + + bz, err := store.Get(key) + if bz == nil || err != nil { + return types.Stablecoin{}, false + } + + var token types.Stablecoin + k.cdc.MustUnmarshal(bz, &token) + + return token, true +} + +func (k Keeper) IterateStablecoin(ctx context.Context, cb func(red types.Stablecoin) (stop bool)) error { + store := k.storeService.OpenKVStore(ctx) + + iterator, err := store.Iterator(types.KeyStableCoin, storetypes.PrefixEndBytes(types.KeyStableCoin)) + if err != nil { + return err + } + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var token types.Stablecoin + k.cdc.MustUnmarshal(iterator.Value(), &token) + if cb(token) { + break + } + } + return nil +} + +func (k Keeper) GetTotalLimitWithDenomStablecoin(ctx context.Context, denom string) (math.Int, error) { + s, found := k.GetStablecoin(ctx, denom) + if !found { + return math.Int{}, fmt.Errorf("not found Stable coin %s", denom) + } + return s.LimitTotal, nil +} + +// func (k Keeper) GetPrice(ctx context.Context, denom string) (math.LegacyDec, error) { +// s, found := k.GetStablecoin(ctx, denom) +// if !found { +// return math.LegacyDec{}, fmt.Errorf("not found Stable coin %s", denom) +// } +// return s.Price, nil +// } + +func (k Keeper) GetFeeIn(ctx context.Context, denom string) (math.LegacyDec, error) { + s, found := k.GetStablecoin(ctx, denom) + if !found { + return math.LegacyDec{}, fmt.Errorf("not found Stable coin %s", denom) + } + return s.FeeIn, nil +} + +func (k Keeper) GetFeeOut(ctx context.Context, denom string) (math.LegacyDec, error) { + s, found := k.GetStablecoin(ctx, denom) + if !found { + return math.LegacyDec{}, fmt.Errorf("not found Stable coin %s", denom) + } + return s.FeeOut, nil +} diff --git a/x/psm/keeper/stablecoin_test.go b/x/psm/keeper/stablecoin_test.go new file mode 100644 index 00000000..d2b688d2 --- /dev/null +++ b/x/psm/keeper/stablecoin_test.go @@ -0,0 +1,49 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestStoreStablecoin() { + s.SetupTest() + + s1 := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + s2 := types.Stablecoin{ + Denom: usdc, + LimitTotal: limitUSDC, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + + err := s.k.SetStablecoin(s.Ctx, s1) + s.Require().NoError(err) + err = s.k.SetStablecoin(s.Ctx, s2) + s.Require().NoError(err) + + stablecoin1, found := s.k.GetStablecoin(s.Ctx, usdt) + s.Require().True(found) + s.Require().Equal(stablecoin1.Denom, usdt) + s.Require().Equal(stablecoin1.LimitTotal, limitUSDT) + + stablecoin2, found := s.k.GetStablecoin(s.Ctx, usdc) + s.Require().True(found) + s.Require().Equal(stablecoin2.Denom, usdc) + s.Require().Equal(stablecoin2.LimitTotal, limitUSDC) + + count := 0 + err = s.k.IterateStablecoin(s.Ctx, func(red types.Stablecoin) (stop bool) { + count += 1 + return false + }) + s.Require().NoError(err) + s.Require().Equal(count, 2) +} diff --git a/x/psm/keeper/swap.go b/x/psm/keeper/swap.go new file mode 100644 index 00000000..5a8c3ba2 --- /dev/null +++ b/x/psm/keeper/swap.go @@ -0,0 +1,75 @@ +package keeper + +import ( + "context" + "cosmossdk.io/math" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +// SwapToStablecoin return receiveAmount, fee, error +func (k Keeper) SwapToStablecoin(ctx context.Context, addr sdk.AccAddress, amount math.Int, toDenom string) (math.Int, sdk.DecCoin, error) { + asset := k.BankKeeper.GetBalance(ctx, addr, types.DenomStable) + + if asset.Amount.LT(amount) { + return math.ZeroInt(), sdk.DecCoin{}, fmt.Errorf("insufficient balance") + } + + multiplier := k.OracleKeeper.GetPrice(ctx, toDenom, types.DenomStable) + if multiplier == nil { + return math.Int{}, sdk.DecCoin{}, fmt.Errorf("can not get price %s and %s", toDenom, types.DenomStable) + } + amountStablecoin := amount.ToLegacyDec().Quo(*multiplier) + + fee, err := k.PayFeesOut(ctx, amountStablecoin.RoundInt(), toDenom) + if err != nil { + return math.Int{}, sdk.DecCoin{}, err + } + + receiveAmount := amountStablecoin.Sub(fee) + return receiveAmount.RoundInt(), sdk.NewDecCoinFromDec(toDenom, fee), nil +} + +func (k Keeper) SwapTonomUSD(ctx context.Context, addr sdk.AccAddress, stablecoin sdk.Coin) (math.Int, sdk.DecCoin, error) { + asset := k.BankKeeper.GetBalance(ctx, addr, stablecoin.Denom) + + if asset.Amount.LT(stablecoin.Amount) { + return math.ZeroInt(), sdk.DecCoin{}, fmt.Errorf("insufficient balance") + } + + multiplier := k.OracleKeeper.GetPrice(ctx, stablecoin.Denom, types.DenomStable) + if multiplier == nil { + return math.Int{}, sdk.DecCoin{}, fmt.Errorf("can not get price %s and %s", stablecoin.Denom, types.DenomStable) + } + + amountnomUSD := multiplier.Mul(stablecoin.Amount.ToLegacyDec()) + + fee, err := k.PayFeesIn(ctx, amountnomUSD.RoundInt(), stablecoin.Denom) + if err != nil { + return math.Int{}, sdk.DecCoin{}, err + } + + receiveAmountnomUSD := amountnomUSD.Sub(fee) + return receiveAmountnomUSD.RoundInt(), sdk.NewDecCoinFromDec(types.DenomStable, fee), nil +} + +func (k Keeper) PayFeesOut(ctx context.Context, amount math.Int, denom string) (math.LegacyDec, error) { + ratioSwapOutFees, err := k.GetFeeOut(ctx, denom) + if err != nil { + return math.LegacyDec{}, err + } + + fee := ratioSwapOutFees.MulInt(amount) + return fee, nil +} + +func (k Keeper) PayFeesIn(ctx context.Context, amount math.Int, denom string) (math.LegacyDec, error) { + ratioSwapInFees, err := k.GetFeeIn(ctx, denom) + if err != nil { + return math.LegacyDec{}, err + } + fee := ratioSwapInFees.MulInt(amount) + return fee, nil +} diff --git a/x/psm/keeper/swap_test.go b/x/psm/keeper/swap_test.go new file mode 100644 index 00000000..1aa0f342 --- /dev/null +++ b/x/psm/keeper/swap_test.go @@ -0,0 +1,178 @@ +package keeper_test + +import ( + "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func (s *KeeperTestSuite) TestSwapTonomUSD() { + s.SetupTest() + + tests := []struct { + name string + setup func(ctx context.Context, keeper keeper.Keeper) + addr sdk.AccAddress + stablecoin sdk.Coin + + expectPass bool + expectedReceive math.Int + expectedFee math.LegacyDec + }{ + { + name: "success", + setup: func(ctx context.Context, keeper keeper.Keeper) { + coinsMint := sdk.NewCoins(sdk.NewCoin(usdt, math.NewInt(1000000))) + err := keeper.BankKeeper.MintCoins(ctx, types.ModuleName, coinsMint) + s.Require().NoError(err) + err = keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, s.TestAccs[0], coinsMint) + s.Require().NoError(err) + + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err = s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + }, + addr: s.TestAccs[0], + stablecoin: sdk.NewCoin(usdt, math.NewInt(1000)), + expectPass: true, + expectedReceive: math.NewInt(999), + expectedFee: math.LegacyMustNewDecFromStr("1"), + }, + { + name: "insufficient balance", + setup: func(ctx context.Context, keeper keeper.Keeper) { + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err := s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + }, + addr: s.TestAccs[1], + stablecoin: sdk.NewCoin(usdt, math.NewInt(1000)), + expectPass: false, + expectedReceive: math.NewInt(999), + expectedFee: math.LegacyMustNewDecFromStr("1"), + }, + } + + for _, t := range tests { + s.Run(t.name, func() { + t.setup(s.Ctx, s.k) + + receiveAmount, fee, err := s.k.SwapTonomUSD(s.Ctx, t.addr, t.stablecoin) + if t.expectPass { + s.Require().NoError(err) + s.Require().Equal(t.expectedReceive, receiveAmount) + s.Require().Equal(t.expectedFee, fee.Amount) + } else { + s.Require().Error(err) + } + + }) + } +} + +func (s *KeeperTestSuite) TestSwapToStablecoin() { + s.SetupTest() + + tests := []struct { + name string + setup func(ctx context.Context, keeper keeper.Keeper) + addr sdk.AccAddress + amount math.Int + toDenom string + + expectPass bool + expectedReceive math.Int + expectedFee math.LegacyDec + }{ + { + name: "success", + setup: func(ctx context.Context, keeper keeper.Keeper) { + coinsMint := sdk.NewCoins(sdk.NewCoin(types.DenomStable, math.NewInt(1000000))) + err := keeper.BankKeeper.MintCoins(ctx, types.ModuleName, coinsMint) + s.Require().NoError(err) + err = keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, s.TestAccs[0], coinsMint) + s.Require().NoError(err) + + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err = s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + }, + addr: s.TestAccs[0], + amount: math.NewInt(1000), + toDenom: usdt, + expectPass: true, + expectedReceive: math.NewInt(999), + expectedFee: math.LegacyMustNewDecFromStr("1"), + }, + { + name: "insufficient balance", + setup: func(ctx context.Context, keeper keeper.Keeper) { + sc := types.Stablecoin{ + Denom: usdt, + LimitTotal: limitUSDT, + // Price: math.LegacyMustNewDecFromStr("1"), + FeeIn: math.LegacyMustNewDecFromStr("0.001"), + FeeOut: math.LegacyMustNewDecFromStr("0.001"), + } + err := s.k.SetStablecoin(s.Ctx, sc) + s.Require().NoError(err) + + err = s.k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, sc.Denom, 1) + s.Require().NoError(err) + }, + addr: s.TestAccs[1], + amount: math.NewInt(1000), + toDenom: usdt, + expectPass: false, + expectedReceive: math.NewInt(999), + expectedFee: math.LegacyMustNewDecFromStr("1"), + }, + } + + for _, t := range tests { + s.Run(t.name, func() { + t.setup(s.Ctx, s.k) + + receiveAmount, fee, err := s.k.SwapToStablecoin(s.Ctx, t.addr, t.amount, t.toDenom) + if t.expectPass { + s.Require().NoError(err) + s.Require().Equal(t.expectedReceive, receiveAmount) + s.Require().Equal(t.expectedFee, fee.Amount) + } else { + s.Require().Error(err) + } + + }) + } +} diff --git a/x/psm/module/autocli.go b/x/psm/module/autocli.go new file mode 100644 index 00000000..c53a3e25 --- /dev/null +++ b/x/psm/module/autocli.go @@ -0,0 +1,35 @@ +package psm + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + "github.com/onomyprotocol/reserve/x/psm/types" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: types.Query_serviceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: types.Msg_serviceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/psm/module/genesis.go b/x/psm/module/genesis.go new file mode 100644 index 00000000..d81d9451 --- /dev/null +++ b/x/psm/module/genesis.go @@ -0,0 +1,29 @@ +package psm + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) error { + // this line is used by starport scaffolding # genesis/module/init + return k.Params.Set(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) (*types.GenesisState, error) { + var err error + + genesis := types.DefaultGenesis() + genesis.Params, err = k.Params.Get(ctx) + if err != nil { + return nil, err + } + + // this line is used by starport scaffolding # genesis/module/export + + return genesis, nil +} diff --git a/x/psm/module/module.go b/x/psm/module/module.go new file mode 100644 index 00000000..2a1764e5 --- /dev/null +++ b/x/psm/module/module.go @@ -0,0 +1,243 @@ +package psm + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/address" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "github.com/spf13/cobra" + // "cosmossdk.io/depinject/appconfig" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + psmmodulev1 "github.com/onomyprotocol/reserve/api/reserve/psm/module/v1" + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/psm/client/cli" + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the root tx command for the psm module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the psm module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + if err := InitGenesis(ctx, am.keeper, genState); err != nil { + panic(err) + } +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState, err := ExportGenesis(ctx, am.keeper) + if err != nil { + panic(err) + } + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(ctx context.Context) error { + return am.keeper.BeginBlocker(ctx) +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &psmmodulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + AddressCodec address.Codec + StoreService store.KVStoreService + Cdc codec.Codec + Config *psmmodulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + OracleKeeper oraclekeeper.Keeper +} + +type ModuleOutputs struct { + depinject.Out + + PsmKeeper keeper.Keeper + Module appmodule.AppModule + GovHandler govv1beta1.HandlerRoute +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + // in.AddressCodec, + in.StoreService, + // in.Logger, + authority.String(), + in.BankKeeper, + in.AccountKeeper, + &in.OracleKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + govHandler := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewPSMProposalHandler(&k)} + + return ModuleOutputs{PsmKeeper: k, Module: m, GovHandler: govHandler} +} diff --git a/x/psm/module/proposal_handler.go b/x/psm/module/proposal_handler.go new file mode 100644 index 00000000..3caaf6c1 --- /dev/null +++ b/x/psm/module/proposal_handler.go @@ -0,0 +1,28 @@ +package psm + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + + "github.com/onomyprotocol/reserve/x/psm/keeper" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +func NewPSMProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + msgSv := keeper.NewMsgServerImpl(*k) + switch c := content.(type) { + case *types.MsgAddStableCoin: + _, err := msgSv.AddStableCoinProposal(ctx, c) + return err + case *types.MsgUpdatesStableCoin: + _, err := msgSv.UpdatesStableCoinProposal(ctx, c) + return err + default: + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s proposal content type: %T", types.ModuleName, c) + } + } +} diff --git a/x/psm/module/simulation.go b/x/psm/module/simulation.go new file mode 100644 index 00000000..5cbeb2f7 --- /dev/null +++ b/x/psm/module/simulation.go @@ -0,0 +1,59 @@ +package psm + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + // "github.com/onomyprotocol/reserve/testutil/sample" + psmsimulation "github.com/onomyprotocol/reserve/x/psm/simulation" + "github.com/onomyprotocol/reserve/x/psm/types" +) + +// avoid unused import issue +var ( + _ = psmsimulation.FindAccount + _ = rand.Rand{} + // _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + psmGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&psmGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/psm/simulation/helpers.go b/x/psm/simulation/helpers.go new file mode 100644 index 00000000..92c437c0 --- /dev/null +++ b/x/psm/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/psm/types/codec.go b/x/psm/types/codec.go new file mode 100644 index 00000000..c281b27f --- /dev/null +++ b/x/psm/types/codec.go @@ -0,0 +1,29 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + &MsgSwapToStablecoin{}, + &MsgSwapTonomUSD{}, + &MsgSwapToStablecoin{}, + &MsgAddStableCoin{}, + &MsgUpdatesStableCoin{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &MsgAddStableCoin{}, + &MsgUpdatesStableCoin{}, + ) +} diff --git a/x/psm/types/errors.go b/x/psm/types/errors.go new file mode 100644 index 00000000..cdeaea4f --- /dev/null +++ b/x/psm/types/errors.go @@ -0,0 +1,14 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/psm module sentinel errors +var ( + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrInvalidAddStableCoinProposal = sdkerrors.Register(ModuleName, 2, "invalid add stable coin proposal") +) diff --git a/x/psm/types/event.go b/x/psm/types/event.go new file mode 100644 index 00000000..4ad5fa7b --- /dev/null +++ b/x/psm/types/event.go @@ -0,0 +1,13 @@ +package types + +const ( + EventAddStablecoin = "add_stablecoin" + EventSwapTonomUSD = "swap_stablecoin_to_nomUSD" + EventSwapToStablecoin = "swap_nomUSD_to_stablecoin" + + AttributeAmount = "amount" + AttributeStablecoinName = "stablecoin_name" + AttributeReceive = "receive" + AttributeFeeIn = "fee_in" + AttributeFeeOut = "fee_out" +) diff --git a/x/psm/types/expected_keepers.go b/x/psm/types/expected_keepers.go new file mode 100644 index 00000000..33bb2f4b --- /dev/null +++ b/x/psm/types/expected_keepers.go @@ -0,0 +1,37 @@ +package types + +import ( + "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + GetModuleAddress(name string) sdk.AccAddress + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + // Methods imported from bank should be defined here +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} + +type OracleKeeper interface { + GetPrice(ctx context.Context, base, quote string) *math.LegacyDec + AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error +} diff --git a/x/psm/types/genesis.go b/x/psm/types/genesis.go new file mode 100644 index 00000000..f2689b73 --- /dev/null +++ b/x/psm/types/genesis.go @@ -0,0 +1,20 @@ +package types + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/psm/types/genesis.pb.go b/x/psm/types/genesis.pb.go new file mode 100644 index 00000000..e3de6e66 --- /dev/null +++ b/x/psm/types/genesis.pb.go @@ -0,0 +1,324 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// GenesisState defines the psm module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_fbe4ca1f3927cde8, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "reserve.psm.v1.GenesisState") +} + +func init() { proto.RegisterFile("reserve/psm/v1/genesis.proto", fileDescriptor_fbe4ca1f3927cde8) } + +var fileDescriptor_fbe4ca1f3927cde8 = []byte{ + // 214 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x2f, 0x28, 0xce, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, + 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x15, 0x14, 0xe7, + 0xea, 0x95, 0x19, 0x4a, 0x09, 0x26, 0xe6, 0x66, 0xe6, 0xe5, 0xeb, 0x83, 0x49, 0x88, 0x12, 0x29, + 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x8a, 0x4a, 0xa3, 0x19, 0x5b, 0x90, + 0x58, 0x94, 0x98, 0x0b, 0x35, 0x55, 0xc9, 0x93, 0x8b, 0xc7, 0x1d, 0x62, 0x4d, 0x70, 0x49, 0x62, + 0x49, 0xaa, 0x90, 0x25, 0x17, 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x4c, + 0x0f, 0xd5, 0x5a, 0xbd, 0x00, 0xb0, 0xac, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, + 0xd0, 0x62, 0x0c, 0x82, 0x6a, 0x70, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, + 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xfc, 0xbc, + 0xfc, 0xdc, 0x4a, 0xb0, 0xdd, 0xc9, 0xf9, 0x39, 0xfa, 0x30, 0xa7, 0x55, 0x80, 0x1d, 0x57, 0x52, + 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x48, 0x74, + 0xe4, 0x5a, 0x0f, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/genesis_test.go b/x/psm/types/genesis_test.go new file mode 100644 index 00000000..46a81dbc --- /dev/null +++ b/x/psm/types/genesis_test.go @@ -0,0 +1,37 @@ +package types_test + +import ( + "testing" + + "github.com/onomyprotocol/reserve/x/psm/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{}, + valid: false, + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/psm/types/keys.go b/x/psm/types/keys.go new file mode 100644 index 00000000..6a5a74c4 --- /dev/null +++ b/x/psm/types/keys.go @@ -0,0 +1,38 @@ +package types + +const ( + // ModuleName defines the module name. + ModuleName = "psm" + + // StoreKey defines the primary module store key. + StoreKey = ModuleName + + // RouterKey is the message route for slashing. + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key. + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key. + MemStoreKey = "mem_psm" + + // Inter Stable Token. + DenomStable = "nomUSD" +) + +var ( + KeyStableCoin = []byte{0x01} + KeyLockStableCoin = []byte{0x02} + KeyUnlockStableCoin = []byte{0x03} + ParamsKey = []byte{0x4} + KeyTotalStablecoinLock = []byte{0x5} + KeyFeeMax = []byte{0x6} +) + +func GetKeyStableCoin(denom string) []byte { + return append(KeyStableCoin, []byte(denom)...) +} + +func GetKeyLockCoin(denom string) []byte { + return append(KeyLockStableCoin, []byte(denom)...) +} diff --git a/x/psm/types/module.pb.go b/x/psm/types/module.pb.go new file mode 100644 index 00000000..5e6465b6 --- /dev/null +++ b/x/psm/types/module.pb.go @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/module/v1/module.proto + +package types + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +// Module is the config object for the module. +type Module struct { + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_032677de36312ba3, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "reserve.psm.module.v1.Module") +} + +func init() { + proto.RegisterFile("reserve/psm/module/v1/module.proto", fileDescriptor_032677de36312ba3) +} + +var fileDescriptor_032677de36312ba3 = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x2f, 0x28, 0xce, 0xd5, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0xd5, 0x2f, + 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x44, 0xa1, 0x6a, 0xf4, 0x0a, 0x8a, + 0x73, 0xf5, 0xa0, 0x32, 0x65, 0x86, 0x52, 0x0a, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0x89, + 0x05, 0x05, 0xfa, 0x65, 0x86, 0x89, 0x39, 0x05, 0x19, 0x89, 0xa8, 0x1a, 0x95, 0xc2, 0xb8, 0xd8, + 0x7c, 0xc1, 0x7c, 0x21, 0x19, 0x2e, 0xce, 0xc4, 0xd2, 0x92, 0x8c, 0xfc, 0xa2, 0xcc, 0x92, 0x4a, + 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x84, 0x80, 0x95, 0xde, 0xae, 0x03, 0xd3, 0x6e, 0x31, + 0x6a, 0x70, 0xa9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xe7, 0xe7, + 0xe5, 0xe7, 0x56, 0x82, 0x8d, 0x49, 0xce, 0xcf, 0xd1, 0x87, 0xb9, 0xb2, 0x02, 0xe4, 0x4e, 0x27, + 0xb7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, + 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x21, 0xce, 0x04, 0xfd, + 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xac, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x85, + 0xe3, 0xe1, 0xd5, 0x05, 0x01, 0x00, 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/msgs.go b/x/psm/types/msgs.go new file mode 100644 index 00000000..d0e6f483 --- /dev/null +++ b/x/psm/types/msgs.go @@ -0,0 +1,192 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + "cosmossdk.io/math" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +var ( + _ sdk.Msg = &MsgSwapTonomUSD{} + _ sdk.Msg = &MsgSwapToStablecoin{} + _ sdk.Msg = &MsgAddStableCoin{} + _ sdk.Msg = &MsgUpdatesStableCoin{} + _ getStablecoinFromMsg = &MsgAddStableCoin{} + _ getStablecoinFromMsg = &MsgUpdatesStableCoin{} + + _ govtypes.Content = &MsgAddStableCoin{} + _ govtypes.Content = &MsgUpdatesStableCoin{} +) + +const ( + ProposalTypeAddStableCoinProposal string = "MsgAddStableCoin" + ProposalTypeUpdatesStableCoinProposal string = "MsgUpdatesStableCoin" +) + +func init() { + govtypes.RegisterProposalType(ProposalTypeAddStableCoinProposal) + govtypes.RegisterProposalType(ProposalTypeUpdatesStableCoinProposal) + +} + +func NewMsgSwapTonomUSD(addr string, coin *sdk.Coin) *MsgSwapTonomUSD { + return &MsgSwapTonomUSD{ + Address: addr, + Coin: coin, + } +} + +func (msg MsgSwapTonomUSD) ValidateBasic() error { + if msg.Address == "" { + return fmt.Errorf("empty address") + } + + return msg.Coin.Validate() +} + +func (msg MsgSwapTonomUSD) GetSigners() []sdk.AccAddress { + acc, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + panic(err) + } + return []sdk.AccAddress{acc} +} + +// Route implements the sdk.Msg interface. +func (msg MsgSwapTonomUSD) Route() string { return RouterKey } + +// /////////// +func NewMsgSwapToStablecoin(addr, toDenom string, amount math.Int) *MsgSwapToStablecoin { + return &MsgSwapToStablecoin{ + Address: addr, + ToDenom: toDenom, + Amount: amount, + } +} + +func (msg MsgSwapToStablecoin) ValidateBasic() error { + if msg.Address == "" { + return fmt.Errorf("empty address") + } + if msg.ToDenom == "" { + return fmt.Errorf("empty denom") + } + if msg.Amount.LT(math.ZeroInt()) { + return fmt.Errorf("total limit less than zero") + } + return nil +} + +func (msg MsgSwapToStablecoin) GetSigners() []sdk.AccAddress { + acc, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + panic(err) + } + return []sdk.AccAddress{acc} +} + +// Route implements the sdk.Msg interface. +func (msg MsgSwapToStablecoin) Route() string { return RouterKey } + +var ( + Query_serviceDesc = _Query_serviceDesc + Msg_serviceDesc = _Msg_serviceDesc +) + +// func (msg MsgAddStableCoin) GetPrice() math.LegacyDec { +// return msg.Price +// } + +func (msg MsgAddStableCoin) GetLimitTotal() math.Int { + return msg.LimitTotal +} + +func (msg MsgAddStableCoin) GetFeeIn() math.LegacyDec { + return msg.FeeIn +} +func (msg MsgAddStableCoin) GetFeeOut() math.LegacyDec { + return msg.FeeOut +} + +func (a *MsgAddStableCoin) ProposalRoute() string { return RouterKey } + +func (a *MsgAddStableCoin) ProposalType() string { + return ProposalTypeAddStableCoinProposal +} + +func (a *MsgAddStableCoin) GetDescription() string { return RouterKey } +func (a *MsgAddStableCoin) GetTitle() string { return RouterKey } + +func (msg MsgAddStableCoin) ValidateBasic() error { + if msg.Denom == "" { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "empty denom") + } + + if msg.LimitTotal.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "limittotal less than zero") + } + + // if msg.Price.LT(math.LegacyZeroDec()) { + // return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "price less than zero") + // } + + if msg.FeeIn.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "feein less than zero") + } + + if msg.FeeOut.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "feeout less than zero") + } + + return nil +} + +// func (msg MsgUpdatesStableCoin) GetPrice() math.LegacyDec { +// return msg.Price +// } + +func (msg MsgUpdatesStableCoin) GetLimitTotal() math.Int { + return msg.LimitTotal +} + +func (msg MsgUpdatesStableCoin) GetFeeIn() math.LegacyDec { + return msg.FeeIn +} +func (msg MsgUpdatesStableCoin) GetFeeOut() math.LegacyDec { + return msg.FeeOut +} + +func (msg MsgUpdatesStableCoin) ValidateBasic() error { + if msg.Denom == "" { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "empty denom") + } + + if msg.LimitTotal.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "limittotal less than zero") + } + + // if msg.Price.LT(math.LegacyZeroDec()) { + // return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "price less than zero") + // } + + if msg.FeeIn.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "feein less than zero") + } + + if msg.FeeOut.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidAddStableCoinProposal, "feeout less than zero") + } + + return nil +} + +func (a *MsgUpdatesStableCoin) ProposalRoute() string { return RouterKey } + +func (a *MsgUpdatesStableCoin) ProposalType() string { + return ProposalTypeUpdatesStableCoinProposal +} + +func (a *MsgUpdatesStableCoin) GetDescription() string { return RouterKey } +func (a *MsgUpdatesStableCoin) GetTitle() string { return RouterKey } diff --git a/x/psm/types/params.go b/x/psm/types/params.go new file mode 100644 index 00000000..62041a52 --- /dev/null +++ b/x/psm/types/params.go @@ -0,0 +1,84 @@ +package types + +import ( + "cosmossdk.io/math" + "fmt" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var ( + DefaultLimitTotal = math.NewInt(100_000_000) + DefaultAcceptablePriceRatio = math.LegacyMustNewDecFromStr("0.001") + DefaultAdjustmentFee = int64(40) + + KeyLimitTotal = []byte("LimitTotal") + KeyAcceptablePriceRatio = []byte("AcceptablePriceRatio") +) + +// NewParams creates a new Params instance. +func NewParams( + limitTotal math.Int, + acceptablePriceRatio math.LegacyDec, + adjustmentFee int64, +) Params { + return Params{ + LimitTotal: limitTotal, + AcceptablePriceRatio: acceptablePriceRatio, + AdjustmentFee: DefaultAdjustmentFee, + } +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return NewParams( + DefaultLimitTotal, DefaultAcceptablePriceRatio, DefaultAdjustmentFee, + ) +} + +// Validate validates the set of params. +func (m Params) Validate() error { + if err := validateLimitTotal(m.LimitTotal); err != nil { + return err + } + if err := validateAcceptablePriceRatio(m.AcceptablePriceRatio); err != nil { + return fmt.Errorf("AcceptablePriceRatio must be positive") + } + return nil +} + +func validateLimitTotal(i interface{}) error { + v, ok := i.(math.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} + +func validateAcceptablePriceRatio(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} + +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyLimitTotal, &p.LimitTotal, validateLimitTotal), + paramtypes.NewParamSetPair(KeyAcceptablePriceRatio, &p.AcceptablePriceRatio, validateAcceptablePriceRatio), + } +} diff --git a/x/psm/types/params.pb.go b/x/psm/types/params.pb.go new file mode 100644 index 00000000..9fa3b6d1 --- /dev/null +++ b/x/psm/types/params.pb.go @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/v1/params.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 Params struct { + // total $nomUSD can mint + LimitTotal cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=limit_total,json=limitTotal,proto3,customtype=cosmossdk.io/math.Int" json:"limit_total"` + // The price cannot be exactly 1, an acceptable such as 0.9999 (AcceptablePriceRatio = 0.0001) + AcceptablePriceRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=acceptable_price_ratio,json=acceptablePriceRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"acceptable_price_ratio"` + // feeIn adjustment factor + AdjustmentFee int64 `protobuf:"varint,3,opt,name=adjustment_fee,json=adjustmentFee,proto3" json:"adjustment_fee,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_e516259d7293aa1e, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetAdjustmentFee() int64 { + if m != nil { + return m.AdjustmentFee + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "reserve.psm.v1.Params") +} + +func init() { proto.RegisterFile("reserve/psm/v1/params.proto", fileDescriptor_e516259d7293aa1e) } + +var fileDescriptor_e516259d7293aa1e = []byte{ + // 336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0xd1, 0xc1, 0x4a, 0xf3, 0x40, + 0x10, 0x07, 0xf0, 0xec, 0x57, 0xe8, 0x21, 0x9f, 0x16, 0x0c, 0x55, 0x6a, 0x0b, 0x69, 0x11, 0x84, + 0x22, 0x9a, 0xb5, 0xf8, 0x06, 0xa5, 0x14, 0x0a, 0x1e, 0x6a, 0xf0, 0xe4, 0x25, 0x6c, 0xb7, 0x63, + 0x1a, 0xcd, 0x66, 0x96, 0xec, 0xb6, 0xd8, 0xb7, 0xf0, 0x31, 0x3c, 0x7a, 0xf0, 0x21, 0x7a, 0x2c, + 0x9e, 0xc4, 0x43, 0x91, 0xf6, 0xe0, 0xc1, 0x97, 0x90, 0x6c, 0x22, 0x15, 0xbc, 0x84, 0xc9, 0xfc, + 0x77, 0x7f, 0x03, 0x3b, 0x76, 0x23, 0x05, 0x05, 0xe9, 0x0c, 0xa8, 0x54, 0x82, 0xce, 0x3a, 0x54, + 0xb2, 0x94, 0x09, 0xe5, 0xc9, 0x14, 0x35, 0x3a, 0x95, 0x22, 0xf4, 0xa4, 0x12, 0xde, 0xac, 0x53, + 0xdf, 0x63, 0x22, 0x4a, 0x90, 0x9a, 0x6f, 0x7e, 0xa4, 0x5e, 0x0d, 0x31, 0x44, 0x53, 0xd2, 0xac, + 0x2a, 0xba, 0x87, 0x1c, 0x95, 0x40, 0x15, 0xe4, 0x41, 0xfe, 0x93, 0x47, 0x47, 0x5f, 0xc4, 0x2e, + 0x0f, 0xcd, 0x10, 0xe7, 0xca, 0xfe, 0x1f, 0x47, 0x22, 0xd2, 0x81, 0x46, 0xcd, 0xe2, 0x1a, 0x69, + 0x91, 0xf6, 0x4e, 0xf7, 0x7c, 0xb1, 0x6a, 0x5a, 0xef, 0xab, 0xe6, 0x7e, 0x7e, 0x4b, 0x8d, 0xef, + 0xbd, 0x08, 0xa9, 0x60, 0x7a, 0xe2, 0x0d, 0x12, 0xfd, 0xfa, 0x72, 0x66, 0x17, 0xdc, 0x20, 0xd1, + 0x4f, 0x9f, 0xcf, 0x27, 0xc4, 0xb7, 0x0d, 0x72, 0x9d, 0x19, 0x4e, 0x68, 0x1f, 0x30, 0xce, 0x41, + 0x6a, 0x36, 0x8a, 0x21, 0x90, 0x69, 0xc4, 0x21, 0x48, 0x99, 0x8e, 0xb0, 0xf6, 0xcf, 0xe8, 0x9d, + 0x42, 0x6f, 0xfc, 0xd5, 0x2f, 0x21, 0x64, 0x7c, 0xde, 0x03, 0xfe, 0x6b, 0x46, 0x0f, 0xb8, 0x5f, + 0xdd, 0x82, 0xc3, 0xcc, 0xf3, 0x33, 0xce, 0x39, 0xb6, 0x2b, 0x6c, 0x7c, 0x37, 0x55, 0x5a, 0x40, + 0xa2, 0x83, 0x5b, 0x80, 0x5a, 0xa9, 0x45, 0xda, 0x25, 0x7f, 0x77, 0xdb, 0xed, 0x03, 0x74, 0xfb, + 0x8b, 0xb5, 0x4b, 0x96, 0x6b, 0x97, 0x7c, 0xac, 0x5d, 0xf2, 0xb8, 0x71, 0xad, 0xe5, 0xc6, 0xb5, + 0xde, 0x36, 0xae, 0x75, 0x73, 0x1a, 0x46, 0x7a, 0x32, 0x1d, 0x79, 0x1c, 0x05, 0xc5, 0x04, 0xc5, + 0xdc, 0x3c, 0x0f, 0xc7, 0x98, 0xfe, 0x6c, 0xe4, 0xc1, 0xec, 0x44, 0xcf, 0x25, 0xa8, 0x51, 0xd9, + 0xa4, 0x17, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x40, 0x6c, 0x5e, 0xaf, 0x01, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AdjustmentFee != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.AdjustmentFee)) + i-- + dAtA[i] = 0x18 + } + { + size := m.AcceptablePriceRatio.Size() + i -= size + if _, err := m.AcceptablePriceRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.LimitTotal.Size() + i -= size + if _, err := m.LimitTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LimitTotal.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.AcceptablePriceRatio.Size() + n += 1 + l + sovParams(uint64(l)) + if m.AdjustmentFee != 0 { + n += 1 + sovParams(uint64(m.AdjustmentFee)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LimitTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptablePriceRatio", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AcceptablePriceRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AdjustmentFee", wireType) + } + m.AdjustmentFee = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AdjustmentFee |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/psm.go b/x/psm/types/psm.go new file mode 100644 index 00000000..10ef770a --- /dev/null +++ b/x/psm/types/psm.go @@ -0,0 +1,23 @@ +package types + +import ( + "cosmossdk.io/math" +) + +func GetMsgStablecoin(msg getStablecoinFromMsg) Stablecoin { + return Stablecoin{ + Denom: msg.GetDenom(), + LimitTotal: msg.GetLimitTotal(), + // Price: msg.GetPrice(), + FeeIn: msg.GetFeeIn(), + FeeOut: msg.GetFeeOut(), + } +} + +type getStablecoinFromMsg interface { + GetDenom() string + GetLimitTotal() math.Int + // GetPrice() math.LegacyDec + GetFeeIn() math.LegacyDec + GetFeeOut() math.LegacyDec +} diff --git a/x/psm/types/psm.pb.go b/x/psm/types/psm.pb.go new file mode 100644 index 00000000..b991f1de --- /dev/null +++ b/x/psm/types/psm.pb.go @@ -0,0 +1,470 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/v1/psm.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 Stablecoin struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // limit total stablecoin module support + LimitTotal cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=limit_total,json=limitTotal,proto3,customtype=cosmossdk.io/math.Int" json:"limit_total"` + FeeIn cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=fee_in,json=feeIn,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_in"` + FeeOut cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=fee_out,json=feeOut,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_out"` +} + +func (m *Stablecoin) Reset() { *m = Stablecoin{} } +func (m *Stablecoin) String() string { return proto.CompactTextString(m) } +func (*Stablecoin) ProtoMessage() {} +func (*Stablecoin) Descriptor() ([]byte, []int) { + return fileDescriptor_59572214fa05fb2f, []int{0} +} +func (m *Stablecoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Stablecoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Stablecoin.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 *Stablecoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_Stablecoin.Merge(m, src) +} +func (m *Stablecoin) XXX_Size() int { + return m.Size() +} +func (m *Stablecoin) XXX_DiscardUnknown() { + xxx_messageInfo_Stablecoin.DiscardUnknown(m) +} + +var xxx_messageInfo_Stablecoin proto.InternalMessageInfo + +func (m *Stablecoin) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func init() { + proto.RegisterType((*Stablecoin)(nil), "reserve.psm.v1.Stablecoin") +} + +func init() { proto.RegisterFile("reserve/psm/v1/psm.proto", fileDescriptor_59572214fa05fb2f) } + +var fileDescriptor_59572214fa05fb2f = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xc1, 0x4a, 0xf3, 0x40, + 0x10, 0xc7, 0x93, 0x7e, 0x5f, 0x2b, 0xae, 0x22, 0x18, 0x2a, 0xc4, 0x0a, 0x69, 0xf1, 0x54, 0x44, + 0xb3, 0x06, 0xdf, 0xa0, 0x14, 0xb1, 0x22, 0x88, 0xd5, 0x93, 0x97, 0x92, 0xa4, 0xd3, 0x34, 0x98, + 0xdd, 0x29, 0xdd, 0x6d, 0xb0, 0xcf, 0xe0, 0xc5, 0xc7, 0xf0, 0xe8, 0xc1, 0x87, 0xe8, 0xb1, 0x78, + 0x12, 0x0f, 0x45, 0xda, 0x83, 0xaf, 0x21, 0xbb, 0x1b, 0x41, 0xf0, 0xe6, 0x25, 0xd9, 0xf9, 0xff, + 0x86, 0xdf, 0x0e, 0x3b, 0xc4, 0x1d, 0x83, 0x80, 0x71, 0x0e, 0x74, 0x24, 0x18, 0xcd, 0x03, 0xf5, + 0xf3, 0x47, 0x63, 0x94, 0xe8, 0x6c, 0x15, 0xc4, 0x57, 0x51, 0x1e, 0xd4, 0xaa, 0x09, 0x26, 0xa8, + 0x11, 0x55, 0x27, 0xd3, 0x55, 0xdb, 0x8d, 0x51, 0x30, 0x14, 0x3d, 0x03, 0x4c, 0x51, 0xa0, 0xed, + 0x90, 0xa5, 0x1c, 0xa9, 0xfe, 0x16, 0x91, 0x67, 0x1a, 0x68, 0x14, 0x0a, 0xa0, 0x79, 0x10, 0x81, + 0x0c, 0x03, 0x1a, 0x63, 0xca, 0x0d, 0xdf, 0x7f, 0x28, 0x11, 0x72, 0x2d, 0xc3, 0x28, 0x03, 0x15, + 0x3a, 0x55, 0x52, 0xee, 0x03, 0x47, 0xe6, 0xda, 0x0d, 0xbb, 0xb9, 0xde, 0x35, 0x85, 0x73, 0x45, + 0x36, 0xb2, 0x94, 0xa5, 0xb2, 0x27, 0x51, 0x86, 0x99, 0x5b, 0x6a, 0xd8, 0xcd, 0xcd, 0xd6, 0xf1, + 0x6c, 0x51, 0xb7, 0xde, 0x17, 0xf5, 0x1d, 0x73, 0x83, 0xe8, 0xdf, 0xf9, 0x29, 0x52, 0x16, 0xca, + 0xa1, 0xdf, 0xe1, 0xf2, 0xf5, 0xe5, 0x88, 0x14, 0xb3, 0x75, 0xb8, 0x7c, 0xfa, 0x7c, 0x3e, 0xb0, + 0xbb, 0x44, 0x4b, 0x6e, 0x94, 0xc3, 0x39, 0x23, 0x95, 0x01, 0x40, 0x2f, 0xe5, 0xee, 0x3f, 0x6d, + 0x0b, 0x0a, 0xdb, 0xde, 0x6f, 0xdb, 0x05, 0x24, 0x61, 0x3c, 0x6d, 0x43, 0xfc, 0xc3, 0xd9, 0x86, + 0xb8, 0x5b, 0x1e, 0x00, 0x74, 0xb8, 0x73, 0x4e, 0xd6, 0x94, 0x09, 0x27, 0xd2, 0xfd, 0xff, 0x57, + 0x95, 0x9a, 0xe5, 0x72, 0x22, 0x5b, 0xa7, 0xb3, 0xa5, 0x67, 0xcf, 0x97, 0x9e, 0xfd, 0xb1, 0xf4, + 0xec, 0xc7, 0x95, 0x67, 0xcd, 0x57, 0x9e, 0xf5, 0xb6, 0xf2, 0xac, 0xdb, 0xc3, 0x24, 0x95, 0xc3, + 0x49, 0xe4, 0xc7, 0xc8, 0x28, 0x72, 0x64, 0x53, 0xfd, 0x7c, 0x31, 0x66, 0xf4, 0x7b, 0x9d, 0xf7, + 0x7a, 0xa1, 0x72, 0x3a, 0x02, 0x11, 0x55, 0x34, 0x3d, 0xf9, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xe8, + 0xf0, 0x97, 0x09, 0xec, 0x01, 0x00, 0x00, +} + +func (m *Stablecoin) 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 *Stablecoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Stablecoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.FeeOut.Size() + i -= size + if _, err := m.FeeOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPsm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.FeeIn.Size() + i -= size + if _, err := m.FeeIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPsm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.LimitTotal.Size() + i -= size + if _, err := m.LimitTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPsm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintPsm(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPsm(dAtA []byte, offset int, v uint64) int { + offset -= sovPsm(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Stablecoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovPsm(uint64(l)) + } + l = m.LimitTotal.Size() + n += 1 + l + sovPsm(uint64(l)) + l = m.FeeIn.Size() + n += 1 + l + sovPsm(uint64(l)) + l = m.FeeOut.Size() + n += 1 + l + sovPsm(uint64(l)) + return n +} + +func sovPsm(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPsm(x uint64) (n int) { + return sovPsm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Stablecoin) 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 ErrIntOverflowPsm + } + 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: Stablecoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Stablecoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPsm + } + 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 ErrInvalidLengthPsm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPsm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPsm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPsm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPsm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LimitTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeIn", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPsm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPsm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPsm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeOut", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPsm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPsm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPsm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPsm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPsm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPsm(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, ErrIntOverflowPsm + } + 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, ErrIntOverflowPsm + } + 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, ErrIntOverflowPsm + } + 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, ErrInvalidLengthPsm + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPsm + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPsm + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPsm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPsm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPsm = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/query.pb.go b/x/psm/types/query.pb.go new file mode 100644 index 00000000..454d60ca --- /dev/null +++ b/x/psm/types/query.pb.go @@ -0,0 +1,1629 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/v1/query.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryStablecoinRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryStablecoinRequest) Reset() { *m = QueryStablecoinRequest{} } +func (m *QueryStablecoinRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStablecoinRequest) ProtoMessage() {} +func (*QueryStablecoinRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{2} +} +func (m *QueryStablecoinRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStablecoinRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStablecoinRequest.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 *QueryStablecoinRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStablecoinRequest.Merge(m, src) +} +func (m *QueryStablecoinRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStablecoinRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStablecoinRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStablecoinRequest proto.InternalMessageInfo + +func (m *QueryStablecoinRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryStablecoinResponse struct { + Stablecoin Stablecoin `protobuf:"bytes,1,opt,name=stablecoin,proto3" json:"stablecoin"` + CurrentTotal cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=current_total,json=currentTotal,proto3,customtype=cosmossdk.io/math.Int" json:"current_total"` + SwapableQuantity cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=swapable_quantity,json=swapableQuantity,proto3,customtype=cosmossdk.io/math.Int" json:"swapable_quantity"` +} + +func (m *QueryStablecoinResponse) Reset() { *m = QueryStablecoinResponse{} } +func (m *QueryStablecoinResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStablecoinResponse) ProtoMessage() {} +func (*QueryStablecoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{3} +} +func (m *QueryStablecoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStablecoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStablecoinResponse.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 *QueryStablecoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStablecoinResponse.Merge(m, src) +} +func (m *QueryStablecoinResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStablecoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStablecoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStablecoinResponse proto.InternalMessageInfo + +func (m *QueryStablecoinResponse) GetStablecoin() Stablecoin { + if m != nil { + return m.Stablecoin + } + return Stablecoin{} +} + +type QueryAllStablecoinRequest struct { +} + +func (m *QueryAllStablecoinRequest) Reset() { *m = QueryAllStablecoinRequest{} } +func (m *QueryAllStablecoinRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllStablecoinRequest) ProtoMessage() {} +func (*QueryAllStablecoinRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{4} +} +func (m *QueryAllStablecoinRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllStablecoinRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllStablecoinRequest.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 *QueryAllStablecoinRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStablecoinRequest.Merge(m, src) +} +func (m *QueryAllStablecoinRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllStablecoinRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStablecoinRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllStablecoinRequest proto.InternalMessageInfo + +type QueryAllStablecoinResponse struct { + AllStablecoinResponse []*StablecoinResponse `protobuf:"bytes,1,rep,name=all_stablecoin_response,json=allStablecoinResponse,proto3" json:"all_stablecoin_response,omitempty"` +} + +func (m *QueryAllStablecoinResponse) Reset() { *m = QueryAllStablecoinResponse{} } +func (m *QueryAllStablecoinResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllStablecoinResponse) ProtoMessage() {} +func (*QueryAllStablecoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{5} +} +func (m *QueryAllStablecoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllStablecoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllStablecoinResponse.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 *QueryAllStablecoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStablecoinResponse.Merge(m, src) +} +func (m *QueryAllStablecoinResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllStablecoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStablecoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllStablecoinResponse proto.InternalMessageInfo + +func (m *QueryAllStablecoinResponse) GetAllStablecoinResponse() []*StablecoinResponse { + if m != nil { + return m.AllStablecoinResponse + } + return nil +} + +type StablecoinResponse struct { + Stablecoin Stablecoin `protobuf:"bytes,1,opt,name=stablecoin,proto3" json:"stablecoin"` + CurrentTotal cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=current_total,json=currentTotal,proto3,customtype=cosmossdk.io/math.Int" json:"current_total"` + SwapableQuantity cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=swapable_quantity,json=swapableQuantity,proto3,customtype=cosmossdk.io/math.Int" json:"swapable_quantity"` +} + +func (m *StablecoinResponse) Reset() { *m = StablecoinResponse{} } +func (m *StablecoinResponse) String() string { return proto.CompactTextString(m) } +func (*StablecoinResponse) ProtoMessage() {} +func (*StablecoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46bfc761c6109b8c, []int{6} +} +func (m *StablecoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StablecoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StablecoinResponse.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 *StablecoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StablecoinResponse.Merge(m, src) +} +func (m *StablecoinResponse) XXX_Size() int { + return m.Size() +} +func (m *StablecoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StablecoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StablecoinResponse proto.InternalMessageInfo + +func (m *StablecoinResponse) GetStablecoin() Stablecoin { + if m != nil { + return m.Stablecoin + } + return Stablecoin{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "reserve.psm.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "reserve.psm.v1.QueryParamsResponse") + proto.RegisterType((*QueryStablecoinRequest)(nil), "reserve.psm.v1.QueryStablecoinRequest") + proto.RegisterType((*QueryStablecoinResponse)(nil), "reserve.psm.v1.QueryStablecoinResponse") + proto.RegisterType((*QueryAllStablecoinRequest)(nil), "reserve.psm.v1.QueryAllStablecoinRequest") + proto.RegisterType((*QueryAllStablecoinResponse)(nil), "reserve.psm.v1.QueryAllStablecoinResponse") + proto.RegisterType((*StablecoinResponse)(nil), "reserve.psm.v1.StablecoinResponse") +} + +func init() { proto.RegisterFile("reserve/psm/v1/query.proto", fileDescriptor_46bfc761c6109b8c) } + +var fileDescriptor_46bfc761c6109b8c = []byte{ + // 596 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, + 0x1c, 0x8d, 0x93, 0x6f, 0x23, 0xf5, 0xda, 0x7e, 0x45, 0x8f, 0xb4, 0x4d, 0x1c, 0xe4, 0x06, 0x83, + 0x4a, 0x88, 0x8a, 0x8f, 0x84, 0x89, 0x0d, 0x32, 0x20, 0x75, 0x6b, 0x03, 0x2c, 0x95, 0x50, 0x74, + 0x49, 0x4f, 0xae, 0x85, 0x7d, 0xe7, 0xf8, 0x2e, 0xa1, 0x99, 0x40, 0x6c, 0x48, 0x0c, 0x20, 0x06, + 0xfe, 0x05, 0x46, 0x06, 0xfe, 0x88, 0x8e, 0x15, 0x2c, 0x88, 0xa1, 0x42, 0x09, 0x12, 0xff, 0x06, + 0xf2, 0xdd, 0x85, 0x90, 0xd8, 0x85, 0x8a, 0x99, 0xc5, 0xba, 0xbb, 0xf7, 0x3e, 0xef, 0xf3, 0xfc, + 0xee, 0x07, 0x30, 0x23, 0xc2, 0x49, 0x34, 0x20, 0x28, 0xe4, 0x01, 0x1a, 0xd4, 0x51, 0xaf, 0x4f, + 0xa2, 0xa1, 0x13, 0x46, 0x4c, 0x30, 0xf8, 0xbf, 0xc6, 0x9c, 0x90, 0x07, 0xce, 0xa0, 0x6e, 0xae, + 0xe2, 0xc0, 0xa3, 0x0c, 0xc9, 0xaf, 0xa2, 0x98, 0x05, 0x97, 0xb9, 0x4c, 0x0e, 0x51, 0x3c, 0xd2, + 0xab, 0x97, 0x5c, 0xc6, 0x5c, 0x9f, 0x20, 0x1c, 0x7a, 0x08, 0x53, 0xca, 0x04, 0x16, 0x1e, 0xa3, + 0x5c, 0xa3, 0xb5, 0x2e, 0xe3, 0x01, 0xe3, 0xa8, 0x83, 0x39, 0x51, 0xfd, 0xd0, 0xa0, 0xde, 0x21, + 0x02, 0xd7, 0x51, 0x88, 0x5d, 0x8f, 0x4a, 0xb2, 0xe6, 0x96, 0xe7, 0xec, 0x85, 0x38, 0xc2, 0xc1, + 0x44, 0xa8, 0x38, 0x0f, 0xf2, 0x40, 0x23, 0x25, 0xd5, 0xa2, 0xad, 0x9c, 0xa9, 0x89, 0x82, 0xec, + 0x02, 0x80, 0x7b, 0x71, 0xcf, 0x5d, 0xa9, 0xd4, 0x22, 0xbd, 0x3e, 0xe1, 0xc2, 0xde, 0x05, 0x17, + 0x67, 0x56, 0x79, 0xc8, 0x28, 0x27, 0xf0, 0x36, 0xc8, 0xab, 0x8e, 0x45, 0xa3, 0x62, 0x54, 0x97, + 0x1a, 0xeb, 0xce, 0x6c, 0x24, 0x8e, 0xe2, 0x37, 0x17, 0x8f, 0x4f, 0x37, 0x33, 0xef, 0xbe, 0xbf, + 0xaf, 0x19, 0x2d, 0x5d, 0x60, 0x3b, 0x60, 0x5d, 0x2a, 0xde, 0x17, 0xb8, 0xe3, 0x93, 0x2e, 0xf3, + 0xa8, 0xee, 0x05, 0x0b, 0x60, 0xe1, 0x80, 0x50, 0x16, 0x48, 0xcd, 0xc5, 0x96, 0x9a, 0xd8, 0xaf, + 0xb3, 0x60, 0x23, 0x51, 0xa0, 0x6d, 0xdc, 0x01, 0x80, 0xff, 0x5c, 0xd5, 0x56, 0xcc, 0x79, 0x2b, + 0xd3, 0xba, 0xe6, 0x7f, 0xb1, 0x9d, 0xd6, 0x2f, 0x35, 0xf0, 0x21, 0x58, 0xe9, 0xf6, 0xa3, 0x88, + 0x50, 0xd1, 0x16, 0x4c, 0x60, 0xbf, 0x98, 0xad, 0x18, 0xd5, 0xe5, 0xe6, 0xcd, 0x98, 0xf8, 0xe5, + 0x74, 0x73, 0x4d, 0x45, 0xc4, 0x0f, 0x1e, 0x3b, 0x1e, 0x43, 0x01, 0x16, 0x87, 0xce, 0x0e, 0x15, + 0x1f, 0x3f, 0xdc, 0x00, 0x3a, 0xbb, 0x1d, 0x2a, 0xd4, 0xef, 0x2d, 0x6b, 0x99, 0x07, 0xb1, 0x0a, + 0x7c, 0x04, 0x56, 0xf9, 0x13, 0x1c, 0xc6, 0x6d, 0xda, 0xbd, 0x3e, 0xa6, 0xc2, 0x13, 0xc3, 0x62, + 0xee, 0x2f, 0xa5, 0x2f, 0x4c, 0xa4, 0xf6, 0xb4, 0x92, 0x5d, 0x06, 0x25, 0x19, 0xc9, 0x5d, 0xdf, + 0x4f, 0xc4, 0x68, 0x1f, 0x01, 0x33, 0x0d, 0xd4, 0x91, 0xed, 0x83, 0x0d, 0xec, 0xfb, 0xed, 0x69, + 0x04, 0xed, 0x48, 0x43, 0x45, 0xa3, 0x92, 0xab, 0x2e, 0x35, 0xec, 0xb3, 0xf3, 0x9b, 0x88, 0xb4, + 0xd6, 0x70, 0x9a, 0xb6, 0xfd, 0x32, 0x0b, 0xe0, 0xbf, 0x5d, 0x9a, 0xec, 0x52, 0xe3, 0x6d, 0x0e, + 0x2c, 0xc8, 0x9d, 0x80, 0x4f, 0x41, 0x5e, 0x5d, 0x08, 0x98, 0x48, 0x37, 0x79, 0xe7, 0xcc, 0x2b, + 0xbf, 0xe5, 0xe8, 0xac, 0xb7, 0x9f, 0x7f, 0xfa, 0xf6, 0x26, 0xbb, 0x05, 0xaf, 0x22, 0x46, 0x59, + 0x30, 0x94, 0x77, 0xb8, 0xcb, 0x7c, 0x94, 0xfa, 0x2e, 0xc0, 0x67, 0x06, 0x00, 0xd3, 0x84, 0xe1, + 0x56, 0x6a, 0x87, 0xc4, 0x51, 0x32, 0xaf, 0xfd, 0x91, 0xa7, 0xdd, 0x5c, 0x96, 0x6e, 0xca, 0xb0, + 0x34, 0xe7, 0x66, 0xfa, 0x00, 0xc1, 0x17, 0x06, 0x58, 0x99, 0x39, 0x92, 0xf0, 0x7a, 0xaa, 0x7a, + 0xda, 0x99, 0x36, 0x6b, 0xe7, 0xa1, 0x9e, 0xdb, 0x4b, 0xf3, 0xde, 0xf1, 0xc8, 0x32, 0x4e, 0x46, + 0x96, 0xf1, 0x75, 0x64, 0x19, 0xaf, 0xc6, 0x56, 0xe6, 0x64, 0x6c, 0x65, 0x3e, 0x8f, 0xad, 0xcc, + 0xfe, 0xb6, 0xeb, 0x89, 0xc3, 0x7e, 0xc7, 0xe9, 0xb2, 0xe0, 0x8c, 0x60, 0x8f, 0xa4, 0x90, 0x18, + 0x86, 0x84, 0x77, 0xf2, 0x12, 0xbd, 0xf5, 0x23, 0x00, 0x00, 0xff, 0xff, 0x92, 0x1d, 0x48, 0x92, + 0x2d, 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Stablecoin(ctx context.Context, in *QueryStablecoinRequest, opts ...grpc.CallOption) (*QueryStablecoinResponse, error) + AllStablecoin(ctx context.Context, in *QueryAllStablecoinRequest, opts ...grpc.CallOption) (*QueryAllStablecoinResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Stablecoin(ctx context.Context, in *QueryStablecoinRequest, opts ...grpc.CallOption) (*QueryStablecoinResponse, error) { + out := new(QueryStablecoinResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Query/Stablecoin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllStablecoin(ctx context.Context, in *QueryAllStablecoinRequest, opts ...grpc.CallOption) (*QueryAllStablecoinResponse, error) { + out := new(QueryAllStablecoinResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Query/AllStablecoin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Stablecoin(context.Context, *QueryStablecoinRequest) (*QueryStablecoinResponse, error) + AllStablecoin(context.Context, *QueryAllStablecoinRequest) (*QueryAllStablecoinResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Stablecoin(ctx context.Context, req *QueryStablecoinRequest) (*QueryStablecoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stablecoin not implemented") +} +func (*UnimplementedQueryServer) AllStablecoin(ctx context.Context, req *QueryAllStablecoinRequest) (*QueryAllStablecoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllStablecoin not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Stablecoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStablecoinRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Stablecoin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Query/Stablecoin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Stablecoin(ctx, req.(*QueryStablecoinRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllStablecoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllStablecoinRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllStablecoin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Query/AllStablecoin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllStablecoin(ctx, req.(*QueryAllStablecoinRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.psm.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Stablecoin", + Handler: _Query_Stablecoin_Handler, + }, + { + MethodName: "AllStablecoin", + Handler: _Query_AllStablecoin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/psm/v1/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryStablecoinRequest) 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 *QueryStablecoinRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStablecoinRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryStablecoinResponse) 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 *QueryStablecoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStablecoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SwapableQuantity.Size() + i -= size + if _, err := m.SwapableQuantity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.CurrentTotal.Size() + i -= size + if _, err := m.CurrentTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Stablecoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllStablecoinRequest) 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 *QueryAllStablecoinRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllStablecoinRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllStablecoinResponse) 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 *QueryAllStablecoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllStablecoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllStablecoinResponse) > 0 { + for iNdEx := len(m.AllStablecoinResponse) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllStablecoinResponse[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StablecoinResponse) 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 *StablecoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StablecoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SwapableQuantity.Size() + i -= size + if _, err := m.SwapableQuantity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.CurrentTotal.Size() + i -= size + if _, err := m.CurrentTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Stablecoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryStablecoinRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStablecoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Stablecoin.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.CurrentTotal.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.SwapableQuantity.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllStablecoinRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllStablecoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllStablecoinResponse) > 0 { + for _, e := range m.AllStablecoinResponse { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *StablecoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Stablecoin.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.CurrentTotal.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.SwapableQuantity.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryStablecoinRequest) 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 ErrIntOverflowQuery + } + 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: QueryStablecoinRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStablecoinRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryStablecoinResponse) 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 ErrIntOverflowQuery + } + 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: QueryStablecoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStablecoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stablecoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stablecoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapableQuantity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapableQuantity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllStablecoinRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllStablecoinRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllStablecoinRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllStablecoinResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllStablecoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllStablecoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllStablecoinResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllStablecoinResponse = append(m.AllStablecoinResponse, &StablecoinResponse{}) + if err := m.AllStablecoinResponse[len(m.AllStablecoinResponse)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StablecoinResponse) 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 ErrIntOverflowQuery + } + 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: StablecoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StablecoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stablecoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stablecoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapableQuantity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapableQuantity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/query.pb.gw.go b/x/psm/types/query.pb.gw.go new file mode 100644 index 00000000..486ebf7a --- /dev/null +++ b/x/psm/types/query.pb.gw.go @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: reserve/psm/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Stablecoin_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Stablecoin_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStablecoinRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Stablecoin_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Stablecoin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Stablecoin_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStablecoinRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Stablecoin_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Stablecoin(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllStablecoin_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStablecoinRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllStablecoin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllStablecoin_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStablecoinRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllStablecoin(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Stablecoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Stablecoin_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Stablecoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllStablecoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllStablecoin_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllStablecoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Stablecoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Stablecoin_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Stablecoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllStablecoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AllStablecoin_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllStablecoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"onomyprotocol", "reserve", "psm", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Stablecoin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"onomyprotocol", "psm", "v1"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllStablecoin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"onomyprotocol", "psm", "v1"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Stablecoin_0 = runtime.ForwardResponseMessage + + forward_Query_AllStablecoin_0 = runtime.ForwardResponseMessage +) diff --git a/x/psm/types/tx.pb.go b/x/psm/types/tx.pb.go new file mode 100644 index 00000000..b5546a6f --- /dev/null +++ b/x/psm/types/tx.pb.go @@ -0,0 +1,2460 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/psm/v1/tx.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +type MsgSwapTonomUSD struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Coin *types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin,omitempty"` +} + +func (m *MsgSwapTonomUSD) Reset() { *m = MsgSwapTonomUSD{} } +func (m *MsgSwapTonomUSD) String() string { return proto.CompactTextString(m) } +func (*MsgSwapTonomUSD) ProtoMessage() {} +func (*MsgSwapTonomUSD) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{2} +} +func (m *MsgSwapTonomUSD) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapTonomUSD) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapTonomUSD.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 *MsgSwapTonomUSD) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapTonomUSD.Merge(m, src) +} +func (m *MsgSwapTonomUSD) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapTonomUSD) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapTonomUSD.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapTonomUSD proto.InternalMessageInfo + +func (m *MsgSwapTonomUSD) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *MsgSwapTonomUSD) GetCoin() *types.Coin { + if m != nil { + return m.Coin + } + return nil +} + +type MsgSwapTonomUSDResponse struct { +} + +func (m *MsgSwapTonomUSDResponse) Reset() { *m = MsgSwapTonomUSDResponse{} } +func (m *MsgSwapTonomUSDResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapTonomUSDResponse) ProtoMessage() {} +func (*MsgSwapTonomUSDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{3} +} +func (m *MsgSwapTonomUSDResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapTonomUSDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapTonomUSDResponse.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 *MsgSwapTonomUSDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapTonomUSDResponse.Merge(m, src) +} +func (m *MsgSwapTonomUSDResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapTonomUSDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapTonomUSDResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapTonomUSDResponse proto.InternalMessageInfo + +type MsgSwapToStablecoin struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + ToDenom string `protobuf:"bytes,2,opt,name=to_denom,json=toDenom,proto3" json:"to_denom,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` +} + +func (m *MsgSwapToStablecoin) Reset() { *m = MsgSwapToStablecoin{} } +func (m *MsgSwapToStablecoin) String() string { return proto.CompactTextString(m) } +func (*MsgSwapToStablecoin) ProtoMessage() {} +func (*MsgSwapToStablecoin) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{4} +} +func (m *MsgSwapToStablecoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapToStablecoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapToStablecoin.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 *MsgSwapToStablecoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapToStablecoin.Merge(m, src) +} +func (m *MsgSwapToStablecoin) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapToStablecoin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapToStablecoin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapToStablecoin proto.InternalMessageInfo + +func (m *MsgSwapToStablecoin) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *MsgSwapToStablecoin) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type MsgSwapToStablecoinResponse struct { +} + +func (m *MsgSwapToStablecoinResponse) Reset() { *m = MsgSwapToStablecoinResponse{} } +func (m *MsgSwapToStablecoinResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapToStablecoinResponse) ProtoMessage() {} +func (*MsgSwapToStablecoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{5} +} +func (m *MsgSwapToStablecoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapToStablecoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapToStablecoinResponse.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 *MsgSwapToStablecoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapToStablecoinResponse.Merge(m, src) +} +func (m *MsgSwapToStablecoinResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapToStablecoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapToStablecoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapToStablecoinResponse proto.InternalMessageInfo + +type MsgAddStableCoin struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + LimitTotal cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=limit_total,json=limitTotal,proto3,customtype=cosmossdk.io/math.Int" json:"limit_total"` + FeeIn cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=fee_in,json=feeIn,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_in"` + FeeOut cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=fee_out,json=feeOut,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_out"` +} + +func (m *MsgAddStableCoin) Reset() { *m = MsgAddStableCoin{} } +func (m *MsgAddStableCoin) String() string { return proto.CompactTextString(m) } +func (*MsgAddStableCoin) ProtoMessage() {} +func (*MsgAddStableCoin) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{6} +} +func (m *MsgAddStableCoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddStableCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddStableCoin.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 *MsgAddStableCoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddStableCoin.Merge(m, src) +} +func (m *MsgAddStableCoin) XXX_Size() int { + return m.Size() +} +func (m *MsgAddStableCoin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddStableCoin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddStableCoin proto.InternalMessageInfo + +func (m *MsgAddStableCoin) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddStableCoin) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type MsgAddStableCoinResponse struct { +} + +func (m *MsgAddStableCoinResponse) Reset() { *m = MsgAddStableCoinResponse{} } +func (m *MsgAddStableCoinResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddStableCoinResponse) ProtoMessage() {} +func (*MsgAddStableCoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{7} +} +func (m *MsgAddStableCoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddStableCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddStableCoinResponse.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 *MsgAddStableCoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddStableCoinResponse.Merge(m, src) +} +func (m *MsgAddStableCoinResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddStableCoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddStableCoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddStableCoinResponse proto.InternalMessageInfo + +type MsgUpdatesStableCoin struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + LimitTotal cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=limit_total,json=limitTotal,proto3,customtype=cosmossdk.io/math.Int" json:"limit_total"` + FeeIn cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=fee_in,json=feeIn,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_in"` + FeeOut cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=fee_out,json=feeOut,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fee_out"` +} + +func (m *MsgUpdatesStableCoin) Reset() { *m = MsgUpdatesStableCoin{} } +func (m *MsgUpdatesStableCoin) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesStableCoin) ProtoMessage() {} +func (*MsgUpdatesStableCoin) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{8} +} +func (m *MsgUpdatesStableCoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesStableCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesStableCoin.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 *MsgUpdatesStableCoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesStableCoin.Merge(m, src) +} +func (m *MsgUpdatesStableCoin) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesStableCoin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesStableCoin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesStableCoin proto.InternalMessageInfo + +func (m *MsgUpdatesStableCoin) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdatesStableCoin) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type MsgUpdatesStableCoinResponse struct { +} + +func (m *MsgUpdatesStableCoinResponse) Reset() { *m = MsgUpdatesStableCoinResponse{} } +func (m *MsgUpdatesStableCoinResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesStableCoinResponse) ProtoMessage() {} +func (*MsgUpdatesStableCoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d0ff2d5421e71e2a, []int{9} +} +func (m *MsgUpdatesStableCoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesStableCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesStableCoinResponse.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 *MsgUpdatesStableCoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesStableCoinResponse.Merge(m, src) +} +func (m *MsgUpdatesStableCoinResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesStableCoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesStableCoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesStableCoinResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "reserve.psm.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.psm.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSwapTonomUSD)(nil), "reserve.psm.v1.MsgSwapTonomUSD") + proto.RegisterType((*MsgSwapTonomUSDResponse)(nil), "reserve.psm.v1.MsgSwapTonomUSDResponse") + proto.RegisterType((*MsgSwapToStablecoin)(nil), "reserve.psm.v1.MsgSwapToStablecoin") + proto.RegisterType((*MsgSwapToStablecoinResponse)(nil), "reserve.psm.v1.MsgSwapToStablecoinResponse") + proto.RegisterType((*MsgAddStableCoin)(nil), "reserve.psm.v1.MsgAddStableCoin") + proto.RegisterType((*MsgAddStableCoinResponse)(nil), "reserve.psm.v1.MsgAddStableCoinResponse") + proto.RegisterType((*MsgUpdatesStableCoin)(nil), "reserve.psm.v1.MsgUpdatesStableCoin") + proto.RegisterType((*MsgUpdatesStableCoinResponse)(nil), "reserve.psm.v1.MsgUpdatesStableCoinResponse") +} + +func init() { proto.RegisterFile("reserve/psm/v1/tx.proto", fileDescriptor_d0ff2d5421e71e2a) } + +var fileDescriptor_d0ff2d5421e71e2a = []byte{ + // 750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xc1, 0x4e, 0xdb, 0x4a, + 0x14, 0x8d, 0x09, 0x81, 0x97, 0x21, 0x7a, 0x8f, 0xe7, 0x86, 0xe2, 0x98, 0x62, 0xa2, 0xb4, 0x52, + 0x23, 0x0a, 0x36, 0xa1, 0x6a, 0xa5, 0xb2, 0x23, 0x8d, 0xaa, 0x52, 0x15, 0x95, 0x26, 0x20, 0xa1, + 0x6e, 0xa2, 0x89, 0x3d, 0x38, 0x56, 0x63, 0x8f, 0xe5, 0x99, 0xa4, 0x64, 0x57, 0x55, 0x5d, 0x75, + 0xd5, 0x6f, 0xe8, 0xaa, 0x4b, 0x16, 0xa8, 0xdf, 0xc0, 0x12, 0xb1, 0xaa, 0xba, 0x40, 0x15, 0x2c, + 0xf8, 0x09, 0x16, 0xd5, 0xd8, 0x13, 0x13, 0x3b, 0xa1, 0x20, 0xba, 0xed, 0x26, 0xca, 0xcc, 0x3d, + 0xf7, 0xdc, 0x73, 0xcf, 0x5c, 0x5d, 0x83, 0x69, 0x0f, 0x11, 0xe4, 0x75, 0x90, 0xe6, 0x12, 0x5b, + 0xeb, 0x94, 0x34, 0xba, 0xab, 0xba, 0x1e, 0xa6, 0x58, 0xfc, 0x97, 0x07, 0x54, 0x97, 0xd8, 0x6a, + 0xa7, 0x24, 0xff, 0x0f, 0x6d, 0xcb, 0xc1, 0x9a, 0xff, 0x1b, 0x40, 0xe4, 0x69, 0x1d, 0x13, 0x1b, + 0x13, 0xcd, 0x26, 0x26, 0x4b, 0xb5, 0x89, 0xc9, 0x03, 0xb9, 0x20, 0x50, 0xf7, 0x4f, 0x5a, 0x70, + 0xe0, 0xa1, 0xac, 0x89, 0x4d, 0x1c, 0xdc, 0xb3, 0x7f, 0xfc, 0x76, 0x26, 0xa6, 0xc2, 0x85, 0x1e, + 0xb4, 0x7b, 0x29, 0x0a, 0x2f, 0xd3, 0x80, 0x04, 0x69, 0x9d, 0x52, 0x03, 0x51, 0x58, 0xd2, 0x74, + 0x6c, 0x39, 0x41, 0xbc, 0xf0, 0x4d, 0x00, 0xff, 0xad, 0x13, 0x73, 0xcb, 0x35, 0x20, 0x45, 0x1b, + 0x7e, 0xa6, 0xf8, 0x18, 0xa4, 0x61, 0x9b, 0x36, 0xb1, 0x67, 0xd1, 0xae, 0x24, 0xe4, 0x85, 0x62, + 0xba, 0x2c, 0x1d, 0xed, 0x2f, 0x66, 0xb9, 0x96, 0x55, 0xc3, 0xf0, 0x10, 0x21, 0x35, 0xea, 0x59, + 0x8e, 0x59, 0xbd, 0x80, 0x8a, 0x4f, 0xc0, 0x58, 0x50, 0x5b, 0x1a, 0xc9, 0x0b, 0xc5, 0x89, 0xe5, + 0xdb, 0x6a, 0xd4, 0x06, 0x35, 0xe0, 0x2f, 0xa7, 0x0f, 0x8e, 0xe7, 0x12, 0x5f, 0xcf, 0xf6, 0xe6, + 0x85, 0x2a, 0x4f, 0x58, 0x59, 0xfa, 0x70, 0xb6, 0x37, 0x7f, 0x41, 0xf5, 0xe9, 0x6c, 0x6f, 0x7e, + 0xb6, 0xd7, 0xd6, 0xae, 0xdf, 0x58, 0x4c, 0x64, 0x21, 0x07, 0xa6, 0x63, 0x57, 0x55, 0x44, 0x5c, + 0xec, 0x10, 0x54, 0x68, 0xfa, 0x2d, 0xd5, 0xde, 0x41, 0x77, 0x13, 0x3b, 0xd8, 0xde, 0xaa, 0x55, + 0x44, 0x09, 0x8c, 0xc3, 0x40, 0x76, 0xd0, 0x50, 0xb5, 0x77, 0x14, 0x17, 0xc1, 0x28, 0xb3, 0x83, + 0x4b, 0xce, 0xa9, 0xbc, 0x49, 0xe6, 0x97, 0xca, 0xfd, 0x52, 0x9f, 0x62, 0xcb, 0xa9, 0xfa, 0xb0, + 0x95, 0x0c, 0x13, 0xda, 0x4b, 0xe6, 0x22, 0xfa, 0x2b, 0x85, 0x22, 0xbe, 0x08, 0xe0, 0x56, 0x18, + 0xab, 0x51, 0xd8, 0x68, 0x21, 0x46, 0xf0, 0x1b, 0x25, 0x39, 0xf0, 0x0f, 0xc5, 0x75, 0x03, 0x39, + 0xd8, 0xf6, 0xd5, 0xa4, 0xab, 0xe3, 0x14, 0x57, 0xd8, 0x51, 0x7c, 0x0e, 0xc6, 0xa0, 0x8d, 0xdb, + 0x0e, 0x95, 0x92, 0x79, 0xa1, 0x98, 0x29, 0x2f, 0x31, 0x07, 0x7f, 0x1c, 0xcf, 0x4d, 0x05, 0x6a, + 0x89, 0xf1, 0x56, 0xb5, 0xb0, 0x66, 0x43, 0xda, 0x54, 0xd7, 0x1c, 0x7a, 0xb4, 0xbf, 0x08, 0x78, + 0x1b, 0x6b, 0x0e, 0xe5, 0x46, 0x07, 0xf9, 0x31, 0xfd, 0xb3, 0x60, 0x66, 0x88, 0xc6, 0xb0, 0x87, + 0xf3, 0x11, 0x30, 0xb9, 0x4e, 0xcc, 0x55, 0xc3, 0x08, 0x82, 0xcc, 0x87, 0x1b, 0x4f, 0x47, 0x16, + 0xa4, 0xfa, 0x7b, 0x0b, 0x0e, 0xe2, 0x6b, 0x30, 0xd1, 0xb2, 0x6c, 0x8b, 0xd6, 0x29, 0xa6, 0xb0, + 0x75, 0xe3, 0xf6, 0x80, 0x4f, 0xb2, 0xc9, 0x38, 0x98, 0x59, 0x3b, 0x08, 0xd5, 0x2d, 0x47, 0x1a, + 0xf5, 0xd9, 0x4a, 0x9c, 0x6d, 0x66, 0x90, 0xed, 0x25, 0x32, 0xa1, 0xde, 0xad, 0x20, 0xbd, 0x8f, + 0xb3, 0x82, 0xf4, 0x6a, 0x6a, 0x07, 0xa1, 0x35, 0x47, 0x7c, 0x01, 0xc6, 0x19, 0x13, 0x6e, 0x53, + 0x29, 0x75, 0x53, 0x2a, 0xa6, 0xe5, 0x55, 0x9b, 0xae, 0x94, 0x06, 0x27, 0x5c, 0x19, 0x98, 0xf0, + 0x88, 0xd3, 0x05, 0x19, 0x48, 0xf1, 0xbb, 0xf0, 0x69, 0x3e, 0x26, 0x41, 0x36, 0x9c, 0x7f, 0xf2, + 0xf7, 0x79, 0xfe, 0xf4, 0x79, 0x1e, 0x0d, 0x3e, 0x4f, 0xe1, 0x92, 0x05, 0xd4, 0xe7, 0x76, 0x41, + 0x01, 0x77, 0x86, 0xdd, 0xf7, 0x9e, 0x69, 0xf9, 0x3c, 0x09, 0x92, 0xeb, 0xc4, 0x14, 0xb7, 0x41, + 0x26, 0xb2, 0x62, 0xe7, 0xe2, 0xab, 0x31, 0xb6, 0xcb, 0xe4, 0xfb, 0x57, 0x00, 0x7a, 0x15, 0x44, + 0x1d, 0x4c, 0x45, 0x26, 0x64, 0xc3, 0xc3, 0x2e, 0x26, 0xb0, 0x25, 0xe6, 0x87, 0x30, 0x44, 0x90, + 0x72, 0xf1, 0x2a, 0x44, 0x58, 0x04, 0x83, 0xdc, 0x40, 0x8f, 0x61, 0xa1, 0x7b, 0x97, 0x4a, 0xed, + 0x43, 0xcb, 0x0b, 0xd7, 0x41, 0x85, 0x05, 0xb7, 0x41, 0x26, 0xb2, 0xbf, 0x87, 0xf9, 0xd5, 0x0f, + 0x18, 0xea, 0xd7, 0xb0, 0xbd, 0x2c, 0x1a, 0x60, 0x72, 0x60, 0x27, 0xdf, 0xbd, 0x34, 0xf9, 0x02, + 0x24, 0x3f, 0xb8, 0x06, 0xa8, 0x57, 0x45, 0x4e, 0xbd, 0x67, 0x73, 0x5f, 0x7e, 0x76, 0x70, 0xa2, + 0x08, 0x87, 0x27, 0x8a, 0xf0, 0xf3, 0x44, 0x11, 0x3e, 0x9f, 0x2a, 0x89, 0xc3, 0x53, 0x25, 0xf1, + 0xfd, 0x54, 0x49, 0xbc, 0x59, 0x30, 0x2d, 0xda, 0x6c, 0x37, 0x54, 0x1d, 0xdb, 0x1a, 0x93, 0xd8, + 0xf5, 0x3f, 0xc7, 0x3a, 0x6e, 0x69, 0xd1, 0xa9, 0xa3, 0x5d, 0x17, 0x91, 0xc6, 0x98, 0x1f, 0x7d, + 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x63, 0xf9, 0xdb, 0x71, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + AddStableCoinProposal(ctx context.Context, in *MsgAddStableCoin, opts ...grpc.CallOption) (*MsgAddStableCoinResponse, error) + UpdatesStableCoinProposal(ctx context.Context, in *MsgUpdatesStableCoin, opts ...grpc.CallOption) (*MsgUpdatesStableCoinResponse, error) + SwapTonomUSD(ctx context.Context, in *MsgSwapTonomUSD, opts ...grpc.CallOption) (*MsgSwapTonomUSDResponse, error) + SwapToStablecoin(ctx context.Context, in *MsgSwapToStablecoin, opts ...grpc.CallOption) (*MsgSwapToStablecoinResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AddStableCoinProposal(ctx context.Context, in *MsgAddStableCoin, opts ...grpc.CallOption) (*MsgAddStableCoinResponse, error) { + out := new(MsgAddStableCoinResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Msg/AddStableCoinProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdatesStableCoinProposal(ctx context.Context, in *MsgUpdatesStableCoin, opts ...grpc.CallOption) (*MsgUpdatesStableCoinResponse, error) { + out := new(MsgUpdatesStableCoinResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Msg/UpdatesStableCoinProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapTonomUSD(ctx context.Context, in *MsgSwapTonomUSD, opts ...grpc.CallOption) (*MsgSwapTonomUSDResponse, error) { + out := new(MsgSwapTonomUSDResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Msg/SwapTonomUSD", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapToStablecoin(ctx context.Context, in *MsgSwapToStablecoin, opts ...grpc.CallOption) (*MsgSwapToStablecoinResponse, error) { + out := new(MsgSwapToStablecoinResponse) + err := c.cc.Invoke(ctx, "/reserve.psm.v1.Msg/SwapToStablecoin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + AddStableCoinProposal(context.Context, *MsgAddStableCoin) (*MsgAddStableCoinResponse, error) + UpdatesStableCoinProposal(context.Context, *MsgUpdatesStableCoin) (*MsgUpdatesStableCoinResponse, error) + SwapTonomUSD(context.Context, *MsgSwapTonomUSD) (*MsgSwapTonomUSDResponse, error) + SwapToStablecoin(context.Context, *MsgSwapToStablecoin) (*MsgSwapToStablecoinResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) AddStableCoinProposal(ctx context.Context, req *MsgAddStableCoin) (*MsgAddStableCoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddStableCoinProposal not implemented") +} +func (*UnimplementedMsgServer) UpdatesStableCoinProposal(ctx context.Context, req *MsgUpdatesStableCoin) (*MsgUpdatesStableCoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatesStableCoinProposal not implemented") +} +func (*UnimplementedMsgServer) SwapTonomUSD(ctx context.Context, req *MsgSwapTonomUSD) (*MsgSwapTonomUSDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapTonomUSD not implemented") +} +func (*UnimplementedMsgServer) SwapToStablecoin(ctx context.Context, req *MsgSwapToStablecoin) (*MsgSwapToStablecoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapToStablecoin not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AddStableCoinProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddStableCoin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddStableCoinProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Msg/AddStableCoinProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddStableCoinProposal(ctx, req.(*MsgAddStableCoin)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdatesStableCoinProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdatesStableCoin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdatesStableCoinProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Msg/UpdatesStableCoinProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdatesStableCoinProposal(ctx, req.(*MsgUpdatesStableCoin)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapTonomUSD_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapTonomUSD) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapTonomUSD(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Msg/SwapTonomUSD", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapTonomUSD(ctx, req.(*MsgSwapTonomUSD)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapToStablecoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapToStablecoin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapToStablecoin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.psm.v1.Msg/SwapToStablecoin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapToStablecoin(ctx, req.(*MsgSwapToStablecoin)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.psm.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "AddStableCoinProposal", + Handler: _Msg_AddStableCoinProposal_Handler, + }, + { + MethodName: "UpdatesStableCoinProposal", + Handler: _Msg_UpdatesStableCoinProposal_Handler, + }, + { + MethodName: "SwapTonomUSD", + Handler: _Msg_SwapTonomUSD_Handler, + }, + { + MethodName: "SwapToStablecoin", + Handler: _Msg_SwapToStablecoin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/psm/v1/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSwapTonomUSD) 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 *MsgSwapTonomUSD) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapTonomUSD) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Coin != nil { + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapTonomUSDResponse) 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 *MsgSwapTonomUSDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapTonomUSDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSwapToStablecoin) 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 *MsgSwapToStablecoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapToStablecoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + 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] = 0x1a + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapToStablecoinResponse) 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 *MsgSwapToStablecoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapToStablecoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgAddStableCoin) 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 *MsgAddStableCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddStableCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.FeeOut.Size() + i -= size + if _, err := m.FeeOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.FeeIn.Size() + i -= size + if _, err := m.FeeIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.LimitTotal.Size() + i -= size + if _, err := m.LimitTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddStableCoinResponse) 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 *MsgAddStableCoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddStableCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdatesStableCoin) 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 *MsgUpdatesStableCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesStableCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.FeeOut.Size() + i -= size + if _, err := m.FeeOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.FeeIn.Size() + i -= size + if _, err := m.FeeIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.LimitTotal.Size() + i -= size + if _, err := m.LimitTotal.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdatesStableCoinResponse) 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 *MsgUpdatesStableCoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesStableCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSwapTonomUSD) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Coin != nil { + l = m.Coin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapTonomUSDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSwapToStablecoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSwapToStablecoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddStableCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.LimitTotal.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.FeeIn.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.FeeOut.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgAddStableCoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdatesStableCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.LimitTotal.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.FeeIn.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.FeeOut.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdatesStableCoinResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 + } + if err := m.Params.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 (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgSwapTonomUSD) 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: MsgSwapTonomUSD: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapTonomUSD: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", 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 + } + if m.Coin == nil { + m.Coin = &types.Coin{} + } + if err := m.Coin.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 (m *MsgSwapTonomUSDResponse) 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: MsgSwapTonomUSDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapTonomUSDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgSwapToStablecoin) 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: MsgSwapToStablecoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapToStablecoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.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 (m *MsgSwapToStablecoinResponse) 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: MsgSwapToStablecoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapToStablecoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgAddStableCoin) 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: MsgAddStableCoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddStableCoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LimitTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeIn", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeOut", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeOut.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 (m *MsgAddStableCoinResponse) 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: MsgAddStableCoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddStableCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgUpdatesStableCoin) 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: MsgUpdatesStableCoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatesStableCoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitTotal", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LimitTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeIn", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeOut", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeOut.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 (m *MsgUpdatesStableCoinResponse) 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: MsgUpdatesStableCoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatesStableCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/psm/types/types.go b/x/psm/types/types.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/x/psm/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/vaults/cli/query.go b/x/vaults/cli/query.go new file mode 100644 index 00000000..512bb206 --- /dev/null +++ b/x/vaults/cli/query.go @@ -0,0 +1,102 @@ +package cli + +import ( + "context" + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, // nolint:gomnd + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryAllCollateral()) + cmd.AddCommand(CmdQueryAllVaults()) + cmd.AddCommand(CmdQueryVault()) + return cmd +} + +func CmdQueryAllCollateral() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-collateral", + Short: "show all collateral", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryAllCollateral(context.Background(), &types.QueryAllCollateralRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} +func CmdQueryAllVaults() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-vaults", + Short: "show all vaults", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryAllVaults(context.Background(), &types.QueryAllVaultsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} +func CmdQueryVault() *cobra.Command { + cmd := &cobra.Command{ + Use: "vault [vault-id]", + Short: "show vault from id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + msg := types.QueryVaultIdRequest{ + VaultId: vaultID, + } + + res, err := queryClient.QueryVaults(context.Background(), &msg) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/vaults/cli/tx.go b/x/vaults/cli/tx.go new file mode 100644 index 00000000..bf423dd0 --- /dev/null +++ b/x/vaults/cli/tx.go @@ -0,0 +1,233 @@ +package cli + +import ( + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, // nolint:gomnd + RunE: client.ValidateCmd, + } + + cmd.AddCommand(NewCreateVaultCmd()) + cmd.AddCommand(NewDepositCmd()) + cmd.AddCommand(NewWithdrawCmd()) + cmd.AddCommand(NewCloseCmd()) + cmd.AddCommand(NewRepayCmd()) + cmd.AddCommand(NewMintCmd()) + + return cmd +} + +func NewCreateVaultCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-vault [collateral] [minted]", + Args: cobra.ExactArgs(2), + Short: "create vaults ", + Long: `create vaults. + + Example: + $ onomyd tx vautls create-vault 1000atom 8000nomUSD --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + collateral, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + minted, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + msg := types.NewMsgCreateVault(addr.String(), collateral, minted) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewDepositCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "deposit [vault-id] [amount]", + Args: cobra.ExactArgs(2), + Short: "deposit ", + Long: `deposit. + + Example: + $ onomyd tx vaults 1 1000atom --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgDeposit(vaultID, addr.String(), amount) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewWithdrawCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "withdraw [vault-id] [amount]", + Args: cobra.ExactArgs(2), + Short: "withdraw ", + Long: `withdraw. + + Example: + $ onomyd tx withdraw 1 1000atom --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgWithdraw(vaultID, addr.String(), amount) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewMintCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint [vault-id] [amount]", + Args: cobra.ExactArgs(2), + Short: "mint ", + Long: `mint. + + Example: + $ onomyd tx mint 1 1000atom --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgMint(vaultID, addr.String(), amount) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewRepayCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "repay [vault-id] [amount]", + Args: cobra.ExactArgs(2), + Short: "repay ", + Long: `repay. + + Example: + $ onomyd tx repay 1 1000atom --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgRepay(vaultID, addr.String(), amount) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func NewCloseCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "close [vault-id]", + Args: cobra.ExactArgs(1), + Short: "close ", + Long: `close. + + Example: + $ onomyd tx close 1 --from mykey + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + addr := clientCtx.GetFromAddress() + + vaultID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + msg := types.NewMsgClose(vaultID, addr.String()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/vaults/keeper/abci.go b/x/vaults/keeper/abci.go new file mode 100644 index 00000000..56e11cf7 --- /dev/null +++ b/x/vaults/keeper/abci.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// EndBlocker called at every block, update validator set +func (k *Keeper) BeginBlocker(ctx sdk.Context) error { + currentTime := ctx.BlockTime() + params := k.GetParams(ctx) + // TODO: Recalculate debt + lastUpdate, err := k.LastUpdateTime.Get(ctx) + if err != nil { + return err + } + if currentTime.Sub(lastUpdate.Time) >= params.ChargingPeriod { + return k.UpdateVaultsDebt(ctx, lastUpdate.Time, currentTime) + } + + return nil +} diff --git a/x/vaults/keeper/genesis.go b/x/vaults/keeper/genesis.go new file mode 100644 index 00000000..4e03588d --- /dev/null +++ b/x/vaults/keeper/genesis.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +// InitGenesis - Init store state from genesis data +// +// CONTRACT: old coins from the FeeCollectionKeeper need to be transferred through +// a genesis port script to the new fee collector account +func (k *Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error { + err := k.SetParams(ctx, data.Params) + if err != nil { + return err + } + for _, vm := range data.VaultManagers { + err := k.VaultsManager.Set(ctx, vm.Denom, vm) + if err != nil { + return err + } + } + for _, vault := range data.Vaults { + err := k.SetVault(ctx, vault) + if err != nil { + return err + } + } + + if data.LastUpdate != nil { + k.LastUpdateTime.Set(ctx, *data.LastUpdate) + } else { + sdkCtx := sdk.UnwrapSDKContext(ctx) + k.LastUpdateTime.Set(ctx, types.LastUpdate{Time: sdkCtx.BlockTime()}) + } + + k.ShortfallAmount.Set(ctx, data.ShortfallAmount) + + return nil +} diff --git a/x/vaults/keeper/keeper.go b/x/vaults/keeper/keeper.go new file mode 100644 index 00000000..c99ff752 --- /dev/null +++ b/x/vaults/keeper/keeper.go @@ -0,0 +1,158 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/collections" + storetypes "cosmossdk.io/core/store" + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/x/vaults/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeService storetypes.KVStoreService + bankKeeper types.BankKeeper + accountKeeper types.AccountKeeper + // Temporarily leave it public to easily replace it with mocks. + // TODO: Make it private + OracleKeeper types.OracleKeeper + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + Schema collections.Schema + Params collections.Item[types.Params] + VaultsManager collections.Map[string, types.VaultMamager] + Vaults collections.Map[uint64, types.Vault] + VaultsSequence collections.Sequence + LastUpdateTime collections.Item[types.LastUpdate] + ShortfallAmount collections.Item[math.Int] +} + +// NewKeeper returns a new keeper by codec and storeKey inputs. +func NewKeeper( + cdc codec.BinaryCodec, + storeService storetypes.KVStoreService, + ak types.AccountKeeper, + bk types.BankKeeper, + ok types.OracleKeeper, + authority string, +) *Keeper { + sb := collections.NewSchemaBuilder(storeService) + k := Keeper{ + authority: authority, + cdc: cdc, + storeService: storeService, + accountKeeper: ak, + OracleKeeper: ok, + bankKeeper: bk, + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + VaultsManager: collections.NewMap(sb, types.VaultManagerKeyPrefix, "vaultmanagers", collections.StringKey, codec.CollValue[types.VaultMamager](cdc)), + Vaults: collections.NewMap(sb, types.VaultKeyPrefix, "vaults", collections.Uint64Key, codec.CollValue[types.Vault](cdc)), + VaultsSequence: collections.NewSequence(sb, types.VaultSequenceKeyPrefix, "sequence"), + LastUpdateTime: collections.NewItem(sb, types.LastUpdateKeyPrefix, "last_update", codec.CollValue[types.LastUpdate](cdc)), + ShortfallAmount: collections.NewItem(sb, types.ShortfallKeyPrefix, "shortfall", sdk.IntValue), + } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + return &k +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +func (k *Keeper) ActiveCollateralAsset( + ctx context.Context, + denom string, + minCollateralRatio math.LegacyDec, + liquidationRatio math.LegacyDec, + maxDebt math.Int, + stabilityFee math.LegacyDec, + mintingFee math.LegacyDec, + liquidationPenalty math.LegacyDec, + oracleScript int64, +) error { + // Check if asset alreay be actived + actived := k.IsActived(ctx, denom) + if actived { + return fmt.Errorf("denom %s already be actived", denom) + } + vm := types.VaultMamager{ + Denom: denom, + Params: types.VaultMamagerParams{ + MinCollateralRatio: minCollateralRatio, + LiquidationRatio: liquidationRatio, + MaxDebt: maxDebt, + StabilityFee: stabilityFee, + LiquidationPenalty: liquidationPenalty, + MintingFee: mintingFee, + }, + MintAvailable: maxDebt, + } + err := k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, denom, oracleScript) + if err != nil { + return err + } + + return k.VaultsManager.Set(ctx, denom, vm) +} + +func (k *Keeper) UpdatesCollateralAsset( + ctx context.Context, + denom string, + minCollateralRatio math.LegacyDec, + liquidationRatio math.LegacyDec, + maxDebt math.Int, + stabilityFee math.LegacyDec, + mintingFee math.LegacyDec, + liquidationPenalty math.LegacyDec, +) error { + // Check if asset alreay be actived + vm, err := k.GetVaultManager(ctx, denom) + if err != nil { + return fmt.Errorf("denom %s not activated", denom) + } + amountMinted := vm.Params.MaxDebt.Sub(vm.MintAvailable) + + vm.Params.MinCollateralRatio = minCollateralRatio + vm.Params.LiquidationRatio = liquidationRatio + vm.Params.MaxDebt = maxDebt + vm.Params.StabilityFee = stabilityFee + vm.Params.MintingFee = mintingFee + vm.Params.LiquidationPenalty = liquidationPenalty + + vm.MintAvailable = maxDebt.Sub(amountMinted) + + return k.VaultsManager.Set(ctx, denom, vm) +} + +func (k *Keeper) GetVaultManager( + ctx context.Context, + denom string, +) (types.VaultMamager, error) { + vm, err := k.VaultsManager.Get(ctx, denom) + if err != nil { + return types.VaultMamager{}, err + } + return vm, nil +} + +func (k *Keeper) IsActived( + ctx context.Context, + denom string, +) bool { + has, _ := k.VaultsManager.Has(ctx, denom) + return has +} diff --git a/x/vaults/keeper/keeper_test.go b/x/vaults/keeper/keeper_test.go new file mode 100644 index 00000000..01ca2bec --- /dev/null +++ b/x/vaults/keeper/keeper_test.go @@ -0,0 +1,48 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "cosmossdk.io/math" + "github.com/onomyprotocol/reserve/app/apptesting" + "github.com/onomyprotocol/reserve/x/vaults/keeper" + "github.com/onomyprotocol/reserve/x/vaults/keeper/mock" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +type KeeperTestSuite struct { + apptesting.KeeperTestHelper + + k keeper.Keeper + msgServer types.MsgServer + // queryServer types.QueryServer +} + +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + + mockOK := mock.NewMockOracleKeeper() + mockOK.SetPrice("atom", math.LegacyMustNewDecFromStr("8.0")) + mockOK.SetPrice(types.DefaultMintDenom, math.LegacyMustNewDecFromStr("1")) + s.App.VaultsKeeper.OracleKeeper = mockOK + s.k = s.App.VaultsKeeper + s.msgServer = keeper.NewMsgServerImpl(s.k) + // s.queryServer = keeper.NewQueryServerImpl(s.k) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) TestParams() { + s.SetupTest() + + err := s.k.SetParams(s.Ctx, types.DefaultParams()) + s.Require().NoError(err) + + p := s.k.GetParams(s.Ctx) + s.Require().Equal(p.MinInitialDebt, types.DefaultMinInitialDebt) + s.Require().Equal(p.LiquidatePeriod, types.DefaultLiquidatePeriod) +} diff --git a/x/vaults/keeper/mock/oracle_keeper.go b/x/vaults/keeper/mock/oracle_keeper.go new file mode 100644 index 00000000..4b295ff6 --- /dev/null +++ b/x/vaults/keeper/mock/oracle_keeper.go @@ -0,0 +1,37 @@ +package mock + +import ( + "context" + + "cosmossdk.io/math" +) + +type MockOracleKeeper struct { + prices map[string]math.LegacyDec +} + +func NewMockOracleKeeper() *MockOracleKeeper { + return &MockOracleKeeper{ + prices: make(map[string]math.LegacyDec), + } +} + +func (s *MockOracleKeeper) GetPrice(ctx context.Context, denom1 string, denom2 string) *math.LegacyDec { + price1, ok := s.prices[denom1] + if !ok { + panic("not found price" + denom1) + } + price2, ok := s.prices[denom2] + if !ok { + panic("not found price" + denom2) + } + p := price1.Quo(price2) + return &p +} +func (s *MockOracleKeeper) SetPrice(denom string, price math.LegacyDec) { + s.prices[denom] = price +} + +func (s *MockOracleKeeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + return nil +} diff --git a/x/vaults/keeper/msg_server.go b/x/vaults/keeper/msg_server.go new file mode 100644 index 00000000..d1dddbf4 --- /dev/null +++ b/x/vaults/keeper/msg_server.go @@ -0,0 +1,124 @@ +package keeper + +import ( + "context" + "fmt" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +type msgServer struct { + Keeper +} + +var _ types.MsgServer = msgServer{} + +// NewMsgServerImpl returns an implementation of the bank MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + +// Add new Active Collateral via gov +func (k msgServer) ActiveCollateral(ctx context.Context, msg *types.MsgActiveCollateral) (*types.MsgActiveCollateralResponse, error) { + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + err := k.ActiveCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt, msg.StabilityFee, msg.MintingFee, msg.LiquidationPenalty, int64(msg.OraclScript)) + if err != nil { + return nil, err + } + + return &types.MsgActiveCollateralResponse{}, nil +} + +// Updates Collateral via gov +func (k msgServer) UpdatesCollateral(ctx context.Context, msg *types.MsgUpdatesCollateral) (*types.MsgUpdatesCollateralResponse, error) { + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + err := k.UpdatesCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt, msg.StabilityFee, msg.MintingFee, msg.LiquidationPenalty) + if err != nil { + return nil, err + } + + return &types.MsgUpdatesCollateralResponse{}, nil +} + +// Create new vault, send Collateral and receive back an amount Minted +func (k msgServer) CreateVault(ctx context.Context, msg *types.MsgCreateVault) (*types.MsgCreateVaultResponse, error) { + err := k.CreateNewVault(ctx, sdk.MustAccAddressFromBech32(msg.Owner), msg.Collateral, msg.Minted) + if err != nil { + return nil, err + } + return &types.MsgCreateVaultResponse{}, nil +} + +// Send additional Collateral +func (k msgServer) Deposit(ctx context.Context, msg *types.MsgDeposit) (*types.MsgDepositResponse, error) { + err := k.DepositToVault(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) + if err != nil { + return nil, err + } + return &types.MsgDepositResponse{}, nil +} + +// Withdraw a amount Collateral, make sure the remaining Collateral value is still more than the loan amount +func (k msgServer) Withdraw(ctx context.Context, msg *types.MsgWithdraw) (*types.MsgWithdrawResponse, error) { + err := k.WithdrawFromVault(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) + if err != nil { + return nil, err + } + return &types.MsgWithdrawResponse{}, nil +} + +// additional loan, collateral is still guaranteed +func (k msgServer) Mint(ctx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { + err := k.MintCoin(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) + if err != nil { + return nil, err + } + return &types.MsgMintResponse{}, nil +} + +// repay part or all of a loan +func (k msgServer) Repay(ctx context.Context, msg *types.MsgRepay) (*types.MsgRepayResponse, error) { + err := k.RepayDebt(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) + if err != nil { + return nil, err + } + return &types.MsgRepayResponse{}, nil +} + +// claim back the CollateralLocked, ensuring the debt is paid off +func (k msgServer) Close(ctx context.Context, msg *types.MsgClose) (*types.MsgCloseResponse, error) { + vault, err := k.GetVault(ctx, msg.VaultId) + if err != nil { + return nil, fmt.Errorf("vault %d was not found", msg.VaultId) + } + if msg.Sender != vault.Owner { + return nil, fmt.Errorf("%s is not vault owner, expected: %s", msg.Sender, vault.Owner) + } + err = k.CloseVault(ctx, vault) + if err != nil { + return nil, err + } + return &types.MsgCloseResponse{}, nil +} diff --git a/x/vaults/keeper/params.go b/x/vaults/keeper/params.go new file mode 100644 index 00000000..e299808a --- /dev/null +++ b/x/vaults/keeper/params.go @@ -0,0 +1,21 @@ +package keeper + +import ( + "context" + + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + params, err := k.Params.Get(ctx) + if err != nil { + return types.Params{} + } + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + return k.Params.Set(ctx, params) +} diff --git a/x/vaults/keeper/query.go b/x/vaults/keeper/query.go new file mode 100644 index 00000000..ff305a4b --- /dev/null +++ b/x/vaults/keeper/query.go @@ -0,0 +1,75 @@ +package keeper + +import ( + "context" + // "errors" + + // "cosmossdk.io/collections" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +var _ types.QueryServer = queryServer{} + +// NewQueryServerImpl returns an implementation of the QueryServer interface +// for the provided Keeper. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k} +} + +type queryServer struct { + keeper Keeper +} + +func (q queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + params := q.keeper.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} + +func (q queryServer) QueryAllCollateral(ctx context.Context, req *types.QueryAllCollateralRequest) (*types.QueryAllCollateralResponse, error) { + allCollateral := []*types.VaultMamager{} + + q.keeper.VaultsManager.Walk(ctx, nil, func(key string, value types.VaultMamager) (stop bool, err error) { + allCollateral = append(allCollateral, &value) + return false, nil + }) + + return &types.QueryAllCollateralResponse{ + AllVaultMamager: allCollateral, + }, nil +} + +func (q queryServer) QueryAllVaults(ctx context.Context, req *types.QueryAllVaultsRequest) (*types.QueryAllVaultsResponse, error) { + allVaults := []*types.Vault{} + + q.keeper.Vaults.Walk(ctx, nil, func(key uint64, value types.Vault) (stop bool, err error) { + allVaults = append(allVaults, &value) + return false, nil + }) + + return &types.QueryAllVaultsResponse{ + AllVault: allVaults, + }, nil +} + +func (q queryServer) QueryVaults(ctx context.Context, req *types.QueryVaultIdRequest) (*types.QueryVaultIdResponse, error) { + if req == nil { + return &types.QueryVaultIdResponse{}, status.Error(codes.InvalidArgument, "invalid request") + } + + vault, err := q.keeper.GetVault(ctx, req.VaultId) + if err != nil { + return &types.QueryVaultIdResponse{}, err + } + return &types.QueryVaultIdResponse{ + Vault: &vault, + }, nil +} diff --git a/x/vaults/keeper/vault.go b/x/vaults/keeper/vault.go new file mode 100644 index 00000000..cad817d6 --- /dev/null +++ b/x/vaults/keeper/vault.go @@ -0,0 +1,633 @@ +package keeper + +import ( + "context" + "fmt" + "sort" + "strconv" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func (k *Keeper) CreateNewVault( + ctx context.Context, + owner sdk.AccAddress, + collateral sdk.Coin, + mint sdk.Coin, +) error { + denom := collateral.Denom + vm, err := k.GetVaultManager(ctx, denom) + if err != nil { + return fmt.Errorf("%s was not actived", denom) + } + + params := k.GetParams(ctx) + vmParams := vm.Params + + // Check if expect min less than MinInitialDebt + if mint.Amount.LT(params.MinInitialDebt) { + return fmt.Errorf("initial mint should be greater than min. Got %v, expected %v", mint.Amount, params.MinInitialDebt) + } + + // Calculate collateral ratio + price := k.OracleKeeper.GetPrice(ctx, denom, types.DefaultMintDenom) + // TODO: recalculate with denom decimal? + collateralValue := math.LegacyNewDecFromInt(collateral.Amount).Mul(*price) + ratio := collateralValue.QuoInt(mint.Amount) + + if ratio.LT(vmParams.MinCollateralRatio) { + return fmt.Errorf("collateral ratio invalid, got %d, min %d", ratio, vmParams.MinCollateralRatio) + } + + feeAmount := math.LegacyNewDecFromInt(mint.Amount).Mul(vmParams.MintingFee).TruncateInt() + feeCoin := sdk.NewCoin(mint.Denom, feeAmount) + mintedCoin := feeCoin.Add(mint) + + if vm.MintAvailable.LT(mintedCoin.Amount) { + return fmt.Errorf("exeed max debt") + } + + vaultId, vaultAddress := k.GetVaultIdAndAddress(ctx) + + // Lock collateral asset + err = k.bankKeeper.SendCoins(ctx, owner, vaultAddress, sdk.NewCoins(collateral)) + if err != nil { + return err + } + + // Mint and transfer to user and reserve + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(mintedCoin)) + if err != nil { + return err + } + + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(feeCoin)) + if err != nil { + return err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(mint)) + if err != nil { + return err + } + + // Set vault + vault := types.Vault{ + Id: vaultId, + Owner: owner.String(), + Debt: mintedCoin, + CollateralLocked: collateral, + Status: types.ACTIVE, + Address: vaultAddress.String(), + } + err = k.SetVault(ctx, vault) + if err != nil { + return err + } + // Update vault manager + vm.MintAvailable = vm.MintAvailable.Sub(mintedCoin.Amount) + return k.VaultsManager.Set(ctx, denom, vm) +} + +func (k *Keeper) CloseVault( + ctx context.Context, + vault types.Vault, +) error { + // Can not close vault if still debt remain + if vault.Debt.Amount.GT(math.ZeroInt()) { + return fmt.Errorf("debt remain: %v", vault.Debt) + } + + // transfer all collateral locked to owner + lockedCoins := sdk.NewCoins(vault.CollateralLocked) + err := k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(vault.Address), sdk.MustAccAddressFromBech32(vault.Owner), lockedCoins) + if err != nil { + return err + } + + // Update vault + vault.CollateralLocked.Amount = math.ZeroInt() + vault.Status = types.CLOSED + return k.SetVault(ctx, vault) +} + +func (k *Keeper) MintCoin( + ctx context.Context, + vaultId uint64, + sender sdk.AccAddress, + mint sdk.Coin, +) error { + vault, err := k.GetVault(ctx, vaultId) + if err != nil { + return err + } + if vault.Status != types.ACTIVE { + return fmt.Errorf("vault is not actived") + } + vm, err := k.GetVaultManager(ctx, vault.CollateralLocked.Denom) + if err != nil { + return fmt.Errorf("%s was not actived", vault.CollateralLocked.Denom) + } + + lockedCoin := vault.CollateralLocked + price := k.OracleKeeper.GetPrice(ctx, lockedCoin.Denom, types.DefaultMintDenom) + lockedValue := math.LegacyNewDecFromInt(lockedCoin.Amount).Mul(*price) + + feeAmount := math.LegacyNewDecFromInt(mint.Amount).Mul(vm.Params.MintingFee).TruncateInt() + feeCoin := sdk.NewCoin(mint.Denom, feeAmount) + mintedCoin := feeCoin.Add(mint) + + // calculate ratio + ratio := lockedValue.Quo(math.LegacyNewDecFromInt(vault.Debt.Amount.Add(mintedCoin.Amount))) + if ratio.LT(vm.Params.MinCollateralRatio) { + return fmt.Errorf("collateral ratio invalid, got %d, min %d", ratio, vm.Params.MinCollateralRatio) + } + + if vm.MintAvailable.LT(mintedCoin.Amount) { + return fmt.Errorf("exeed max debt") + } + + // Mint and transfer to user and reserve + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(mintedCoin)) + if err != nil { + return err + } + + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(feeCoin)) + if err != nil { + return err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Owner), sdk.NewCoins(mint)) + if err != nil { + return err + } + + // Update vault debt + vault.Debt = vault.Debt.Add(sdk.NewCoin(vault.Debt.Denom, mintedCoin.Amount)) + err = k.SetVault(ctx, vault) + if err != nil { + return err + } + + // Update vault manager + vm.MintAvailable = vm.MintAvailable.Sub(mintedCoin.Amount) + return k.VaultsManager.Set(ctx, vault.CollateralLocked.Denom, vm) +} + +func (k *Keeper) RepayDebt( + ctx context.Context, + vaultId uint64, + sender sdk.AccAddress, + mint sdk.Coin, +) error { + vault, err := k.GetVault(ctx, vaultId) + if err != nil { + return err + } + if vault.Status != types.ACTIVE { + return fmt.Errorf("vault is not actived") + } + vm, err := k.GetVaultManager(ctx, vault.CollateralLocked.Denom) + if err != nil { + return fmt.Errorf("%s was not actived", vault.CollateralLocked.Denom) + } + + burnAmount := mint + if vault.Debt.IsLT(burnAmount) { + burnAmount = vault.Debt + } + + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.NewCoins(burnAmount)) + if err != nil { + return err + } + + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(burnAmount)) + if err != nil { + return err + } + + // Update vault debt + vault.Debt = vault.Debt.Sub(burnAmount) + err = k.SetVault(ctx, vault) + if err != nil { + return err + } + + vm.MintAvailable = vm.MintAvailable.Add(burnAmount.Amount) + return k.VaultsManager.Set(ctx, vm.Denom, vm) +} + +func (k *Keeper) DepositToVault( + ctx context.Context, + vaultId uint64, + sender sdk.AccAddress, + collateral sdk.Coin, +) error { + vault, err := k.GetVault(ctx, vaultId) + if err != nil { + return err + } + + if collateral.Denom != vault.CollateralLocked.Denom { + return fmt.Errorf("vaultId %d does not accept denom %s", vaultId, collateral.Denom) + } + + if vault.Status != types.ACTIVE { + return fmt.Errorf("vault is not actived") + } + + // Lock collateral asset + err = k.bankKeeper.SendCoins(ctx, sender, sdk.MustAccAddressFromBech32(vault.Address), sdk.NewCoins(collateral)) + if err != nil { + return err + } + + // Update vault + vault.CollateralLocked = vault.CollateralLocked.Add(collateral) + return k.SetVault(ctx, vault) +} + +func (k *Keeper) WithdrawFromVault( + ctx context.Context, + vaultId uint64, + sender sdk.AccAddress, + collateral sdk.Coin, +) error { + vault, err := k.GetVault(ctx, vaultId) + if err != nil { + return err + } + if vault.Status != types.ACTIVE { + return fmt.Errorf("vault is not actived") + } + + if vault.CollateralLocked.Amount.LT(collateral.Amount) { + return fmt.Errorf("%d exeed locked amount: %d", collateral.Amount, vault.CollateralLocked.Amount) + } + + vm, err := k.GetVaultManager(ctx, vault.CollateralLocked.Denom) + if err != nil { + return fmt.Errorf("%s was not actived", vault.CollateralLocked.Denom) + } + + newLock := vault.CollateralLocked.Sub(collateral) + price := k.OracleKeeper.GetPrice(ctx, collateral.Denom, types.DefaultMintDenom) + newLockValue := math.LegacyNewDecFromInt(newLock.Amount).Mul(*price) + ratio := newLockValue.Quo(math.LegacyNewDecFromInt(vault.Debt.Amount)) + + if ratio.LT(vm.Params.MinCollateralRatio) { + return fmt.Errorf("ratio less than min ratio. Got: %d, min: %d", ratio, vm.Params.MinCollateralRatio) + } + + err = k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(vault.Address), sender, sdk.NewCoins(collateral)) + if err != nil { + return err + } + + // Update vault + vault.CollateralLocked = vault.CollateralLocked.Sub(collateral) + return k.SetVault(ctx, vault) +} + +func (k *Keeper) UpdateVaultsDebt( + ctx context.Context, + lastUpdateTime time.Time, + currentTime time.Time, +) error { + deltaDur := currentTime.Sub(lastUpdateTime) + rate := math.LegacyNewDec(deltaDur.Milliseconds()).Quo(math.LegacyNewDec((time.Hour * 24 * 365).Milliseconds())) // divice 365 days + // Get stability fee of all denoms + fees := make(map[string]math.LegacyDec, 0) + k.VaultsManager.Walk(ctx, nil, func(denom string, vm types.VaultMamager) (bool, error) { + fees[denom] = vm.Params.StabilityFee.Mul(rate) + return false, nil + }) + + err := k.Vaults.Walk(ctx, nil, func(id uint64, vault types.Vault) (bool, error) { + var err error + if vault.Status == types.ACTIVE { + debtAmount := vault.Debt.Amount + newDebtAmount := math.LegacyNewDecFromInt(debtAmount).Add(math.LegacyNewDecFromInt(debtAmount).Mul(fees[vault.CollateralLocked.Denom])).TruncateInt() + vault.Debt.Amount = newDebtAmount + err = k.Vaults.Set(ctx, id, vault) + } + + return false, err + }) + if err != nil { + return err + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.LastUpdateTime.Set(ctx, types.LastUpdate{Time: sdkCtx.BlockTime()}) +} + +func (k *Keeper) shouldLiquidate( + vault types.Vault, + price math.LegacyDec, + liquidationRatio math.LegacyDec, +) (bool, error) { + // Only liquidate ACTIVE vault + if vault.Status != types.ACTIVE { + return false, nil + } + + collateralValue := math.LegacyNewDecFromInt(vault.CollateralLocked.Amount).Mul(price) + ratio := collateralValue.Quo(math.LegacyNewDecFromInt(vault.Debt.Amount)) + + if ratio.LTE(liquidationRatio) { + return true, nil + } + return false, nil +} + +func (k *Keeper) GetLiquidations( + ctx context.Context, +) ([]*types.Liquidation, error) { + + // denom to liquidationRatios + liquidationRatios := make(map[string]math.LegacyDec) + // denom to price + prices := make(map[string]math.LegacyDec) + // denom to Liquidation + liquidations := make(map[string]*types.Liquidation) + + err := k.VaultsManager.Walk(ctx, nil, func(key string, vm types.VaultMamager) (bool, error) { + price := k.OracleKeeper.GetPrice(ctx, vm.Denom, types.DefaultMintDenom) + prices[vm.Denom] = *price + liquidationRatios[vm.Denom] = vm.Params.LiquidationRatio + liquidations[vm.Denom] = types.NewEmptyLiquidation(vm.Denom) + + return false, nil + }) + if err != nil { + return nil, err + } + + err = k.Vaults.Walk(ctx, nil, func(id uint64, vault types.Vault) (bool, error) { + denom := vault.CollateralLocked.Denom + shouldLiquidate, err := k.shouldLiquidate(vault, prices[denom], liquidationRatios[denom]) + if shouldLiquidate && err == nil { + liquidations[denom].LiquidatingVaults = append(liquidations[denom].LiquidatingVaults, &vault) + liquidations[denom].VaultLiquidationStatus[id] = &types.VaultLiquidationStatus{} + + vault.Status = types.LIQUIDATING + vault.LiquidationPrice = prices[denom] + err := k.SetVault(ctx, vault) + if err != nil { + return true, err + } + } + + return false, nil + }) + if err != nil { + return nil, err + } + + var result []*types.Liquidation + for _, liquidation := range liquidations { + if len(liquidation.LiquidatingVaults) != 0 { + result = append(result, liquidation) + } + } + + return result, nil +} + +// TODO: Separate this func +func (k *Keeper) Liquidate( + ctx context.Context, + liquidation types.Liquidation, +) error { + params := k.GetParams(ctx) + + vm, err := k.GetVaultManager(ctx, liquidation.Denom) + if err != nil { + return err + } + + totalDebt := sdk.NewCoin(params.MintDenom, math.ZeroInt()) + sold := sdk.NewCoin(params.MintDenom, math.ZeroInt()) + totalCollateralRemain := sdk.NewCoin(liquidation.Denom, math.ZeroInt()) + + for _, vault := range liquidation.LiquidatingVaults { + totalDebt = totalDebt.Add(vault.Debt) + // transfer all remain collateral locked in vault to vaults module for distributing. + vaultAddr := sdk.MustAccAddressFromBech32(vault.Address) + balances := k.bankKeeper.GetAllBalances(ctx, vaultAddr) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, vaultAddr, types.ModuleName, balances) + if err != nil { + return err + } + vault.Status = types.LIQUIDATED + } + + for _, status := range liquidation.VaultLiquidationStatus { + sold = sold.Add(status.Sold) + totalCollateralRemain = totalCollateralRemain.Add(status.RemainCollateral) + } + + // Sold amount enough to cover debt + if sold.Amount.GTE(totalDebt.Amount) { + // Burn debt + err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(totalDebt)) + if err != nil { + return err + } + // Increase mint available + vm.MintAvailable = vm.MintAvailable.Add(totalDebt.Amount) + err = k.VaultsManager.Set(ctx, liquidation.Denom, vm) + if err != nil { + return err + } + + // If remain sold, send to reserve + remain := sold.Sub(totalDebt) + if remain.Amount.GT(math.ZeroInt()) { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(remain)) + if err != nil { + return err + } + } + + // Take the liquidation penalty and send back to vault owner + if totalCollateralRemain.Amount.GT(math.ZeroInt()) { + //TODO: decimal + + for _, vault := range liquidation.LiquidatingVaults { + collateralRemain := liquidation.VaultLiquidationStatus[vault.Id].RemainCollateral + if collateralRemain.Amount.Equal(math.ZeroInt()) { + continue + } + penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(vm.Params.LiquidationPenalty).TruncateInt() + fmt.Println("penaltyAmount", penaltyAmount) + if penaltyAmount.GTE(collateralRemain.Amount) { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(collateralRemain)) + if err != nil { + return err + } + } else { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, penaltyAmount))) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Owner), sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, collateralRemain.Amount.Sub(penaltyAmount)))) + if err != nil { + return err + } + } + } + } + } else { + // does not raise enough to cover nomUSD debt + + // Burn sold amount + err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sold)) + if err != nil { + return err + } + // Increase mint available + vm.MintAvailable = vm.MintAvailable.Add(sold.Amount) + err = k.VaultsManager.Set(ctx, liquidation.Denom, vm) + if err != nil { + return err + } + + // No collateral remain + if totalCollateralRemain.Amount.Equal(math.ZeroInt()) { + //TODO: send shortfall to reserve + // Update vaults status + for _, vault := range liquidation.LiquidatingVaults { + k.SetVault(ctx, *vault) + } + currentShortfall, err := k.ShortfallAmount.Get(ctx) + if err != nil { + return err + } + newShortfall := currentShortfall.Add(totalDebt.Sub(sold).Amount) + return k.ShortfallAmount.Set(ctx, newShortfall) + } else { + // If there some collateral asset remain, try to reconstitue vault + // Priority by collateral ratio at momment + // So that mean we need less resource for high ratio vault + + ratios := make([]math.LegacyDec, 0) + //TODO: Sort by CR in GetLiquidations could reduce calculate here + for _, vault := range liquidation.LiquidatingVaults { + penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(vm.Params.LiquidationPenalty).TruncateInt() + + // If collateral locked not enough for penalty, + // transfer all and mark vault CLOSED + if penaltyAmount.GT(vault.CollateralLocked.Amount) { + penaltyAmount = vault.CollateralLocked.Amount + vault.Status = types.CLOSED + } + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(liquidation.Denom, penaltyAmount))) + if err != nil { + return err + } + vault.CollateralLocked.Amount = vault.CollateralLocked.Amount.Sub(penaltyAmount) + totalCollateralRemain.Amount = totalCollateralRemain.Amount.Sub(penaltyAmount) + + ratio := math.LegacyNewDecFromInt(vault.CollateralLocked.Amount).Mul(vault.LiquidationPrice).Quo(math.LegacyNewDecFromInt(vault.Debt.Amount)) + ratios = append(ratios, ratio) + } + + // Sort the vaults by CR in descending order + sort.Slice(liquidation.LiquidatingVaults, func(i, j int) bool { + return ratios[i].GT(ratios[j]) + }) + + // Try to reconstitue vaults + // list contains both LIQUIDATING & CLOSED, + // only reconstitue LIQUIDATING vaults + totalRemainDebt := totalDebt.Sub(sold) + for _, vault := range liquidation.LiquidatingVaults { + if vault.Status != types.LIQUIDATING { + continue + } + // if remain debt & collateral can cover full vault + // open again + if vault.Debt.IsLTE(totalRemainDebt) && vault.CollateralLocked.IsLTE(totalCollateralRemain) { + // Lock collateral to vault address + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Address), sdk.NewCoins(vault.CollateralLocked)) + if err != nil { + return err + } + totalRemainDebt = totalRemainDebt.Sub(vault.Debt) + totalCollateralRemain = totalCollateralRemain.Sub(vault.CollateralLocked) + + vault.Status = types.ACTIVE + } else { + vault.Status = types.LIQUIDATED + } + } + + // if remain collateral, send to reserve + if totalCollateralRemain.Amount.GT(math.ZeroInt()) { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(totalCollateralRemain)) + if err != nil { + return err + } + } + + // if remain debt, send shortfall + if totalRemainDebt.Amount.GT(math.ZeroInt()) { + // Update vaults status + for _, vault := range liquidation.LiquidatingVaults { + k.SetVault(ctx, *vault) + } + currentShortfall, err := k.ShortfallAmount.Get(ctx) + if err != nil { + return err + } + newShortfall := currentShortfall.Add(totalRemainDebt.Amount) + return k.ShortfallAmount.Set(ctx, newShortfall) + } + + } + } + // Update vaults status + for _, vault := range liquidation.LiquidatingVaults { + k.SetVault(ctx, *vault) + } + return nil +} + +func (k *Keeper) GetVault( + ctx context.Context, + id uint64, +) (types.Vault, error) { + vault, err := k.Vaults.Get(ctx, id) + if err != nil { + return types.Vault{}, err + } + return vault, nil +} + +func (k *Keeper) SetVault( + ctx context.Context, + vault types.Vault, +) error { + return k.Vaults.Set(ctx, vault.Id, vault) +} + +func (k *Keeper) GetVaultIdAndAddress( + ctx context.Context, +) (uint64, sdk.AccAddress) { + id, err := k.VaultsSequence.Next(ctx) + fmt.Println("nextId", id, err) + if err != nil { + return 0, sdk.AccAddress{} + } + address := address.Module(types.ModuleName, []byte(strconv.Itoa(int(id)))) + + return id, address +} diff --git a/x/vaults/keeper/vaults_test.go b/x/vaults/keeper/vaults_test.go new file mode 100644 index 00000000..dcc86016 --- /dev/null +++ b/x/vaults/keeper/vaults_test.go @@ -0,0 +1,621 @@ +package keeper_test + +import ( + "fmt" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func (s *KeeperTestSuite) TestVaultsStore() { + s.SetupTest() + + v := types.Vault{ + Owner: s.TestAccs[0].String(), + Debt: sdk.NewCoin("atom", math.NewInt(1000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(1000)), + Status: types.LIQUIDATED, + LiquidationPrice: math.LegacyMustNewDecFromStr("1.0"), + Address: "addr1_______________", + } + err := s.k.SetVault(s.Ctx, v) + s.Require().NoError(err) + + vault, err := s.k.GetVault(s.Ctx, 0) + s.Require().NoError(err) + s.Require().Equal(v, vault) +} + +func (s *KeeperTestSuite) TestCreateNewVault() { + s.SetupTest() + var ( + denom = "atom" + mintDenom = types.DefaultMintDenom + collateral = sdk.NewCoin(denom, math.NewInt(10_000_000)) // 10 atom = 80$ + maxDebt = math.NewInt(100_000_000) + ) + err := s.k.ActiveCollateralAsset(s.Ctx, denom, math.LegacyMustNewDecFromStr("1.6"), math.LegacyMustNewDecFromStr("1.5"), maxDebt, types.DefaultStabilityFee, types.DefaultMintingFee, types.DefaultLiquidationPenalty, 1) + s.Require().NoError(err) + + tests := []struct { + name string + setup func() + denom string + owner sdk.AccAddress + collateral sdk.Coin + mint sdk.Coin + expErr bool + }{ + { + name: "mint less than min initial debt", + setup: func() { + err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, sdk.NewCoins(collateral)) + s.Require().NoError(err) + err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, s.TestAccs[0], sdk.NewCoins(collateral)) + s.Require().NoError(err) + }, + denom: "atom", + owner: s.TestAccs[0], + collateral: collateral, + mint: sdk.NewCoin(mintDenom, math.NewInt(10_000_000)), + expErr: true, + }, + { + name: "exeed max debt", + setup: func() { + err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, sdk.NewCoins(collateral)) + s.Require().NoError(err) + err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, s.TestAccs[0], sdk.NewCoins(collateral)) + s.Require().NoError(err) + }, + denom: "atom", + owner: s.TestAccs[0], + collateral: collateral, + mint: sdk.NewCoin(mintDenom, math.NewInt(110_000_000)), + expErr: true, + }, + { + name: "invalid ratio", + setup: func() { + err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, sdk.NewCoins(collateral)) + s.Require().NoError(err) + err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, s.TestAccs[0], sdk.NewCoins(collateral)) + s.Require().NoError(err) + }, + denom: "atom", + owner: s.TestAccs[0], + collateral: collateral, + mint: sdk.NewCoin(mintDenom, math.NewInt(60_000_000)), + expErr: true, + }, + { + name: "success", + setup: func() { + s.FundAccount(s.TestAccs[0], types.ModuleName, sdk.NewCoins(collateral)) + }, + denom: "atom", + owner: s.TestAccs[0], + collateral: collateral, + mint: sdk.NewCoin(mintDenom, math.NewInt(40_000_000)), + expErr: false, + }, + } + for _, t := range tests { + s.Run(t.name, func() { + t.setup() + err := s.k.CreateNewVault(s.Ctx, t.owner, t.collateral, t.mint) + if t.expErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + + vm, err := s.k.GetVaultManager(s.Ctx, denom) + s.Require().NoError(err) + s.Require().NotEqual(maxDebt, vm.MintAvailable) + } + }) + } +} + +func (s *KeeperTestSuite) TestRepayDebt() { + s.SetupTest() + var ( + denom = "atom" + repayAsset = sdk.NewCoin("nomUSD", math.NewInt(2000000)) + collateralAsset = sdk.NewCoin(denom, math.NewInt(100000000000)) + fund = sdk.NewCoin(denom, math.NewInt(1000000000000)) + maxDebt = math.NewInt(2000000000) + mintedCoin = sdk.NewCoin("nomUSD", math.NewInt(300000000)) + ) + + tests := []struct { + name string + setup func() + vaultId uint64 + sender sdk.AccAddress + repayAsset sdk.Coin + }{ + { + name: "success", + setup: func() { + s.FundAccount(s.TestAccs[0], types.ModuleName, sdk.NewCoins(fund)) + + err := s.k.ActiveCollateralAsset(s.Ctx, denom, math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), maxDebt, types.DefaultStabilityFee, types.DefaultMintingFee, types.DefaultLiquidationPenalty, 1) + s.Require().NoError(err) + + err = s.k.CreateNewVault(s.Ctx, s.TestAccs[0], collateralAsset, mintedCoin) + s.Require().NoError(err) + }, + vaultId: 0, + sender: s.TestAccs[0], + repayAsset: repayAsset, + }, + } + for _, t := range tests { + s.Run(t.name, func() { + t.setup() + + vault, err := s.k.GetVault(s.Ctx, t.vaultId) + s.Require().NoError(err) + debt := vault.Debt + + err = s.k.RepayDebt(s.Ctx, t.vaultId, t.sender, repayAsset) + s.Require().NoError(err) + + vault, err = s.k.GetVault(s.Ctx, t.vaultId) + s.Require().NoError(err) + + s.Require().Equal(vault.Debt, debt.Sub(repayAsset)) + }) + } +} + +func (s *KeeperTestSuite) TestDepositToVault() { + s.SetupTest() + var ( + denom = "atom" + coin = sdk.NewCoin(denom, math.NewInt(1000000)) + collateralAsset = sdk.NewCoin(denom, math.NewInt(100000000000)) + fund = sdk.NewCoin(denom, math.NewInt(1000000000000)) + maxDebt = math.NewInt(2000000000) + mintedCoin = sdk.NewCoin("nomUSD", math.NewInt(200000000)) + ) + + tests := []struct { + name string + setup func() + vaultId uint64 + sender sdk.AccAddress + depositAsset sdk.Coin + }{ + { + name: "success", + setup: func() { + s.FundAccount(s.TestAccs[0], types.ModuleName, sdk.NewCoins(fund)) + + err := s.k.ActiveCollateralAsset(s.Ctx, denom, math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), maxDebt, types.DefaultStabilityFee, types.DefaultMintingFee, types.DefaultLiquidationPenalty, 1) + s.Require().NoError(err) + + err = s.k.CreateNewVault(s.Ctx, s.TestAccs[0], collateralAsset, mintedCoin) + s.Require().NoError(err) + }, + vaultId: 0, + sender: s.TestAccs[0], + depositAsset: coin, + }, + } + for _, t := range tests { + s.Run(t.name, func() { + t.setup() + err := s.k.DepositToVault(s.Ctx, t.vaultId, t.sender, t.depositAsset) + s.Require().NoError(err) + + vault, err := s.k.GetVault(s.Ctx, t.vaultId) + s.Require().NoError(err) + s.Require().Equal(collateralAsset.Add(t.depositAsset), vault.CollateralLocked) + }) + } +} + +// TODO: Update +func (s *KeeperTestSuite) TestWithdrawFromVault() { + s.SetupTest() + var ( + denom = "atom" + coin = sdk.NewCoin(denom, math.NewInt(1000000)) + coinMintToAcc = sdk.NewCoin(denom, math.NewInt(100000000000)) + fund = sdk.NewCoin(denom, math.NewInt(10000000000000)) + maxDebt = math.NewInt(2000000000) + mintedCoin = sdk.NewCoin("nomUSD", math.NewInt(200000000)) + ) + + tests := []struct { + name string + setup func() + vaultId uint64 + sender sdk.AccAddress + collateral sdk.Coin + }{ + { + name: "success", + setup: func() { + s.FundAccount(s.TestAccs[0], types.ModuleName, sdk.NewCoins(fund)) + + err := s.k.ActiveCollateralAsset(s.Ctx, denom, math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), maxDebt, types.DefaultStabilityFee, types.DefaultMintingFee, types.DefaultLiquidationPenalty, 1) + s.Require().NoError(err) + + err = s.k.CreateNewVault(s.Ctx, s.TestAccs[0], coinMintToAcc, mintedCoin) + s.Require().NoError(err) + + }, + vaultId: 0, + sender: s.TestAccs[0], + collateral: coin, + }, + } + for _, t := range tests { + s.Run(t.name, func() { + t.setup() + err := s.k.WithdrawFromVault(s.Ctx, t.vaultId, t.sender, t.collateral) + s.Require().NoError(err) + + vault, err := s.k.GetVault(s.Ctx, t.vaultId) + s.Require().NoError(err) + s.Require().NotEqual(maxDebt, vault.CollateralLocked) + }) + } +} + +// TODO: Update +// func (s *KeeperTestSuite) TestUpdateVaultsDebt() { +// s.SetupTest() +// var ( +// denom = "atom" +// maxDebt = math.NewInt(10000) +// feeStabilityUpdate = math.LegacyMustNewDecFromStr("0.5") +// ) + +// tests := []struct { +// name string +// setup func() +// vaultId uint64 +// }{ +// { +// name: "success", +// setup: func() { +// vault := types.Vault{ +// Owner: s.TestAccs[0].String(), +// Debt: sdk.NewCoin(denom, maxDebt), +// CollateralLocked: sdk.NewCoin(denom, maxDebt), +// Status: types.ACTIVE, +// } +// err := s.k.SetVault(s.Ctx, vault) +// s.Require().NoError(err) + +// // update params +// uP := types.DefaultParams() +// uP.StabilityFee = feeStabilityUpdate +// err = s.k.SetParams(s.Ctx, uP) +// s.Require().NoError(err) +// }, +// vaultId: 0, +// }, +// } +// for _, t := range tests { +// s.Run(t.name, func() { +// t.setup() +// err := s.k.UpdateVaultsDebt(s.Ctx) +// s.Require().NoError(err) + +// // expect +// expectDebtAmount := math.LegacyNewDecFromInt(maxDebt).Add(math.LegacyNewDecFromInt(maxDebt).Mul(feeStabilityUpdate)).TruncateInt() +// vault, err := s.k.GetVault(s.Ctx, t.vaultId) +// s.Require().NoError(err) +// s.Require().Equal(expectDebtAmount.String(), vault.Debt.Amount.String()) +// }) +// } +// } + +func (s *KeeperTestSuite) TestLiquidate() { + // s.SetupTest() + + vaultOwnerAddr := sdk.AccAddress([]byte("addr1_______________")) + + tests := []struct { + name string + liquidation types.Liquidation + expVaultStatus []types.VaultStatus + shortfallAmount sdk.Coin + moduleBalances sdk.Coins + reserveBalances sdk.Coins + vaultOwnerBalances sdk.Coins + }{ + { + name: "single vault - sold all, enough to cover debt", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold all at price 7, + // Sold = 35 + // Remain collateral = 0 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(35_000_000)), + RemainCollateral: sdk.NewCoin("atom", math.ZeroInt()), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.LIQUIDATED}, + reserveBalances: sdk.NewCoins(sdk.NewCoin(types.DefaultMintDenom, math.NewInt(10_000_000))), + }, + { + name: "single vault - sold all, not enough to cover debt", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold all at price 4, + // Sold = 20 + // Remain collateral = 0 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(20_000_000)), + RemainCollateral: sdk.NewCoin("atom", math.ZeroInt()), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.LIQUIDATED}, + shortfallAmount: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(5_000_000)), + }, + { + name: "single vault - remain collateral, enough to cover debt", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold 1 at 7 + // Sold 2 at 6.5 + // Sold 1 at 6 + // Sold = 26 + // Remain collateral = 1 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(26_000_000)), + RemainCollateral: sdk.NewCoin("atom", math.NewInt(1_000_000)), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.LIQUIDATED}, + reserveBalances: sdk.NewCoins( + sdk.NewCoin(types.DefaultMintDenom, math.NewInt(1_000_000)), + sdk.NewCoin("atom", math.LegacyNewDec(25_000_000).QuoInt(math.NewInt(7)).Mul(math.LegacyNewDecWithPrec(5, 2)).TruncateInt()), // (25/7)*0.05 + ), + vaultOwnerBalances: sdk.NewCoins( + sdk.NewCoin("atom", math.NewInt(1_000_000).Sub(math.LegacyNewDec(25_000_000).QuoInt(math.NewInt(7)).Mul(math.LegacyNewDecWithPrec(5, 2)).TruncateInt())), + ), // remain - penalty + }, + { + name: "single vault - remain collateral, not enough to cover debt, can reconstitute vault", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold = 0 + // Remain collateral = 5 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.ZeroInt()), + RemainCollateral: sdk.NewCoin("atom", math.NewInt(5_000_000)), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.ACTIVE}, + reserveBalances: sdk.NewCoins( + // penalty + sdk.NewCoin("atom", math.LegacyNewDec(25_000_000).QuoInt(math.NewInt(7)).Mul(math.LegacyNewDecWithPrec(5, 2)).TruncateInt()), // (25/7)*0.05 + ), + }, + { + name: "single vault - remain collateral, not enough to cover debt, can reconstitute vault", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold = 0 + // Remain collateral = 5 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.ZeroInt()), + RemainCollateral: sdk.NewCoin("atom", math.NewInt(5_000_000)), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.ACTIVE}, + reserveBalances: sdk.NewCoins( + // penalty + sdk.NewCoin("atom", math.LegacyNewDec(25_000_000).QuoInt(math.NewInt(7)).Mul(math.LegacyNewDecWithPrec(5, 2)).TruncateInt()), // (25/7)*0.05 + ), + }, + { + name: "single vault - remain collateral, not enough to cover debt, can not reconstitute vault", + liquidation: types.Liquidation{ + Denom: "atom", + LiquidatingVaults: []*types.Vault{ + { + Owner: vaultOwnerAddr.String(), + Debt: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(25_000_000)), + CollateralLocked: sdk.NewCoin("atom", math.NewInt(5_000_000)), // lock 5 ATOM at price 8, ratio = 160% + Status: types.LIQUIDATING, + LiquidationPrice: math.LegacyNewDecWithPrec(7, 0), // liquidate at price 7, ratio = 140% + }, + }, + // Sold 1 at 7 + // Sold = 7 + // Remain collateral = 4 + VaultLiquidationStatus: map[uint64]*types.VaultLiquidationStatus{ + 0: { + Sold: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(7_000_000)), + RemainCollateral: sdk.NewCoin("atom", math.NewInt(4_000_000)), + }, + }, + }, + expVaultStatus: []types.VaultStatus{types.LIQUIDATED}, + reserveBalances: sdk.NewCoins( + // penalty + sdk.NewCoin("atom", math.NewInt(4_000_000)), // (25/7)*0.05 + ), + shortfallAmount: sdk.NewCoin(types.DefaultMintDenom, math.NewInt(18_000_000)), + }, + } + for _, t := range tests { + s.Run(t.name, func() { + s.SetupTest() + err := s.k.ActiveCollateralAsset(s.Ctx, "atom", math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), math.NewInt(1000_000_000), types.DefaultStabilityFee, types.DefaultMintingFee, types.DefaultLiquidationPenalty, 1) + s.Require().NoError(err) + + for _, vault := range t.liquidation.LiquidatingVaults { + vaultId, vaultAddr := s.App.VaultsKeeper.GetVaultIdAndAddress(s.Ctx) + fmt.Println("vaultId", vaultId) + vault.Id = vaultId + vault.Address = vaultAddr.String() + + err := s.App.VaultsKeeper.SetVault(s.Ctx, *vault) + s.Require().NoError(err) + + // Fund collateral locked for vault + lockCoins := sdk.NewCoins(t.liquidation.VaultLiquidationStatus[vaultId].RemainCollateral) + s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, lockCoins) + s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, vaultAddr, lockCoins) + + // Fund sold coins to vault Module + soldCoins := sdk.NewCoins(t.liquidation.VaultLiquidationStatus[vaultId].Sold) + s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, soldCoins) + } + + err = s.App.VaultsKeeper.Liquidate(s.Ctx, t.liquidation) + fmt.Println("errrrr", err) + + if t.reserveBalances != nil { + reserveModuleAddr := s.App.AccountKeeper.GetModuleAddress(types.ReserveModuleName) + reserveBalance := s.App.BankKeeper.GetAllBalances(s.Ctx, reserveModuleAddr) + fmt.Println("reserve balances", reserveBalance) + fmt.Println("test case reserve balances", t.reserveBalances) + // t.reserveBalances.Sort() + s.Require().Equal(reserveBalance, t.reserveBalances) + } + + if t.vaultOwnerBalances != nil { + ownerBalances := s.App.BankKeeper.GetAllBalances(s.Ctx, vaultOwnerAddr) + s.Require().Equal(ownerBalances, t.vaultOwnerBalances) + } + + if !t.shortfallAmount.IsNil() { + shortfallAmount, err := s.App.VaultsKeeper.ShortfallAmount.Get(s.Ctx) + s.Require().NoError(err) + s.Require().Equal(t.shortfallAmount.Amount, shortfallAmount) + } + + for i, vault := range t.liquidation.LiquidatingVaults { + updatedVault, err := s.App.VaultsKeeper.GetVault(s.Ctx, vault.Id) + fmt.Println("updated vault", updatedVault) + s.Require().NoError(err) + s.Require().Equal(updatedVault.Status, t.expVaultStatus[i]) + } + + }) + } +} + +// func (s *KeeperTestSuite) TestGetLiquidateVaults() { +// s.SetupTest() +// var ( +// denom1 = "atom" +// denom2 = "osmo" +// coin = sdk.NewCoin(denom1, math.NewInt(1000)) +// coinMintToAcc = sdk.NewCoin(denom1, math.NewInt(1000000)) +// maxDebt = math.NewInt(10000) +// ) + +// tests := []struct { +// name string +// setup func() +// vaultId uint64 +// sender sdk.AccAddress +// collateral sdk.Coin +// }{ +// { +// name: "success", +// setup: func() { +// err := s.k.ActiveCollateralAsset(s.Ctx, denom1, math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), maxDebt) +// s.Require().NoError(err) +// err = s.k.ActiveCollateralAsset(s.Ctx, denom2, math.LegacyMustNewDecFromStr("0.1"), math.LegacyMustNewDecFromStr("0.1"), maxDebt) +// s.Require().NoError(err) + +// vault := types.Vault{ +// Owner: s.TestAccs[0].String(), +// Debt: sdk.NewCoin(denom1, maxDebt), +// CollateralLocked: sdk.NewCoin(denom1, maxDebt), +// Status: types.ACTIVE, +// } +// err = s.k.SetVault(s.Ctx, vault) +// s.Require().NoError(err) + +// err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, sdk.NewCoins(coinMintToAcc)) +// s.Require().NoError(err) +// err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, s.TestAccs[0], sdk.NewCoins(coinMintToAcc)) +// s.Require().NoError(err) +// }, +// vaultId: 0, +// sender: s.TestAccs[0], +// collateral: coin, +// }, +// } +// for _, t := range tests { +// s.Run(t.name, func() { +// t.setup() +// vaults, prices, err := s.k.GetLiquidateVaults(s.Ctx) +// s.Require().NoError(err) + +// // current price = 1, vaults is empty, +// s.Require().Equal(2, len(prices)) +// s.Require().Equal(0, len(vaults)) +// }) +// } +// } diff --git a/x/vaults/module/autocli.go b/x/vaults/module/autocli.go new file mode 100644 index 00000000..c23fef73 --- /dev/null +++ b/x/vaults/module/autocli.go @@ -0,0 +1,35 @@ +package vaults + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: types.Query_serviceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: types.Msg_serviceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/vaults/module/module.go b/x/vaults/module/module.go new file mode 100644 index 00000000..790fee24 --- /dev/null +++ b/x/vaults/module/module.go @@ -0,0 +1,207 @@ +package vaults + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "cosmossdk.io/core/address" + + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "cosmossdk.io/core/appmodule" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + modulev1 "github.com/onomyprotocol/reserve/api/reserve/vaults/module" + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" + "github.com/onomyprotocol/reserve/x/vaults/keeper" + "github.com/onomyprotocol/reserve/x/vaults/types" + + "github.com/onomyprotocol/reserve/x/vaults/cli" +) + +const consensusVersion uint64 = 1 + +var ( + _ module.AppModule = AppModule{} + _ appmodule.HasBeginBlocker = (*AppModule)(nil) +) + +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +func (a AppModuleBasic) Name() string { + return types.ModuleName +} + +// DefaultGenesis is an empty object +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +func (a AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMessage { + return a.DefaultGenesis(cdc) +} + +func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, message json.RawMessage) { + var genesisState types.GenesisState + marshaler.MustUnmarshalJSON(message, &genesisState) + err := a.keeper.InitGenesis(ctx, genesisState) + if err != nil { + panic(err) + } +} + +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } + +func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { +} + +func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +func (a AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +func (a AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { +} + +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +func (a AppModule) RegisterInvariants(_ sdk.InvariantRegistry) { +} + +func (a AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(a.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(a.keeper)) +} + +func (a AppModule) BeginBlock(_ context.Context) error { + return nil +} + +func (a AppModule) EndBlock(_ sdk.Context) []abci.ValidatorUpdate { + return nil +} + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + AddressCodec address.Codec + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + OracleKeeper oraclekeeper.Keeper +} + +type ModuleOutputs struct { + depinject.Out + + PsmKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + // in.AddressCodec, + in.StoreService, + // in.Logger, + in.AccountKeeper, + in.BankKeeper, + &in.OracleKeeper, + authority.String(), + ) + m := NewAppModule( + in.Cdc, + *k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{PsmKeeper: *k, Module: m} +} diff --git a/x/vaults/types/codec.go b/x/vaults/types/codec.go new file mode 100644 index 00000000..b4e7a346 --- /dev/null +++ b/x/vaults/types/codec.go @@ -0,0 +1,38 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&ActiveCollateralProposal{}, "reserve/ActiveCollateralProposal", nil) + cdc.RegisterConcrete(&UpdatesCollateralProposal{}, "reserve/UpdatesCollateralProposal", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + &MsgActiveCollateral{}, + &MsgUpdatesCollateral{}, + &MsgCreateVault{}, + &MsgDeposit{}, + &MsgWithdraw{}, + &MsgMint{}, + &MsgRepay{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &ActiveCollateralProposal{}, + &UpdatesCollateralProposal{}, + ) + +} diff --git a/x/vaults/types/errors.go b/x/vaults/types/errors.go new file mode 100644 index 00000000..046d86b2 --- /dev/null +++ b/x/vaults/types/errors.go @@ -0,0 +1,14 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/vaults module sentinel errors +var ( + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrInvalidActiveCollateralProposal = sdkerrors.Register(ModuleName, 2, "invalid active collateral proposal") + ErrInvalidUpdatesCollateralProposal = sdkerrors.Register(ModuleName, 3, "invalid updates collateral proposal") +) diff --git a/x/vaults/types/expected_keepers.go b/x/vaults/types/expected_keepers.go new file mode 100644 index 00000000..f085a692 --- /dev/null +++ b/x/vaults/types/expected_keepers.go @@ -0,0 +1,34 @@ +package types // noalias + +import ( + context "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the contract required for account APIs. +type AccountKeeper interface { + GetModuleAddress(name string) sdk.AccAddress + + // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + SetModuleAccount(context.Context, sdk.ModuleAccountI) + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI +} + +// BankKeeper defines the contract needed to be fulfilled for banking and supply +// dependencies. +type BankKeeper interface { + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error + BurnCoins(ctx context.Context, ModuleName string, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins +} + +type OracleKeeper interface { + GetPrice(ctx context.Context, base, quote string) *math.LegacyDec + AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error +} diff --git a/x/vaults/types/genesis.go b/x/vaults/types/genesis.go new file mode 100644 index 00000000..f2689b73 --- /dev/null +++ b/x/vaults/types/genesis.go @@ -0,0 +1,20 @@ +package types + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/vaults/types/genesis.pb.go b/x/vaults/types/genesis.pb.go new file mode 100644 index 00000000..6757476d --- /dev/null +++ b/x/vaults/types/genesis.pb.go @@ -0,0 +1,568 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/genesis.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// GenesisState defines the oracle module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + VaultManagers []VaultMamager `protobuf:"bytes,2,rep,name=vault_managers,json=vaultManagers,proto3" json:"vault_managers"` + Vaults []Vault `protobuf:"bytes,3,rep,name=vaults,proto3" json:"vaults"` + LastUpdate *LastUpdate `protobuf:"bytes,4,opt,name=last_update,json=lastUpdate,proto3" json:"last_update,omitempty"` + ShortfallAmount cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=shortfall_amount,json=shortfallAmount,proto3,customtype=cosmossdk.io/math.Int" json:"shortfall_amount"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ff2064c061e4b65e, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetVaultManagers() []VaultMamager { + if m != nil { + return m.VaultManagers + } + return nil +} + +func (m *GenesisState) GetVaults() []Vault { + if m != nil { + return m.Vaults + } + return nil +} + +func (m *GenesisState) GetLastUpdate() *LastUpdate { + if m != nil { + return m.LastUpdate + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "reserve.vaults.GenesisState") +} + +func init() { proto.RegisterFile("reserve/vaults/genesis.proto", fileDescriptor_ff2064c061e4b65e) } + +var fileDescriptor_ff2064c061e4b65e = []byte{ + // 387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x4e, 0xea, 0x40, + 0x18, 0x85, 0x5b, 0xb8, 0x97, 0x84, 0xe1, 0x5e, 0xd4, 0x46, 0x4c, 0xad, 0xa4, 0x10, 0x57, 0xc4, + 0xc4, 0x8e, 0xc1, 0x8d, 0xc6, 0x95, 0x6c, 0x0c, 0x89, 0x1a, 0x83, 0xd1, 0x85, 0x2e, 0x9a, 0x01, + 0xc6, 0xd2, 0xd8, 0x99, 0x69, 0x3a, 0x53, 0x22, 0x6f, 0xe1, 0x63, 0xb8, 0x74, 0xe1, 0x43, 0xb0, + 0x24, 0xae, 0x8c, 0x0b, 0x62, 0x60, 0xe1, 0xca, 0x77, 0x30, 0x9d, 0x29, 0x44, 0x88, 0x9b, 0x76, + 0xda, 0x73, 0xce, 0xd7, 0xd3, 0xff, 0x07, 0xe5, 0x08, 0x73, 0x1c, 0xf5, 0x31, 0xec, 0xa3, 0x38, + 0x10, 0x1c, 0x7a, 0x98, 0x62, 0xee, 0x73, 0x27, 0x8c, 0x98, 0x60, 0x46, 0x31, 0x55, 0x1d, 0xa5, + 0x5a, 0xeb, 0x1e, 0xf3, 0x98, 0x94, 0x60, 0x72, 0x52, 0x2e, 0x6b, 0x6b, 0x89, 0x11, 0xa2, 0x08, + 0x91, 0x14, 0x61, 0xad, 0x21, 0xe2, 0x53, 0x06, 0xe5, 0x35, 0x7d, 0xb5, 0xd9, 0x61, 0x9c, 0x30, + 0xee, 0x2a, 0x90, 0x7a, 0x50, 0xd2, 0xf6, 0x57, 0x06, 0xfc, 0x3b, 0x51, 0x15, 0x2e, 0x05, 0x12, + 0xd8, 0x38, 0x04, 0x39, 0x85, 0x33, 0xf5, 0xaa, 0x5e, 0x2b, 0xd4, 0x37, 0x9c, 0xc5, 0x4a, 0xce, + 0x85, 0x54, 0x1b, 0xf9, 0xe1, 0xb8, 0xa2, 0x3d, 0x7d, 0x3e, 0xef, 0xe8, 0xad, 0x34, 0x60, 0x9c, + 0x83, 0xa2, 0xf4, 0xb8, 0x04, 0x51, 0xe4, 0xe1, 0x88, 0x9b, 0x99, 0x6a, 0xb6, 0x56, 0xa8, 0x97, + 0x97, 0x11, 0xd7, 0xc9, 0xed, 0x0c, 0x91, 0xc4, 0xf4, 0x13, 0xf4, 0xbf, 0xaf, 0x04, 0x95, 0x36, + 0x0e, 0x40, 0x4e, 0x05, 0xcc, 0xac, 0xe4, 0x94, 0x7e, 0xe5, 0x2c, 0x34, 0x51, 0x82, 0x71, 0x04, + 0x0a, 0x01, 0xe2, 0xc2, 0x8d, 0xc3, 0x2e, 0x12, 0xd8, 0xfc, 0x23, 0xff, 0xc4, 0x5a, 0x8e, 0x9f, + 0x22, 0x2e, 0xae, 0xa4, 0xa3, 0x05, 0x82, 0xf9, 0xd9, 0xb8, 0x05, 0xab, 0xbc, 0xc7, 0x22, 0x71, + 0x87, 0x82, 0xc0, 0x45, 0x84, 0xc5, 0x54, 0x98, 0x7f, 0xab, 0x7a, 0x2d, 0xdf, 0xd8, 0x4b, 0xbe, + 0xf4, 0x3e, 0xae, 0x94, 0xd4, 0x08, 0x79, 0xf7, 0xde, 0xf1, 0x19, 0x24, 0x48, 0xf4, 0x9c, 0x26, + 0x15, 0xaf, 0x2f, 0xbb, 0x20, 0x9d, 0x6d, 0x93, 0x0a, 0x55, 0x68, 0x65, 0x4e, 0x3a, 0x96, 0xa0, + 0x46, 0x73, 0x38, 0xb1, 0xf5, 0xd1, 0xc4, 0xd6, 0x3f, 0x26, 0xb6, 0xfe, 0x38, 0xb5, 0xb5, 0xd1, + 0xd4, 0xd6, 0xde, 0xa6, 0xb6, 0x76, 0x03, 0x3d, 0x5f, 0xf4, 0xe2, 0xb6, 0xd3, 0x61, 0x04, 0x32, + 0xca, 0xc8, 0x40, 0x2e, 0xa8, 0xc3, 0x02, 0x38, 0xdb, 0xf6, 0xc3, 0x6c, 0xdf, 0x62, 0x10, 0x62, + 0xde, 0xce, 0x49, 0xc3, 0xfe, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x9e, 0x72, 0x47, 0x52, + 0x02, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.ShortfallAmount.Size() + i -= size + if _, err := m.ShortfallAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.LastUpdate != nil { + { + size, err := m.LastUpdate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Vaults) > 0 { + for iNdEx := len(m.Vaults) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Vaults[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.VaultManagers) > 0 { + for iNdEx := len(m.VaultManagers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.VaultManagers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.VaultManagers) > 0 { + for _, e := range m.VaultManagers { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Vaults) > 0 { + for _, e := range m.Vaults { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.LastUpdate != nil { + l = m.LastUpdate.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + l = m.ShortfallAmount.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultManagers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VaultManagers = append(m.VaultManagers, VaultMamager{}) + if err := m.VaultManagers[len(m.VaultManagers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vaults", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Vaults = append(m.Vaults, Vault{}) + if err := m.Vaults[len(m.Vaults)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpdate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastUpdate == nil { + m.LastUpdate = &LastUpdate{} + } + if err := m.LastUpdate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShortfallAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ShortfallAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/vaults/types/keys.go b/x/vaults/types/keys.go new file mode 100644 index 00000000..23877101 --- /dev/null +++ b/x/vaults/types/keys.go @@ -0,0 +1,22 @@ +package types + +import "cosmossdk.io/collections" + +const ( + ModuleName = "vaults" + + // StoreKey is the string store representation + StoreKey = ModuleName + + ReserveModuleName = "reserve" + RouterKey = ModuleName +) + +var ( + ParamsKey = collections.NewPrefix(1) + VaultKeyPrefix = collections.NewPrefix(2) + VaultManagerKeyPrefix = collections.NewPrefix(3) + VaultSequenceKeyPrefix = collections.NewPrefix(4) + LastUpdateKeyPrefix = collections.NewPrefix(5) + ShortfallKeyPrefix = collections.NewPrefix(6) +) diff --git a/x/vaults/types/liquidation.go b/x/vaults/types/liquidation.go new file mode 100644 index 00000000..e1d22c98 --- /dev/null +++ b/x/vaults/types/liquidation.go @@ -0,0 +1,11 @@ +package types + +// this line is used by starport scaffolding # 1 + +func NewEmptyLiquidation(denom string) *Liquidation { + return &Liquidation{ + Denom: denom, + LiquidatingVaults: []*Vault{}, + VaultLiquidationStatus: make(map[uint64]*VaultLiquidationStatus), + } +} diff --git a/x/vaults/types/msgs.go b/x/vaults/types/msgs.go new file mode 100644 index 00000000..ef34e08e --- /dev/null +++ b/x/vaults/types/msgs.go @@ -0,0 +1,142 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + ProposalTypeActiveCollateralProposal string = "ActiveCollateralProposal" + ProposalTypeUpdatesCollateralProposal string = "UpdatesCollateralProposal" +) + +var ( + Query_serviceDesc = _Query_serviceDesc + Msg_serviceDesc = _Msg_serviceDesc +) + +func NewMsgCreateVault(owner string, collateral, minted sdk.Coin) MsgCreateVault { + return MsgCreateVault{ + Owner: owner, + Collateral: collateral, + Minted: minted, + } +} + +func NewMsgDeposit(vaultId uint64, sender string, amount sdk.Coin) MsgDeposit { + return MsgDeposit{ + VaultId: vaultId, + Sender: sender, + Amount: amount, + } +} + +func NewMsgWithdraw(vaultId uint64, sender string, amount sdk.Coin) MsgWithdraw { + return MsgWithdraw{ + VaultId: vaultId, + Sender: sender, + Amount: amount, + } +} + +func NewMsgMint(vaultId uint64, sender string, amount sdk.Coin) MsgMint { + return MsgMint{ + VaultId: vaultId, + Sender: sender, + Amount: amount, + } +} + +func NewMsgRepay(vaultId uint64, sender string, amount sdk.Coin) MsgRepay { + return MsgRepay{ + VaultId: vaultId, + Sender: sender, + Amount: amount, + } +} + +func NewMsgClose(vaultId uint64, sender string) MsgClose { + return MsgClose{ + VaultId: vaultId, + Sender: sender, + } +} + +var _ govtypes.Content = &ActiveCollateralProposal{} +var _ govtypes.Content = &UpdatesCollateralProposal{} + +func (m *ActiveCollateralProposal) GetDescription() string { + return " " +} + +func (m *ActiveCollateralProposal) GetTitle() string { + return " " +} + +func (m *ActiveCollateralProposal) ProposalRoute() string { + return RouterKey +} + +func (m *ActiveCollateralProposal) ProposalType() string { + return ProposalTypeActiveCollateralProposal +} + +func (m *ActiveCollateralProposal) ValidateBasic() error { + a := m.ActiveCollateral + if a.Denom == "" { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "empty denom") + } + + if a.MinCollateralRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + if a.LiquidationRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + if a.MaxDebt.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + return nil +} + +func (m *UpdatesCollateralProposal) GetDescription() string { + return " " +} + +func (m *UpdatesCollateralProposal) GetTitle() string { + return " " +} + +func (m *UpdatesCollateralProposal) ProposalRoute() string { + return RouterKey +} + +func (m *UpdatesCollateralProposal) ProposalType() string { + return ProposalTypeActiveCollateralProposal +} + +func (m *UpdatesCollateralProposal) ValidateBasic() error { + a := m.UpdatesCollateral + if a.Denom == "" { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "empty denom") + } + + if a.MinCollateralRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + if a.LiquidationRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + if a.MaxDebt.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + return nil +} diff --git a/x/vaults/types/params.go b/x/vaults/types/params.go new file mode 100644 index 00000000..52c4c799 --- /dev/null +++ b/x/vaults/types/params.go @@ -0,0 +1,123 @@ +package types + +import ( + "fmt" + "time" + + "cosmossdk.io/math" +) + +var ( + DefaultMintingFee = math.LegacyMustNewDecFromStr("0.05") + DefaultStabilityFee = math.LegacyMustNewDecFromStr("0.05") + DefaultLiquidationPenalty = math.LegacyMustNewDecFromStr("0.05") + DefaultMinInitialDebt = math.NewInt(20_000_000) + DefaultRecalculateDebtPeriod = time.Hour + DefaultLiquidatePeriod = time.Hour + DefaultMintDenom = "nomUSD" + + KeyMintingFee = []byte("MintingFee") + KeyStabilityFee = []byte("StabilityFee") + KeyLiquidationPenalty = []byte("LiquidationPenalty") + KeyMinInitialDebt = []byte("MinInitialDebt") + KeyRecalculateDebtPeriod = []byte("RecalculateDebtPeriod") + KeyLiquidatePeriod = []byte("LiquidatePeriod") +) + +// NewParams creates a new Params instance. +func NewParams( + minInitialDebt math.Int, + mintDenom string, + chargingPeriod time.Duration, + liquidatePeriod time.Duration, +) Params { + return Params{ + MinInitialDebt: minInitialDebt, + LiquidatePeriod: liquidatePeriod, + ChargingPeriod: chargingPeriod, + MintDenom: mintDenom, + } +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return NewParams( + DefaultMinInitialDebt, + DefaultMintDenom, + DefaultRecalculateDebtPeriod, + DefaultLiquidatePeriod, + ) +} + +// Validate validates the set of params. +func (m Params) Validate() error { + if err := validateMinInitialDebt(m.MinInitialDebt); err != nil { + return err + } + if err := validateRecalculateDebtPeriod(m.ChargingPeriod); err != nil { + return err + } + if err := validateLiquidatePeriod(m.LiquidatePeriod); err != nil { + return err + } + return nil +} + +func validateRecalculateDebtPeriod(i interface{}) error { + return nil +} +func validateLiquidatePeriod(i interface{}) error { + return nil +} + +func validateStabilityFee(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} + +func validateLiquidationPenalty(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} + +func validateMinInitialDebt(i interface{}) error { + v, ok := i.(math.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} + +func validateMintingFee(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) + } + + return nil +} diff --git a/x/vaults/types/params.pb.go b/x/vaults/types/params.pb.go new file mode 100644 index 00000000..6cf27bb2 --- /dev/null +++ b/x/vaults/types/params.pb.go @@ -0,0 +1,2514 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/params.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// VaultStatus is the status of a vault. +type VaultStatus int32 + +const ( + // ACTIVE - vault is in use and can be changed + ACTIVE VaultStatus = 0 + // LIQUIDATING - vault is being liquidated by the vault manager, and cannot be + // changed by the user. If liquidation fails, vaults may remain in this state. + // An upgrade might be able to recover them. + LIQUIDATING VaultStatus = 1 + // TRANSFER - vault is able to be transferred (payments and debits frozen + // until it has a new owner) + TRANSFER VaultStatus = 2 + // CLOSED - vault was closed by the user and all assets have been paid out + CLOSED VaultStatus = 3 + // LIQUIDATED - vault was closed by the manager, with remaining assets paid to + // owner + LIQUIDATED VaultStatus = 4 +) + +var VaultStatus_name = map[int32]string{ + 0: "ACTIVE", + 1: "LIQUIDATING", + 2: "TRANSFER", + 3: "CLOSED", + 4: "LIQUIDATED", +} + +var VaultStatus_value = map[string]int32{ + "ACTIVE": 0, + "LIQUIDATING": 1, + "TRANSFER": 2, + "CLOSED": 3, + "LIQUIDATED": 4, +} + +func (x VaultStatus) String() string { + return proto.EnumName(VaultStatus_name, int32(x)) +} + +func (VaultStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{0} +} + +// Params defines the parameters for the module. +type Params struct { + MinInitialDebt cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=min_initial_debt,json=minInitialDebt,proto3,customtype=cosmossdk.io/math.Int" json:"min_initial_debt"` + MintDenom string `protobuf:"bytes,2,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` + ChargingPeriod time.Duration `protobuf:"bytes,3,opt,name=charging_period,json=chargingPeriod,proto3,stdduration" json:"charging_period"` + LiquidatePeriod time.Duration `protobuf:"bytes,4,opt,name=liquidate_period,json=liquidatePeriod,proto3,stdduration" json:"liquidate_period"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMintDenom() string { + if m != nil { + return m.MintDenom + } + return "" +} + +func (m *Params) GetChargingPeriod() time.Duration { + if m != nil { + return m.ChargingPeriod + } + return 0 +} + +func (m *Params) GetLiquidatePeriod() time.Duration { + if m != nil { + return m.LiquidatePeriod + } + return 0 +} + +// VaultParams defines the parameters for each collateral vault type. +type VaultMamagerParams struct { + MinCollateralRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_collateral_ratio"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + MaxDebt cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=max_debt,json=maxDebt,proto3,customtype=cosmossdk.io/math.Int" json:"max_debt"` + StabilityFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=stability_fee,json=stabilityFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stability_fee"` + LiquidationPenalty cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_penalty"` + MintingFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=minting_fee,json=mintingFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"minting_fee"` +} + +func (m *VaultMamagerParams) Reset() { *m = VaultMamagerParams{} } +func (m *VaultMamagerParams) String() string { return proto.CompactTextString(m) } +func (*VaultMamagerParams) ProtoMessage() {} +func (*VaultMamagerParams) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{1} +} +func (m *VaultMamagerParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VaultMamagerParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VaultMamagerParams.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 *VaultMamagerParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VaultMamagerParams.Merge(m, src) +} +func (m *VaultMamagerParams) XXX_Size() int { + return m.Size() +} +func (m *VaultMamagerParams) XXX_DiscardUnknown() { + xxx_messageInfo_VaultMamagerParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VaultMamagerParams proto.InternalMessageInfo + +// VaultMamager defines the manager of each collateral vault type. +type VaultMamager struct { + Params VaultMamagerParams `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + MintAvailable cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=mint_available,json=mintAvailable,proto3,customtype=cosmossdk.io/math.Int" json:"mint_available"` +} + +func (m *VaultMamager) Reset() { *m = VaultMamager{} } +func (m *VaultMamager) String() string { return proto.CompactTextString(m) } +func (*VaultMamager) ProtoMessage() {} +func (*VaultMamager) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{2} +} +func (m *VaultMamager) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VaultMamager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VaultMamager.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 *VaultMamager) XXX_Merge(src proto.Message) { + xxx_messageInfo_VaultMamager.Merge(m, src) +} +func (m *VaultMamager) XXX_Size() int { + return m.Size() +} +func (m *VaultMamager) XXX_DiscardUnknown() { + xxx_messageInfo_VaultMamager.DiscardUnknown(m) +} + +var xxx_messageInfo_VaultMamager proto.InternalMessageInfo + +func (m *VaultMamager) GetParams() VaultMamagerParams { + if m != nil { + return m.Params + } + return VaultMamagerParams{} +} + +func (m *VaultMamager) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type Vault struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Debt types.Coin `protobuf:"bytes,3,opt,name=debt,proto3" json:"debt"` + CollateralLocked types.Coin `protobuf:"bytes,4,opt,name=collateral_locked,json=collateralLocked,proto3" json:"collateral_locked"` + Status VaultStatus `protobuf:"varint,5,opt,name=status,proto3,enum=reserve.vaults.VaultStatus" json:"status,omitempty"` + LiquidationPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=liquidation_price,json=liquidationPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_price"` + Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *Vault) Reset() { *m = Vault{} } +func (m *Vault) String() string { return proto.CompactTextString(m) } +func (*Vault) ProtoMessage() {} +func (*Vault) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{3} +} +func (m *Vault) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vault.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 *Vault) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vault.Merge(m, src) +} +func (m *Vault) XXX_Size() int { + return m.Size() +} +func (m *Vault) XXX_DiscardUnknown() { + xxx_messageInfo_Vault.DiscardUnknown(m) +} + +var xxx_messageInfo_Vault proto.InternalMessageInfo + +func (m *Vault) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Vault) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *Vault) GetDebt() types.Coin { + if m != nil { + return m.Debt + } + return types.Coin{} +} + +func (m *Vault) GetCollateralLocked() types.Coin { + if m != nil { + return m.CollateralLocked + } + return types.Coin{} +} + +func (m *Vault) GetStatus() VaultStatus { + if m != nil { + return m.Status + } + return ACTIVE +} + +func (m *Vault) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +type VaultLiquidationStatus struct { + Sold types.Coin `protobuf:"bytes,4,opt,name=sold,proto3" json:"sold"` + RemainCollateral types.Coin `protobuf:"bytes,5,opt,name=remain_collateral,json=remainCollateral,proto3" json:"remain_collateral"` +} + +func (m *VaultLiquidationStatus) Reset() { *m = VaultLiquidationStatus{} } +func (m *VaultLiquidationStatus) String() string { return proto.CompactTextString(m) } +func (*VaultLiquidationStatus) ProtoMessage() {} +func (*VaultLiquidationStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{4} +} +func (m *VaultLiquidationStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VaultLiquidationStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VaultLiquidationStatus.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 *VaultLiquidationStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_VaultLiquidationStatus.Merge(m, src) +} +func (m *VaultLiquidationStatus) XXX_Size() int { + return m.Size() +} +func (m *VaultLiquidationStatus) XXX_DiscardUnknown() { + xxx_messageInfo_VaultLiquidationStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_VaultLiquidationStatus proto.InternalMessageInfo + +func (m *VaultLiquidationStatus) GetSold() types.Coin { + if m != nil { + return m.Sold + } + return types.Coin{} +} + +func (m *VaultLiquidationStatus) GetRemainCollateral() types.Coin { + if m != nil { + return m.RemainCollateral + } + return types.Coin{} +} + +type Liquidation struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + LiquidatingVaults []*Vault `protobuf:"bytes,3,rep,name=liquidating_vaults,json=liquidatingVaults,proto3" json:"liquidating_vaults,omitempty"` + VaultLiquidationStatus map[uint64]*VaultLiquidationStatus `protobuf:"bytes,4,rep,name=vault_liquidation_status,json=vaultLiquidationStatus,proto3" json:"vault_liquidation_status,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *Liquidation) Reset() { *m = Liquidation{} } +func (m *Liquidation) String() string { return proto.CompactTextString(m) } +func (*Liquidation) ProtoMessage() {} +func (*Liquidation) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{5} +} +func (m *Liquidation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Liquidation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Liquidation.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 *Liquidation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Liquidation.Merge(m, src) +} +func (m *Liquidation) XXX_Size() int { + return m.Size() +} +func (m *Liquidation) XXX_DiscardUnknown() { + xxx_messageInfo_Liquidation.DiscardUnknown(m) +} + +var xxx_messageInfo_Liquidation proto.InternalMessageInfo + +func (m *Liquidation) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *Liquidation) GetLiquidatingVaults() []*Vault { + if m != nil { + return m.LiquidatingVaults + } + return nil +} + +func (m *Liquidation) GetVaultLiquidationStatus() map[uint64]*VaultLiquidationStatus { + if m != nil { + return m.VaultLiquidationStatus + } + return nil +} + +type LastUpdate struct { + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` +} + +func (m *LastUpdate) Reset() { *m = LastUpdate{} } +func (m *LastUpdate) String() string { return proto.CompactTextString(m) } +func (*LastUpdate) ProtoMessage() {} +func (*LastUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_1f12ab0d072f9f7c, []int{6} +} +func (m *LastUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LastUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LastUpdate.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 *LastUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastUpdate.Merge(m, src) +} +func (m *LastUpdate) XXX_Size() int { + return m.Size() +} +func (m *LastUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_LastUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_LastUpdate proto.InternalMessageInfo + +func (m *LastUpdate) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func init() { + proto.RegisterEnum("reserve.vaults.VaultStatus", VaultStatus_name, VaultStatus_value) + proto.RegisterType((*Params)(nil), "reserve.vaults.Params") + proto.RegisterType((*VaultMamagerParams)(nil), "reserve.vaults.VaultMamagerParams") + proto.RegisterType((*VaultMamager)(nil), "reserve.vaults.VaultMamager") + proto.RegisterType((*Vault)(nil), "reserve.vaults.Vault") + proto.RegisterType((*VaultLiquidationStatus)(nil), "reserve.vaults.VaultLiquidationStatus") + proto.RegisterType((*Liquidation)(nil), "reserve.vaults.Liquidation") + proto.RegisterMapType((map[uint64]*VaultLiquidationStatus)(nil), "reserve.vaults.Liquidation.VaultLiquidationStatusEntry") + proto.RegisterType((*LastUpdate)(nil), "reserve.vaults.LastUpdate") +} + +func init() { proto.RegisterFile("reserve/vaults/params.proto", fileDescriptor_1f12ab0d072f9f7c) } + +var fileDescriptor_1f12ab0d072f9f7c = []byte{ + // 1065 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x4f, 0x1b, 0x47, + 0x14, 0xf7, 0xda, 0xc6, 0x49, 0x9e, 0x83, 0x31, 0x53, 0x42, 0x1d, 0xa3, 0x1a, 0xcb, 0x87, 0x0a, + 0x21, 0x65, 0xb7, 0x71, 0xa4, 0x36, 0x8a, 0xda, 0x03, 0x60, 0x53, 0x59, 0x71, 0x53, 0x58, 0x48, + 0x22, 0xa5, 0x07, 0x6b, 0xbc, 0x9e, 0x2c, 0x23, 0x76, 0x77, 0xcc, 0xee, 0xd8, 0xc5, 0xdf, 0xa0, + 0xe2, 0x94, 0x63, 0x2f, 0x48, 0xfd, 0xa3, 0x4a, 0x3d, 0xe6, 0x90, 0x8f, 0xd0, 0x43, 0x2e, 0x55, + 0xa2, 0x9c, 0xaa, 0x1e, 0xd2, 0x0a, 0x0e, 0xe9, 0xc7, 0xa8, 0xe6, 0xcf, 0xda, 0x1b, 0x40, 0x6d, + 0x02, 0x17, 0xcb, 0x33, 0xf3, 0xde, 0x6f, 0xde, 0xfb, 0xbd, 0xdf, 0x7b, 0xb3, 0xb0, 0x10, 0x92, + 0x88, 0x84, 0x43, 0x62, 0x0d, 0xf1, 0xc0, 0xe3, 0x91, 0xd5, 0xc7, 0x21, 0xf6, 0x23, 0xb3, 0x1f, + 0x32, 0xce, 0x50, 0x41, 0x1f, 0x9a, 0xea, 0xb0, 0x3c, 0xe7, 0x32, 0x97, 0xc9, 0x23, 0x4b, 0xfc, + 0x53, 0x56, 0xe5, 0x59, 0xec, 0xd3, 0x80, 0x59, 0xf2, 0x57, 0x6f, 0x55, 0x1c, 0x16, 0xf9, 0x2c, + 0xb2, 0xba, 0x38, 0x22, 0xd6, 0xf0, 0x66, 0x97, 0x70, 0x7c, 0xd3, 0x72, 0x18, 0x0d, 0xf4, 0xf9, + 0x75, 0x75, 0xde, 0x51, 0x58, 0x6a, 0x11, 0xbb, 0xba, 0x8c, 0xb9, 0x1e, 0xb1, 0xe4, 0xaa, 0x3b, + 0x78, 0x6c, 0xf5, 0x06, 0x21, 0xe6, 0x94, 0xc5, 0xae, 0x8b, 0x27, 0xcf, 0x39, 0xf5, 0x49, 0xc4, + 0xb1, 0xdf, 0x57, 0x06, 0xb5, 0xdf, 0xd3, 0x90, 0xdb, 0x90, 0x59, 0xa0, 0x47, 0x50, 0xf4, 0x69, + 0xd0, 0xa1, 0x01, 0xe5, 0x14, 0x7b, 0x9d, 0x1e, 0xe9, 0xf2, 0x92, 0x51, 0x35, 0x96, 0xae, 0xac, + 0x7e, 0xf2, 0xfc, 0xf5, 0x62, 0xea, 0xcf, 0xd7, 0x8b, 0xd7, 0xd4, 0xdd, 0x51, 0x6f, 0xd7, 0xa4, + 0xcc, 0xf2, 0x31, 0xdf, 0x31, 0x5b, 0x01, 0x7f, 0xf5, 0xec, 0x06, 0xe8, 0xa0, 0x5a, 0x01, 0xff, + 0xf5, 0xcd, 0xd3, 0x65, 0xc3, 0x2e, 0xf8, 0x34, 0x68, 0x29, 0xa0, 0x06, 0xe9, 0x72, 0xf4, 0x11, + 0x80, 0x4f, 0x03, 0xde, 0xe9, 0x91, 0x80, 0xf9, 0xa5, 0xb4, 0x40, 0xb5, 0xaf, 0x88, 0x9d, 0x86, + 0xd8, 0x40, 0x9b, 0x30, 0xe3, 0xec, 0xe0, 0xd0, 0xa5, 0x81, 0xdb, 0xe9, 0x93, 0x90, 0xb2, 0x5e, + 0x29, 0x53, 0x35, 0x96, 0xf2, 0xf5, 0xeb, 0xa6, 0x4a, 0xc0, 0x8c, 0x13, 0x30, 0x1b, 0x3a, 0xc1, + 0xd5, 0x69, 0x11, 0xd4, 0xf7, 0x7f, 0x2d, 0x1a, 0xfa, 0xc6, 0x18, 0x60, 0x43, 0xfa, 0xa3, 0x2d, + 0x28, 0x7a, 0x74, 0x6f, 0x40, 0x7b, 0x98, 0x93, 0x18, 0x33, 0xfb, 0x9e, 0x98, 0x33, 0x63, 0x04, + 0x05, 0x7a, 0xa7, 0xfa, 0xcf, 0x0f, 0x8b, 0xc6, 0xc1, 0x9b, 0xa7, 0xcb, 0x1f, 0xc6, 0x42, 0xd8, + 0x8f, 0xa5, 0xa0, 0x48, 0xac, 0xbd, 0xc8, 0x02, 0x7a, 0x20, 0x76, 0xbe, 0xc2, 0x3e, 0x76, 0x49, + 0xa8, 0xb9, 0xdd, 0x81, 0x39, 0xc1, 0xad, 0xc3, 0x3c, 0x0f, 0x73, 0x12, 0x62, 0xaf, 0x23, 0x6f, + 0xd4, 0xfc, 0x7e, 0xaa, 0xf9, 0x5d, 0x38, 0xcd, 0x6f, 0x9b, 0xb8, 0xd8, 0x19, 0x35, 0x88, 0x93, + 0x60, 0xb9, 0x41, 0x1c, 0x15, 0x1f, 0xf2, 0x69, 0xb0, 0x36, 0x86, 0xb4, 0x05, 0x22, 0x72, 0x60, + 0x36, 0x8e, 0x9a, 0xb2, 0x40, 0x5f, 0x93, 0xbe, 0xd0, 0x35, 0xc5, 0x04, 0xa0, 0xba, 0xe4, 0x2e, + 0x5c, 0xf6, 0xf1, 0xbe, 0x92, 0x48, 0xe6, 0x9c, 0x12, 0xb9, 0xe4, 0xe3, 0x7d, 0xa9, 0x8d, 0x6f, + 0x60, 0x3a, 0xe2, 0xb8, 0x4b, 0x3d, 0xca, 0x47, 0x9d, 0xc7, 0x84, 0xc8, 0x32, 0x9d, 0x3f, 0xda, + 0xab, 0x63, 0xb0, 0x75, 0x42, 0x90, 0x0b, 0x1f, 0x24, 0xe9, 0xe8, 0x93, 0x00, 0x7b, 0x7c, 0x54, + 0x9a, 0xba, 0x18, 0xef, 0x09, 0xc8, 0x0d, 0x85, 0x88, 0x1e, 0x42, 0x5e, 0xe8, 0x59, 0x28, 0x58, + 0xe4, 0x90, 0xbb, 0xd0, 0x05, 0xa0, 0xa1, 0xd6, 0x09, 0xa9, 0xfd, 0x66, 0xc0, 0xd5, 0xa4, 0xa2, + 0x50, 0x13, 0x72, 0x6a, 0xee, 0x48, 0xf5, 0xe4, 0xeb, 0x35, 0xf3, 0xed, 0xc1, 0x63, 0x9e, 0xd6, + 0xdf, 0xea, 0x15, 0x11, 0x88, 0xc2, 0xd6, 0xce, 0x68, 0x0e, 0xa6, 0x92, 0xdd, 0xa8, 0x16, 0xe8, + 0x21, 0x14, 0x64, 0xa3, 0xe2, 0x21, 0xa6, 0x1e, 0xee, 0x7a, 0xe4, 0xdc, 0xf5, 0x9d, 0x16, 0x38, + 0x2b, 0x31, 0x4c, 0xed, 0xa7, 0x0c, 0x4c, 0xc9, 0xc0, 0x50, 0x01, 0xd2, 0xb4, 0x27, 0x63, 0xcf, + 0xda, 0x69, 0xda, 0x43, 0x26, 0x4c, 0xb1, 0x6f, 0x03, 0x12, 0x6a, 0x95, 0x96, 0x5e, 0x3d, 0xbb, + 0x31, 0xa7, 0xc1, 0x56, 0x7a, 0xbd, 0x90, 0x44, 0xd1, 0x16, 0x0f, 0x69, 0xe0, 0xda, 0xca, 0x0c, + 0xdd, 0x86, 0xec, 0x58, 0x78, 0xa2, 0x9b, 0xb5, 0xad, 0x98, 0x9e, 0xa6, 0x9e, 0x9e, 0xe6, 0x1a, + 0xa3, 0x41, 0x32, 0x69, 0xe9, 0x81, 0x36, 0x61, 0x36, 0xd1, 0x81, 0x1e, 0x73, 0x76, 0xc9, 0x64, + 0x28, 0xbc, 0x0b, 0x4c, 0x71, 0xe2, 0xde, 0x96, 0xde, 0xe8, 0x16, 0xe4, 0x22, 0x8e, 0xf9, 0x20, + 0x92, 0x92, 0x2a, 0xd4, 0x17, 0xce, 0x2c, 0xc6, 0x96, 0x34, 0xb1, 0xb5, 0xe9, 0xc9, 0x1e, 0xed, + 0x87, 0xd4, 0xb9, 0xa8, 0x62, 0x92, 0x3d, 0xba, 0x21, 0xf0, 0x50, 0x1d, 0x2e, 0x61, 0x45, 0x5f, + 0xe9, 0xd2, 0xff, 0x10, 0x1b, 0x1b, 0xd6, 0x7e, 0x31, 0x60, 0x5e, 0x06, 0xdc, 0x9e, 0xa0, 0xa9, + 0xd8, 0x05, 0xeb, 0x11, 0xf3, 0xde, 0x8f, 0x2e, 0xe9, 0x21, 0x58, 0x0f, 0x89, 0x8f, 0xdf, 0x1a, + 0x7f, 0x92, 0xad, 0x77, 0x66, 0x5d, 0xb9, 0x4f, 0x26, 0x5d, 0xed, 0x45, 0x1a, 0xf2, 0x89, 0x10, + 0x27, 0x5a, 0x36, 0x92, 0x5a, 0x6e, 0xc0, 0xa4, 0x51, 0x03, 0xb7, 0xa3, 0x0a, 0x52, 0xca, 0x54, + 0x33, 0x4b, 0xf9, 0xfa, 0xb5, 0x33, 0xeb, 0x64, 0xcf, 0x26, 0x1c, 0xe4, 0x4e, 0x84, 0xf6, 0xa0, + 0x24, 0x4d, 0x3a, 0xc9, 0x92, 0xe9, 0x9a, 0x67, 0x25, 0xd6, 0x67, 0x27, 0xb1, 0x12, 0xa1, 0x99, + 0x67, 0xd3, 0xd9, 0x0c, 0x78, 0x38, 0xb2, 0xe7, 0x87, 0x67, 0x1e, 0x96, 0xf7, 0x60, 0xe1, 0x3f, + 0xdc, 0x50, 0x11, 0x32, 0xbb, 0x64, 0xa4, 0x3b, 0x48, 0xfc, 0x45, 0x9f, 0xc3, 0xd4, 0x10, 0x7b, + 0x03, 0x22, 0x5b, 0x28, 0x5f, 0xff, 0xf8, 0xcc, 0xe4, 0x4e, 0xa1, 0xd9, 0xca, 0xe9, 0x4e, 0xfa, + 0xb6, 0x51, 0xbb, 0x0b, 0xd0, 0xc6, 0x11, 0xbf, 0xdf, 0x17, 0xaf, 0x1d, 0xfa, 0x02, 0xb2, 0xe2, + 0x43, 0x41, 0x0f, 0x98, 0xf2, 0xa9, 0x07, 0x73, 0x3b, 0xfe, 0x8a, 0x50, 0x2f, 0xe6, 0x93, 0xf1, + 0x8b, 0x29, 0xdd, 0x96, 0x7f, 0x34, 0x20, 0x9f, 0xd0, 0x3d, 0x9a, 0x87, 0xdc, 0xca, 0xda, 0x76, + 0xeb, 0x41, 0xb3, 0x98, 0x2a, 0xc3, 0xc1, 0x61, 0x55, 0xaf, 0x50, 0x15, 0xf2, 0xed, 0xd6, 0xe6, + 0xfd, 0x56, 0x63, 0x65, 0xbb, 0x75, 0xef, 0xcb, 0xa2, 0x51, 0x9e, 0x39, 0x38, 0xac, 0x26, 0xb7, + 0x50, 0x19, 0x2e, 0x6f, 0xdb, 0x2b, 0xf7, 0xb6, 0xd6, 0x9b, 0x76, 0x31, 0x5d, 0xbe, 0x7a, 0x70, + 0x58, 0x1d, 0xaf, 0x05, 0xea, 0x5a, 0xfb, 0xeb, 0xad, 0x66, 0xa3, 0x98, 0x51, 0xa8, 0x6a, 0x85, + 0x2a, 0x00, 0x31, 0x44, 0xb3, 0x51, 0xcc, 0x96, 0x0b, 0x07, 0x87, 0xd5, 0xc4, 0x4e, 0x39, 0xfb, + 0xdd, 0xcf, 0x95, 0xd4, 0x6a, 0xeb, 0xf9, 0x51, 0xc5, 0x78, 0x79, 0x54, 0x31, 0xfe, 0x3e, 0xaa, + 0x18, 0x4f, 0x8e, 0x2b, 0xa9, 0x97, 0xc7, 0x95, 0xd4, 0x1f, 0xc7, 0x95, 0xd4, 0x23, 0xcb, 0xa5, + 0x7c, 0x67, 0xd0, 0x35, 0x1d, 0xe6, 0x5b, 0x2c, 0x60, 0xfe, 0x48, 0xa6, 0xed, 0x30, 0xcf, 0x3a, + 0xf5, 0xe8, 0xf3, 0x51, 0x9f, 0x44, 0xdd, 0x9c, 0x34, 0xb8, 0xf5, 0x6f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xb7, 0x17, 0xaf, 0x8b, 0x1e, 0x0a, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.MinInitialDebt.Equal(that1.MinInitialDebt) { + return false + } + if this.MintDenom != that1.MintDenom { + return false + } + if this.ChargingPeriod != that1.ChargingPeriod { + return false + } + if this.LiquidatePeriod != that1.LiquidatePeriod { + return false + } + return true +} +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.LiquidatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.LiquidatePeriod):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintParams(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.ChargingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ChargingPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintParams(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + if len(m.MintDenom) > 0 { + i -= len(m.MintDenom) + copy(dAtA[i:], m.MintDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.MintDenom))) + i-- + dAtA[i] = 0x12 + } + { + size := m.MinInitialDebt.Size() + i -= size + if _, err := m.MinInitialDebt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *VaultMamagerParams) 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 *VaultMamagerParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VaultMamagerParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MintingFee.Size() + i -= size + if _, err := m.MintingFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.LiquidationPenalty.Size() + i -= size + if _, err := m.LiquidationPenalty.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.StabilityFee.Size() + i -= size + if _, err := m.StabilityFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.MaxDebt.Size() + i -= size + if _, err := m.MaxDebt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.LiquidationRatio.Size() + i -= size + if _, err := m.LiquidationRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.MinCollateralRatio.Size() + i -= size + if _, err := m.MinCollateralRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *VaultMamager) 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 *VaultMamager) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VaultMamager) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MintAvailable.Size() + i -= size + if _, err := m.MintAvailable.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintParams(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Vault) 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 *Vault) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vault) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintParams(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x3a + } + { + size := m.LiquidationPrice.Size() + i -= size + if _, err := m.LiquidationPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.Status != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x28 + } + { + size, err := m.CollateralLocked.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.Debt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintParams(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *VaultLiquidationStatus) 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 *VaultLiquidationStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VaultLiquidationStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.RemainCollateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.Sold.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + return len(dAtA) - i, nil +} + +func (m *Liquidation) 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 *Liquidation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Liquidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VaultLiquidationStatus) > 0 { + for k := range m.VaultLiquidationStatus { + v := m.VaultLiquidationStatus[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i = encodeVarintParams(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintParams(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if len(m.LiquidatingVaults) > 0 { + for iNdEx := len(m.LiquidatingVaults) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LiquidatingVaults[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintParams(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LastUpdate) 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 *LastUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LastUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintParams(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinInitialDebt.Size() + n += 1 + l + sovParams(uint64(l)) + l = len(m.MintDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ChargingPeriod) + n += 1 + l + sovParams(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.LiquidatePeriod) + n += 1 + l + sovParams(uint64(l)) + return n +} + +func (m *VaultMamagerParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinCollateralRatio.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.LiquidationRatio.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MaxDebt.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.StabilityFee.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.LiquidationPenalty.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MintingFee.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func (m *VaultMamager) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovParams(uint64(l)) + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = m.MintAvailable.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func (m *Vault) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovParams(uint64(m.Id)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = m.Debt.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.CollateralLocked.Size() + n += 1 + l + sovParams(uint64(l)) + if m.Status != 0 { + n += 1 + sovParams(uint64(m.Status)) + } + l = m.LiquidationPrice.Size() + n += 1 + l + sovParams(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func (m *VaultLiquidationStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sold.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.RemainCollateral.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func (m *Liquidation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if len(m.LiquidatingVaults) > 0 { + for _, e := range m.LiquidatingVaults { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + if len(m.VaultLiquidationStatus) > 0 { + for k, v := range m.VaultLiquidationStatus { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovParams(uint64(l)) + } + mapEntrySize := 1 + sovParams(uint64(k)) + l + n += mapEntrySize + 1 + sovParams(uint64(mapEntrySize)) + } + } + return n +} + +func (m *LastUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinInitialDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MintDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChargingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.ChargingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidatePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.LiquidatePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VaultMamagerParams) 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 ErrIntOverflowParams + } + 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: VaultMamagerParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VaultMamagerParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinCollateralRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StabilityFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StabilityFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationPenalty", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationPenalty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintingFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintingFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VaultMamager) 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 ErrIntOverflowParams + } + 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: VaultMamager: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VaultMamager: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintAvailable", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintAvailable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vault) 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 ErrIntOverflowParams + } + 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: Vault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Debt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Debt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CollateralLocked", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CollateralLocked.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= VaultStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VaultLiquidationStatus) 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 ErrIntOverflowParams + } + 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: VaultLiquidationStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VaultLiquidationStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sold", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemainCollateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RemainCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Liquidation) 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 ErrIntOverflowParams + } + 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: Liquidation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Liquidation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidatingVaults", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LiquidatingVaults = append(m.LiquidatingVaults, &Vault{}) + if err := m.LiquidatingVaults[len(m.LiquidatingVaults)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultLiquidationStatus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VaultLiquidationStatus == nil { + m.VaultLiquidationStatus = make(map[uint64]*VaultLiquidationStatus) + } + var mapkey uint64 + var mapvalue *VaultLiquidationStatus + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthParams + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthParams + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &VaultLiquidationStatus{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.VaultLiquidationStatus[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LastUpdate) 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 ErrIntOverflowParams + } + 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: LastUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LastUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/vaults/types/proposal.pb.go b/x/vaults/types/proposal.pb.go new file mode 100644 index 00000000..723b7060 --- /dev/null +++ b/x/vaults/types/proposal.pb.go @@ -0,0 +1,666 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/proposal.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 ActiveCollateralProposal 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"` + ActiveCollateral MsgActiveCollateral `protobuf:"bytes,3,opt,name=active_collateral,json=activeCollateral,proto3" json:"active_collateral"` +} + +func (m *ActiveCollateralProposal) Reset() { *m = ActiveCollateralProposal{} } +func (m *ActiveCollateralProposal) String() string { return proto.CompactTextString(m) } +func (*ActiveCollateralProposal) ProtoMessage() {} +func (*ActiveCollateralProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_784ca0e6565c75e5, []int{0} +} +func (m *ActiveCollateralProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ActiveCollateralProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ActiveCollateralProposal.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 *ActiveCollateralProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_ActiveCollateralProposal.Merge(m, src) +} +func (m *ActiveCollateralProposal) XXX_Size() int { + return m.Size() +} +func (m *ActiveCollateralProposal) XXX_DiscardUnknown() { + xxx_messageInfo_ActiveCollateralProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_ActiveCollateralProposal proto.InternalMessageInfo + +type UpdatesCollateralProposal 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"` + UpdatesCollateral MsgUpdatesCollateral `protobuf:"bytes,3,opt,name=updates_collateral,json=updatesCollateral,proto3" json:"updates_collateral"` +} + +func (m *UpdatesCollateralProposal) Reset() { *m = UpdatesCollateralProposal{} } +func (m *UpdatesCollateralProposal) String() string { return proto.CompactTextString(m) } +func (*UpdatesCollateralProposal) ProtoMessage() {} +func (*UpdatesCollateralProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_784ca0e6565c75e5, []int{1} +} +func (m *UpdatesCollateralProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdatesCollateralProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdatesCollateralProposal.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 *UpdatesCollateralProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdatesCollateralProposal.Merge(m, src) +} +func (m *UpdatesCollateralProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdatesCollateralProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdatesCollateralProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdatesCollateralProposal proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ActiveCollateralProposal)(nil), "reserve.vaults.ActiveCollateralProposal") + proto.RegisterType((*UpdatesCollateralProposal)(nil), "reserve.vaults.UpdatesCollateralProposal") +} + +func init() { proto.RegisterFile("reserve/vaults/proposal.proto", fileDescriptor_784ca0e6565c75e5) } + +var fileDescriptor_784ca0e6565c75e5 = []byte{ + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0x29, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc8, + 0x2f, 0x4e, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xeb, 0x41, 0xa4, + 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x38, 0x9a, + 0x21, 0x25, 0x15, 0x50, 0x09, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, 0x7d, 0x30, 0x09, 0x15, 0x92, + 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x87, 0x18, 0x02, 0xe1, 0x40, 0xa4, 0x94, 0x3e, 0x33, + 0x72, 0x49, 0x38, 0x26, 0x97, 0x64, 0x96, 0xa5, 0x3a, 0xe7, 0xe7, 0xe4, 0x24, 0x96, 0xa4, 0x16, + 0x25, 0xe6, 0x04, 0x40, 0xdd, 0x23, 0x24, 0xc2, 0xc5, 0x5a, 0x92, 0x59, 0x92, 0x93, 0x2a, 0xc1, + 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe1, 0x08, 0x29, 0x70, 0x71, 0xa7, 0xa4, 0x16, 0x27, 0x17, + 0x65, 0x16, 0x94, 0x64, 0xe6, 0xe7, 0x49, 0x30, 0x81, 0xe5, 0x90, 0x85, 0x84, 0xc2, 0xb8, 0x04, + 0x13, 0xc1, 0x66, 0xc6, 0x27, 0xc3, 0x0d, 0x95, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x36, 0x52, 0xd6, + 0x43, 0xf5, 0x9d, 0x9e, 0x6f, 0x71, 0x3a, 0xba, 0xfd, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, + 0x09, 0x24, 0xa2, 0x89, 0x5b, 0xb9, 0x77, 0x2c, 0x90, 0x67, 0x38, 0xb5, 0x45, 0x57, 0x0a, 0xea, + 0x85, 0xf4, 0xfc, 0x32, 0xbd, 0x32, 0xc3, 0xa4, 0xd4, 0x92, 0x44, 0x43, 0x3d, 0xe7, 0xfc, 0xbc, + 0x92, 0xd4, 0xbc, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x14, 0x60, 0x41, 0x83, 0xcb, 0x63, 0x4a, 0x3f, + 0x18, 0xb9, 0x24, 0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x8b, 0xa9, 0xe8, 0xed, 0x48, 0x2e, 0xa1, + 0x52, 0x88, 0xa1, 0x98, 0xfe, 0x56, 0xc1, 0xe2, 0x6f, 0x0c, 0x17, 0x40, 0x3d, 0x2e, 0x58, 0x8a, + 0x2e, 0x61, 0xe5, 0x41, 0x9c, 0xcf, 0x15, 0x61, 0x3e, 0xc7, 0xe9, 0x39, 0x27, 0xcf, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, + 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, 0xcb, 0xcf, 0xad, 0x04, 0xa7, 0x90, 0xe4, 0xfc, 0x1c, 0x7d, + 0x98, 0xa9, 0x15, 0xf0, 0xc4, 0x56, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x56, 0x60, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0x62, 0xbd, 0x9e, 0x9d, 0xd0, 0x02, 0x00, 0x00, +} + +func (m *ActiveCollateralProposal) 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 *ActiveCollateralProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ActiveCollateralProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ActiveCollateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + 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 *UpdatesCollateralProposal) 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 *UpdatesCollateralProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdatesCollateralProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.UpdatesCollateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + 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 *ActiveCollateralProposal) 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 = m.ActiveCollateral.Size() + n += 1 + l + sovProposal(uint64(l)) + return n +} + +func (m *UpdatesCollateralProposal) 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 = m.UpdatesCollateral.Size() + 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 *ActiveCollateralProposal) 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: ActiveCollateralProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ActiveCollateralProposal: 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 ActiveCollateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ActiveCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *UpdatesCollateralProposal) 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: UpdatesCollateralProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdatesCollateralProposal: 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 UpdatesCollateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.UpdatesCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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") +) diff --git a/x/vaults/types/query.pb.go b/x/vaults/types/query.pb.go new file mode 100644 index 00000000..49a89fda --- /dev/null +++ b/x/vaults/types/query.pb.go @@ -0,0 +1,1592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryVaultIdRequest struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` +} + +func (m *QueryVaultIdRequest) Reset() { *m = QueryVaultIdRequest{} } +func (m *QueryVaultIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVaultIdRequest) ProtoMessage() {} +func (*QueryVaultIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{2} +} +func (m *QueryVaultIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVaultIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVaultIdRequest.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 *QueryVaultIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVaultIdRequest.Merge(m, src) +} +func (m *QueryVaultIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVaultIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVaultIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVaultIdRequest proto.InternalMessageInfo + +func (m *QueryVaultIdRequest) GetVaultId() uint64 { + if m != nil { + return m.VaultId + } + return 0 +} + +type QueryVaultIdResponse struct { + Vault *Vault `protobuf:"bytes,1,opt,name=vault,proto3" json:"vault,omitempty"` +} + +func (m *QueryVaultIdResponse) Reset() { *m = QueryVaultIdResponse{} } +func (m *QueryVaultIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVaultIdResponse) ProtoMessage() {} +func (*QueryVaultIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{3} +} +func (m *QueryVaultIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVaultIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVaultIdResponse.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 *QueryVaultIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVaultIdResponse.Merge(m, src) +} +func (m *QueryVaultIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVaultIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVaultIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVaultIdResponse proto.InternalMessageInfo + +func (m *QueryVaultIdResponse) GetVault() *Vault { + if m != nil { + return m.Vault + } + return nil +} + +type QueryAllVaultsRequest struct { +} + +func (m *QueryAllVaultsRequest) Reset() { *m = QueryAllVaultsRequest{} } +func (m *QueryAllVaultsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllVaultsRequest) ProtoMessage() {} +func (*QueryAllVaultsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{4} +} +func (m *QueryAllVaultsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllVaultsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllVaultsRequest.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 *QueryAllVaultsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllVaultsRequest.Merge(m, src) +} +func (m *QueryAllVaultsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllVaultsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllVaultsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllVaultsRequest proto.InternalMessageInfo + +type QueryAllVaultsResponse struct { + AllVault []*Vault `protobuf:"bytes,1,rep,name=all_vault,json=allVault,proto3" json:"all_vault,omitempty"` +} + +func (m *QueryAllVaultsResponse) Reset() { *m = QueryAllVaultsResponse{} } +func (m *QueryAllVaultsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllVaultsResponse) ProtoMessage() {} +func (*QueryAllVaultsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{5} +} +func (m *QueryAllVaultsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllVaultsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllVaultsResponse.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 *QueryAllVaultsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllVaultsResponse.Merge(m, src) +} +func (m *QueryAllVaultsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllVaultsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllVaultsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllVaultsResponse proto.InternalMessageInfo + +func (m *QueryAllVaultsResponse) GetAllVault() []*Vault { + if m != nil { + return m.AllVault + } + return nil +} + +type QueryAllCollateralRequest struct { +} + +func (m *QueryAllCollateralRequest) Reset() { *m = QueryAllCollateralRequest{} } +func (m *QueryAllCollateralRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllCollateralRequest) ProtoMessage() {} +func (*QueryAllCollateralRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{6} +} +func (m *QueryAllCollateralRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllCollateralRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllCollateralRequest.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 *QueryAllCollateralRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCollateralRequest.Merge(m, src) +} +func (m *QueryAllCollateralRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllCollateralRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCollateralRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllCollateralRequest proto.InternalMessageInfo + +type QueryAllCollateralResponse struct { + AllVaultMamager []*VaultMamager `protobuf:"bytes,1,rep,name=all_vault_mamager,json=allVaultMamager,proto3" json:"all_vault_mamager,omitempty"` +} + +func (m *QueryAllCollateralResponse) Reset() { *m = QueryAllCollateralResponse{} } +func (m *QueryAllCollateralResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllCollateralResponse) ProtoMessage() {} +func (*QueryAllCollateralResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{7} +} +func (m *QueryAllCollateralResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllCollateralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllCollateralResponse.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 *QueryAllCollateralResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCollateralResponse.Merge(m, src) +} +func (m *QueryAllCollateralResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllCollateralResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCollateralResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllCollateralResponse proto.InternalMessageInfo + +func (m *QueryAllCollateralResponse) GetAllVaultMamager() []*VaultMamager { + if m != nil { + return m.AllVaultMamager + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "reserve.vaults.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "reserve.vaults.QueryParamsResponse") + proto.RegisterType((*QueryVaultIdRequest)(nil), "reserve.vaults.QueryVaultIdRequest") + proto.RegisterType((*QueryVaultIdResponse)(nil), "reserve.vaults.QueryVaultIdResponse") + proto.RegisterType((*QueryAllVaultsRequest)(nil), "reserve.vaults.QueryAllVaultsRequest") + proto.RegisterType((*QueryAllVaultsResponse)(nil), "reserve.vaults.QueryAllVaultsResponse") + proto.RegisterType((*QueryAllCollateralRequest)(nil), "reserve.vaults.QueryAllCollateralRequest") + proto.RegisterType((*QueryAllCollateralResponse)(nil), "reserve.vaults.QueryAllCollateralResponse") +} + +func init() { proto.RegisterFile("reserve/vaults/query.proto", fileDescriptor_5eedd1d3c0c88e0e) } + +var fileDescriptor_5eedd1d3c0c88e0e = []byte{ + // 511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0x63, 0x68, 0x43, 0x3b, 0x95, 0x8a, 0xba, 0xa4, 0xa1, 0x75, 0x2b, 0x83, 0xcc, 0x1f, + 0x41, 0x90, 0xbc, 0x34, 0x9c, 0x38, 0xd2, 0x5e, 0xa8, 0x04, 0x52, 0xf1, 0x81, 0x03, 0x97, 0x68, + 0x93, 0x2e, 0xc6, 0xd2, 0xda, 0xe3, 0x78, 0x37, 0x51, 0x73, 0x42, 0x82, 0x23, 0x17, 0x24, 0x5e, + 0x82, 0x23, 0x8f, 0xd1, 0x63, 0x25, 0x2e, 0x9c, 0x10, 0x4a, 0x90, 0x78, 0x0d, 0x94, 0xdd, 0x75, + 0x90, 0x83, 0xdb, 0xe6, 0x12, 0x59, 0x33, 0xbf, 0xf9, 0xbe, 0x6f, 0xbd, 0x13, 0x83, 0x9b, 0x73, + 0xc9, 0xf3, 0x21, 0xa7, 0x43, 0x36, 0x10, 0x4a, 0xd2, 0xfe, 0x80, 0xe7, 0xa3, 0x20, 0xcb, 0x51, + 0x21, 0x59, 0xb7, 0xbd, 0xc0, 0xf4, 0xdc, 0x0d, 0x96, 0xc4, 0x29, 0x52, 0xfd, 0x6b, 0x10, 0xb7, + 0x11, 0x61, 0x84, 0xfa, 0x91, 0x4e, 0x9f, 0x6c, 0x75, 0x37, 0x42, 0x8c, 0x04, 0xa7, 0x2c, 0x8b, + 0x29, 0x4b, 0x53, 0x54, 0x4c, 0xc5, 0x98, 0x4a, 0xdb, 0x6d, 0xf5, 0x50, 0x26, 0x28, 0x69, 0x97, + 0x49, 0x6e, 0xfc, 0xe8, 0x70, 0xaf, 0xcb, 0x15, 0xdb, 0xa3, 0x19, 0x8b, 0xe2, 0x54, 0xc3, 0x96, + 0xdd, 0x99, 0x8b, 0x97, 0xb1, 0x9c, 0x25, 0x56, 0xc8, 0x6f, 0x00, 0x79, 0x35, 0x1d, 0x3f, 0xd2, + 0xc5, 0x90, 0xf7, 0x07, 0x5c, 0x2a, 0xff, 0x08, 0x6e, 0x94, 0xaa, 0x32, 0xc3, 0x54, 0x72, 0xf2, + 0x14, 0xea, 0x66, 0x78, 0xcb, 0xb9, 0xed, 0x3c, 0x58, 0x6b, 0x37, 0x83, 0xf2, 0xe9, 0x02, 0xc3, + 0xef, 0xaf, 0x9e, 0xfe, 0xbc, 0x55, 0xfb, 0xfa, 0xe7, 0x5b, 0xcb, 0x09, 0xed, 0x80, 0xff, 0xd8, + 0x2a, 0xbe, 0x9e, 0x82, 0x87, 0xc7, 0xd6, 0x88, 0x6c, 0xc3, 0x8a, 0x1e, 0xed, 0xc4, 0xc7, 0x5a, + 0x73, 0x29, 0xbc, 0x36, 0x34, 0x84, 0x7f, 0x00, 0x8d, 0xf2, 0x84, 0x0d, 0xf1, 0x08, 0x96, 0x35, + 0x62, 0x33, 0x6c, 0xce, 0x67, 0xd0, 0x7c, 0x68, 0x18, 0xff, 0x26, 0x6c, 0x6a, 0x91, 0x67, 0x42, + 0xe8, 0xfa, 0xec, 0x84, 0x2f, 0xa0, 0x39, 0xdf, 0xb0, 0xfa, 0x6d, 0x58, 0x65, 0x42, 0x74, 0x0a, + 0x8f, 0xab, 0xe7, 0x7b, 0xac, 0x30, 0x3b, 0xec, 0xef, 0xc0, 0x76, 0xa1, 0x76, 0x80, 0x42, 0x30, + 0xc5, 0x73, 0x26, 0x0a, 0xab, 0xb7, 0xe0, 0x56, 0x35, 0xad, 0xdd, 0x73, 0xd8, 0x98, 0xd9, 0x75, + 0x12, 0x96, 0xb0, 0x88, 0xe7, 0xd6, 0x76, 0xb7, 0xd2, 0xf6, 0xa5, 0x61, 0xc2, 0xeb, 0x85, 0xbb, + 0x2d, 0xb4, 0x3f, 0x2e, 0xc1, 0xb2, 0x36, 0x22, 0x7d, 0xa8, 0x9b, 0x9b, 0x20, 0xfe, 0xbc, 0xc4, + 0xff, 0x97, 0xed, 0xde, 0xb9, 0x90, 0x31, 0x31, 0x7d, 0xef, 0xc3, 0xf7, 0xdf, 0x5f, 0xae, 0x6c, + 0x91, 0x26, 0xad, 0xdc, 0x26, 0xf2, 0xc9, 0xb1, 0x8b, 0x54, 0x3a, 0x25, 0x79, 0x58, 0xa9, 0x5d, + 0xf5, 0x9a, 0xdc, 0xd6, 0x22, 0xe8, 0x82, 0x69, 0xde, 0xc3, 0x7a, 0xf9, 0x76, 0xc9, 0xbd, 0xf3, + 0xd4, 0x4b, 0x6b, 0xe1, 0xde, 0xbf, 0x0c, 0x5b, 0x30, 0xc0, 0x09, 0xac, 0xfd, 0x5b, 0x5e, 0x49, + 0xaa, 0x5f, 0x71, 0xf9, 0xbf, 0xe0, 0xde, 0xbd, 0x18, 0x5a, 0xcc, 0x79, 0xff, 0xf0, 0x74, 0xec, + 0x39, 0x67, 0x63, 0xcf, 0xf9, 0x35, 0xf6, 0x9c, 0xcf, 0x13, 0xaf, 0x76, 0x36, 0xf1, 0x6a, 0x3f, + 0x26, 0x5e, 0xed, 0x0d, 0x8d, 0x62, 0xf5, 0x6e, 0xd0, 0x0d, 0x7a, 0x98, 0x50, 0x4c, 0x31, 0x19, + 0xe9, 0x2f, 0x40, 0x0f, 0xc5, 0x4c, 0xe9, 0xa4, 0xd0, 0x52, 0xa3, 0x8c, 0xcb, 0x6e, 0x5d, 0x03, + 0x4f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xb1, 0xe2, 0x29, 0xe0, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + QueryAllCollateral(ctx context.Context, in *QueryAllCollateralRequest, opts ...grpc.CallOption) (*QueryAllCollateralResponse, error) + QueryAllVaults(ctx context.Context, in *QueryAllVaultsRequest, opts ...grpc.CallOption) (*QueryAllVaultsResponse, error) + QueryVaults(ctx context.Context, in *QueryVaultIdRequest, opts ...grpc.CallOption) (*QueryVaultIdResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllCollateral(ctx context.Context, in *QueryAllCollateralRequest, opts ...grpc.CallOption) (*QueryAllCollateralResponse, error) { + out := new(QueryAllCollateralResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryAllCollateral", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllVaults(ctx context.Context, in *QueryAllVaultsRequest, opts ...grpc.CallOption) (*QueryAllVaultsResponse, error) { + out := new(QueryAllVaultsResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryAllVaults", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryVaults(ctx context.Context, in *QueryVaultIdRequest, opts ...grpc.CallOption) (*QueryVaultIdResponse, error) { + out := new(QueryVaultIdResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryVaults", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + QueryAllCollateral(context.Context, *QueryAllCollateralRequest) (*QueryAllCollateralResponse, error) + QueryAllVaults(context.Context, *QueryAllVaultsRequest) (*QueryAllVaultsResponse, error) + QueryVaults(context.Context, *QueryVaultIdRequest) (*QueryVaultIdResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) QueryAllCollateral(ctx context.Context, req *QueryAllCollateralRequest) (*QueryAllCollateralResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllCollateral not implemented") +} +func (*UnimplementedQueryServer) QueryAllVaults(ctx context.Context, req *QueryAllVaultsRequest) (*QueryAllVaultsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllVaults not implemented") +} +func (*UnimplementedQueryServer) QueryVaults(ctx context.Context, req *QueryVaultIdRequest) (*QueryVaultIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryVaults not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllCollateral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllCollateralRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllCollateral(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/QueryAllCollateral", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllCollateral(ctx, req.(*QueryAllCollateralRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllVaults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllVaultsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllVaults(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/QueryAllVaults", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllVaults(ctx, req.(*QueryAllVaultsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryVaults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVaultIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryVaults(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/QueryVaults", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryVaults(ctx, req.(*QueryVaultIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.vaults.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "QueryAllCollateral", + Handler: _Query_QueryAllCollateral_Handler, + }, + { + MethodName: "QueryAllVaults", + Handler: _Query_QueryAllVaults_Handler, + }, + { + MethodName: "QueryVaults", + Handler: _Query_QueryVaults_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/vaults/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryVaultIdRequest) 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 *QueryVaultIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVaultIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VaultId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVaultIdResponse) 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 *QueryVaultIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVaultIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Vault != nil { + { + size, err := m.Vault.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllVaultsRequest) 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 *QueryAllVaultsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllVaultsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllVaultsResponse) 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 *QueryAllVaultsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllVaultsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllVault) > 0 { + for iNdEx := len(m.AllVault) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllVault[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllCollateralRequest) 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 *QueryAllCollateralRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllCollateralRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllCollateralResponse) 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 *QueryAllCollateralResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllVaultMamager) > 0 { + for iNdEx := len(m.AllVaultMamager) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllVaultMamager[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVaultIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovQuery(uint64(m.VaultId)) + } + return n +} + +func (m *QueryVaultIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vault != nil { + l = m.Vault.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllVaultsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllVaultsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllVault) > 0 { + for _, e := range m.AllVault { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllCollateralRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllCollateralResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllVaultMamager) > 0 { + for _, e := range m.AllVaultMamager { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVaultIdRequest) 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 ErrIntOverflowQuery + } + 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: QueryVaultIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVaultIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVaultIdResponse) 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 ErrIntOverflowQuery + } + 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: QueryVaultIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVaultIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vault", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Vault == nil { + m.Vault = &Vault{} + } + if err := m.Vault.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllVaultsRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllVaultsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllVaultsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllVaultsResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllVaultsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllVaultsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllVault", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllVault = append(m.AllVault, &Vault{}) + if err := m.AllVault[len(m.AllVault)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllCollateralRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllCollateralRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCollateralRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllCollateralResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllCollateralResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCollateralResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllVaultMamager", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllVaultMamager = append(m.AllVaultMamager, &VaultMamager{}) + if err := m.AllVaultMamager[len(m.AllVaultMamager)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/vaults/types/query.pb.gw.go b/x/vaults/types/query.pb.gw.go new file mode 100644 index 00000000..eb3ddbcd --- /dev/null +++ b/x/vaults/types/query.pb.gw.go @@ -0,0 +1,366 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: reserve/vaults/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryAllCollateral_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllCollateralRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryAllCollateral(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllCollateral_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllCollateralRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryAllCollateral(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryAllVaults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllVaultsRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryAllVaults(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllVaults_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllVaultsRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryAllVaults(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryVaults_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryVaults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVaultIdRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryVaults_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryVaults(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryVaults_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVaultIdRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryVaults_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryVaults(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllCollateral_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllCollateral_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllCollateral_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllVaults_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllVaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryVaults_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryVaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllCollateral_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllCollateral_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllCollateral_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllVaults_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllVaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryVaults_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryVaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllCollateral_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllVaults_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryVaults_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllCollateral_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllVaults_0 = runtime.ForwardResponseMessage + + forward_Query_QueryVaults_0 = runtime.ForwardResponseMessage +) diff --git a/x/vaults/types/tx.pb.go b/x/vaults/types/tx.pb.go new file mode 100644 index 00000000..590eb580 --- /dev/null +++ b/x/vaults/types/tx.pb.go @@ -0,0 +1,4347 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/tx.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgActiveCollateral struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + MinCollateralRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_collateral_ratio"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + MaxDebt cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=max_debt,json=maxDebt,proto3,customtype=cosmossdk.io/math.Int" json:"max_debt"` + StabilityFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stability_fee"` + LiquidationPenalty cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_penalty"` + MintingFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=minting_fee,json=mintingFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"minting_fee"` + OraclScript uint64 `protobuf:"varint,8,opt,name=oracl_script,json=oraclScript,proto3" json:"oracl_script,omitempty"` + Authority string `protobuf:"bytes,9,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgActiveCollateral) Reset() { *m = MsgActiveCollateral{} } +func (m *MsgActiveCollateral) String() string { return proto.CompactTextString(m) } +func (*MsgActiveCollateral) ProtoMessage() {} +func (*MsgActiveCollateral) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{2} +} +func (m *MsgActiveCollateral) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgActiveCollateral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgActiveCollateral.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 *MsgActiveCollateral) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgActiveCollateral.Merge(m, src) +} +func (m *MsgActiveCollateral) XXX_Size() int { + return m.Size() +} +func (m *MsgActiveCollateral) XXX_DiscardUnknown() { + xxx_messageInfo_MsgActiveCollateral.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgActiveCollateral proto.InternalMessageInfo + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +type MsgActiveCollateralResponse struct { +} + +func (m *MsgActiveCollateralResponse) Reset() { *m = MsgActiveCollateralResponse{} } +func (m *MsgActiveCollateralResponse) String() string { return proto.CompactTextString(m) } +func (*MsgActiveCollateralResponse) ProtoMessage() {} +func (*MsgActiveCollateralResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{3} +} +func (m *MsgActiveCollateralResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgActiveCollateralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgActiveCollateralResponse.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 *MsgActiveCollateralResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgActiveCollateralResponse.Merge(m, src) +} +func (m *MsgActiveCollateralResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgActiveCollateralResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgActiveCollateralResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgActiveCollateralResponse proto.InternalMessageInfo + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgUpdatesCollateral struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + MinCollateralRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_collateral_ratio"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + MaxDebt cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=max_debt,json=maxDebt,proto3,customtype=cosmossdk.io/math.Int" json:"max_debt"` + StabilityFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stability_fee"` + LiquidationPenalty cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_penalty"` + MintingFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=minting_fee,json=mintingFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"minting_fee"` + OraclScript uint64 `protobuf:"varint,8,opt,name=oracl_script,json=oraclScript,proto3" json:"oracl_script,omitempty"` + Authority string `protobuf:"bytes,9,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgUpdatesCollateral) Reset() { *m = MsgUpdatesCollateral{} } +func (m *MsgUpdatesCollateral) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesCollateral) ProtoMessage() {} +func (*MsgUpdatesCollateral) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{4} +} +func (m *MsgUpdatesCollateral) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesCollateral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesCollateral.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 *MsgUpdatesCollateral) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesCollateral.Merge(m, src) +} +func (m *MsgUpdatesCollateral) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesCollateral) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesCollateral.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesCollateral proto.InternalMessageInfo + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +type MsgUpdatesCollateralResponse struct { +} + +func (m *MsgUpdatesCollateralResponse) Reset() { *m = MsgUpdatesCollateralResponse{} } +func (m *MsgUpdatesCollateralResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesCollateralResponse) ProtoMessage() {} +func (*MsgUpdatesCollateralResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{5} +} +func (m *MsgUpdatesCollateralResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesCollateralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesCollateralResponse.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 *MsgUpdatesCollateralResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesCollateralResponse.Merge(m, src) +} +func (m *MsgUpdatesCollateralResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesCollateralResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesCollateralResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesCollateralResponse proto.InternalMessageInfo + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgCreateVault struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Collateral types.Coin `protobuf:"bytes,2,opt,name=collateral,proto3" json:"collateral"` + Minted types.Coin `protobuf:"bytes,3,opt,name=minted,proto3" json:"minted"` +} + +func (m *MsgCreateVault) Reset() { *m = MsgCreateVault{} } +func (m *MsgCreateVault) String() string { return proto.CompactTextString(m) } +func (*MsgCreateVault) ProtoMessage() {} +func (*MsgCreateVault) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{6} +} +func (m *MsgCreateVault) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateVault.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 *MsgCreateVault) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateVault.Merge(m, src) +} +func (m *MsgCreateVault) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateVault) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateVault.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateVault proto.InternalMessageInfo + +// MsgCreateVaultResponse defines the Msg/CreateVault response type. +type MsgCreateVaultResponse struct { +} + +func (m *MsgCreateVaultResponse) Reset() { *m = MsgCreateVaultResponse{} } +func (m *MsgCreateVaultResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateVaultResponse) ProtoMessage() {} +func (*MsgCreateVaultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{7} +} +func (m *MsgCreateVaultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateVaultResponse.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 *MsgCreateVaultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateVaultResponse.Merge(m, src) +} +func (m *MsgCreateVaultResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateVaultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateVaultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateVaultResponse proto.InternalMessageInfo + +// MsgDeposit defines a SDK message for depositing collateral assets to the +// vault. +type MsgDeposit struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } +func (*MsgDeposit) ProtoMessage() {} +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{8} +} +func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeposit.Merge(m, src) +} +func (m *MsgDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo + +// MsgDepositResponse defines the Msg/Deposit response type. +type MsgDepositResponse struct { +} + +func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } +func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositResponse) ProtoMessage() {} +func (*MsgDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{9} +} +func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositResponse.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 *MsgDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositResponse.Merge(m, src) +} +func (m *MsgDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo + +// MsgWithdraw defines a SDK message for withdrawing collateral assets out of +// the vault. +type MsgWithdraw struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } +func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } +func (*MsgWithdraw) ProtoMessage() {} +func (*MsgWithdraw) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{10} +} +func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdraw.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 *MsgWithdraw) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdraw.Merge(m, src) +} +func (m *MsgWithdraw) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdraw) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdraw.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdraw proto.InternalMessageInfo + +// MsgWithdrawResponse defines the Msg/Withdraw response type. +type MsgWithdrawResponse struct { +} + +func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } +func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawResponse) ProtoMessage() {} +func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{11} +} +func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawResponse.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 *MsgWithdrawResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawResponse.Merge(m, src) +} +func (m *MsgWithdrawResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawResponse proto.InternalMessageInfo + +// MsgMint defines a SDK message for minting more tokens. +type MsgMint struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgMint) Reset() { *m = MsgMint{} } +func (m *MsgMint) String() string { return proto.CompactTextString(m) } +func (*MsgMint) ProtoMessage() {} +func (*MsgMint) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{12} +} +func (m *MsgMint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMint.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 *MsgMint) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMint.Merge(m, src) +} +func (m *MsgMint) XXX_Size() int { + return m.Size() +} +func (m *MsgMint) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMint.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMint proto.InternalMessageInfo + +// MsgMintResponse defines the Msg/Mint response type. +type MsgMintResponse struct { +} + +func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } +func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintResponse) ProtoMessage() {} +func (*MsgMintResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{13} +} +func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintResponse.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 *MsgMintResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintResponse.Merge(m, src) +} +func (m *MsgMintResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo + +// MsgRepay defines a SDK message for repay debt. +type MsgRepay struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgRepay) Reset() { *m = MsgRepay{} } +func (m *MsgRepay) String() string { return proto.CompactTextString(m) } +func (*MsgRepay) ProtoMessage() {} +func (*MsgRepay) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{14} +} +func (m *MsgRepay) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRepay.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 *MsgRepay) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRepay.Merge(m, src) +} +func (m *MsgRepay) XXX_Size() int { + return m.Size() +} +func (m *MsgRepay) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRepay.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRepay proto.InternalMessageInfo + +// MsgRepayResponse defines the Msg/Mint response type. +type MsgRepayResponse struct { +} + +func (m *MsgRepayResponse) Reset() { *m = MsgRepayResponse{} } +func (m *MsgRepayResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRepayResponse) ProtoMessage() {} +func (*MsgRepayResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{15} +} +func (m *MsgRepayResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRepayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRepayResponse.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 *MsgRepayResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRepayResponse.Merge(m, src) +} +func (m *MsgRepayResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRepayResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRepayResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRepayResponse proto.InternalMessageInfo + +// MsgClose defines a SDK message for closing vault. +type MsgClose struct { + VaultId uint64 `protobuf:"varint,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgClose) Reset() { *m = MsgClose{} } +func (m *MsgClose) String() string { return proto.CompactTextString(m) } +func (*MsgClose) ProtoMessage() {} +func (*MsgClose) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{16} +} +func (m *MsgClose) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClose) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClose.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 *MsgClose) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClose.Merge(m, src) +} +func (m *MsgClose) XXX_Size() int { + return m.Size() +} +func (m *MsgClose) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClose.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClose proto.InternalMessageInfo + +// MsgRepayResponse defines the Msg/Mint response type. +type MsgCloseResponse struct { +} + +func (m *MsgCloseResponse) Reset() { *m = MsgCloseResponse{} } +func (m *MsgCloseResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCloseResponse) ProtoMessage() {} +func (*MsgCloseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{17} +} +func (m *MsgCloseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCloseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCloseResponse.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 *MsgCloseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCloseResponse.Merge(m, src) +} +func (m *MsgCloseResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCloseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCloseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCloseResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "reserve.vaults.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.vaults.MsgUpdateParamsResponse") + proto.RegisterType((*MsgActiveCollateral)(nil), "reserve.vaults.MsgActiveCollateral") + proto.RegisterType((*MsgActiveCollateralResponse)(nil), "reserve.vaults.MsgActiveCollateralResponse") + proto.RegisterType((*MsgUpdatesCollateral)(nil), "reserve.vaults.MsgUpdatesCollateral") + proto.RegisterType((*MsgUpdatesCollateralResponse)(nil), "reserve.vaults.MsgUpdatesCollateralResponse") + proto.RegisterType((*MsgCreateVault)(nil), "reserve.vaults.MsgCreateVault") + proto.RegisterType((*MsgCreateVaultResponse)(nil), "reserve.vaults.MsgCreateVaultResponse") + proto.RegisterType((*MsgDeposit)(nil), "reserve.vaults.MsgDeposit") + proto.RegisterType((*MsgDepositResponse)(nil), "reserve.vaults.MsgDepositResponse") + proto.RegisterType((*MsgWithdraw)(nil), "reserve.vaults.MsgWithdraw") + proto.RegisterType((*MsgWithdrawResponse)(nil), "reserve.vaults.MsgWithdrawResponse") + proto.RegisterType((*MsgMint)(nil), "reserve.vaults.MsgMint") + proto.RegisterType((*MsgMintResponse)(nil), "reserve.vaults.MsgMintResponse") + proto.RegisterType((*MsgRepay)(nil), "reserve.vaults.MsgRepay") + proto.RegisterType((*MsgRepayResponse)(nil), "reserve.vaults.MsgRepayResponse") + proto.RegisterType((*MsgClose)(nil), "reserve.vaults.MsgClose") + proto.RegisterType((*MsgCloseResponse)(nil), "reserve.vaults.MsgCloseResponse") +} + +func init() { proto.RegisterFile("reserve/vaults/tx.proto", fileDescriptor_bbce2367024dc47b) } + +var fileDescriptor_bbce2367024dc47b = []byte{ + // 1026 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xd2, 0x38, 0x3f, 0x5e, 0x4a, 0x49, 0x26, 0x6e, 0xe2, 0x6c, 0xc0, 0x0e, 0x2e, 0x82, + 0x28, 0xd0, 0xdd, 0xa6, 0x95, 0x2a, 0x11, 0x71, 0xa0, 0x89, 0x85, 0x64, 0x51, 0x4b, 0x95, 0xab, + 0x52, 0x04, 0x07, 0x6b, 0xbc, 0x3b, 0xac, 0x47, 0xec, 0xee, 0x98, 0x9d, 0xb1, 0x1b, 0xdf, 0x10, + 0x27, 0xc4, 0x89, 0x3f, 0xa1, 0x47, 0x40, 0x20, 0xe5, 0xd0, 0x0b, 0xff, 0x41, 0x8f, 0x55, 0x4f, + 0xa5, 0x87, 0x0a, 0x25, 0x87, 0x70, 0xe5, 0x3f, 0x40, 0x3b, 0x33, 0x5e, 0xaf, 0x9d, 0x75, 0x1a, + 0x14, 0x0e, 0x11, 0xea, 0x25, 0xc9, 0xec, 0xf7, 0xde, 0xf7, 0xbe, 0x6f, 0xf2, 0xde, 0xce, 0x2c, + 0xac, 0x44, 0x84, 0x93, 0xa8, 0x47, 0xec, 0x1e, 0xee, 0xfa, 0x82, 0xdb, 0x62, 0xcf, 0xea, 0x44, + 0x4c, 0x30, 0x74, 0x49, 0x03, 0x96, 0x02, 0xcc, 0x82, 0xc7, 0x3c, 0x26, 0x21, 0x3b, 0xfe, 0x4b, + 0x45, 0x99, 0x6b, 0x63, 0xe9, 0x1d, 0x1c, 0xe1, 0x80, 0x6b, 0x70, 0x11, 0x07, 0x34, 0x64, 0xb6, + 0xfc, 0xa9, 0x1f, 0xad, 0x3a, 0x8c, 0x07, 0x8c, 0x37, 0x15, 0x91, 0x5a, 0x68, 0x68, 0x45, 0xad, + 0xec, 0x80, 0x7b, 0x76, 0x6f, 0x2b, 0xfe, 0xa5, 0x81, 0x92, 0x06, 0x5a, 0x98, 0x13, 0xbb, 0xb7, + 0xd5, 0x22, 0x02, 0x6f, 0xd9, 0x0e, 0xa3, 0xa1, 0xc2, 0x2b, 0xbf, 0x1b, 0xf0, 0x46, 0x9d, 0x7b, + 0xf7, 0x3a, 0x2e, 0x16, 0xe4, 0x8e, 0x14, 0x80, 0x6e, 0xc2, 0x1c, 0xee, 0x8a, 0x36, 0x8b, 0xa8, + 0xe8, 0x17, 0x8d, 0x75, 0x63, 0x63, 0x6e, 0xa7, 0xf8, 0xf4, 0xd1, 0xd5, 0x82, 0xae, 0x78, 0xcb, + 0x75, 0x23, 0xc2, 0xf9, 0x5d, 0x11, 0xd1, 0xd0, 0x6b, 0x0c, 0x43, 0xd1, 0x87, 0x30, 0xad, 0x2c, + 0x14, 0x5f, 0x5b, 0x37, 0x36, 0xe6, 0xaf, 0x2f, 0x5b, 0xa3, 0xdb, 0x60, 0x29, 0xfe, 0x9d, 0xb9, + 0xc7, 0x2f, 0xca, 0xb9, 0x9f, 0x8e, 0xf6, 0x37, 0x8d, 0x86, 0x4e, 0xd8, 0xbe, 0xf1, 0xdd, 0xd1, + 0xfe, 0xe6, 0x90, 0xea, 0x87, 0xa3, 0xfd, 0xcd, 0xf5, 0xc1, 0xee, 0xec, 0xd9, 0x2c, 0xc2, 0x8e, + 0x4f, 0xec, 0x31, 0x9d, 0x95, 0x55, 0x58, 0x19, 0x7b, 0xd4, 0x20, 0xbc, 0xc3, 0x42, 0x4e, 0x2a, + 0x7f, 0xe4, 0x61, 0xa9, 0xce, 0xbd, 0x5b, 0x8e, 0xa0, 0x3d, 0xb2, 0xcb, 0x7c, 0x1f, 0x0b, 0x12, + 0x61, 0x1f, 0x15, 0x20, 0xef, 0x92, 0x90, 0x05, 0xca, 0x56, 0x43, 0x2d, 0x50, 0x1b, 0x0a, 0x01, + 0x0d, 0x9b, 0x4e, 0x12, 0xd7, 0x8c, 0xb0, 0xa0, 0x4c, 0xda, 0x98, 0xdb, 0xb9, 0x19, 0xcb, 0x7d, + 0xfe, 0xa2, 0xbc, 0xa6, 0xfc, 0x73, 0xf7, 0x6b, 0x8b, 0x32, 0x3b, 0xc0, 0xa2, 0x6d, 0xdd, 0x26, + 0x1e, 0x76, 0xfa, 0x55, 0xe2, 0x3c, 0x7d, 0x74, 0x15, 0xf4, 0xf6, 0x54, 0x89, 0xa3, 0xbc, 0xa1, + 0x80, 0x86, 0xc3, 0xd2, 0x8d, 0x98, 0x11, 0x39, 0xb0, 0xe8, 0xd3, 0x6f, 0xba, 0xd4, 0x8d, 0x57, + 0xa1, 0x2e, 0x73, 0xe1, 0x4c, 0x65, 0x16, 0x52, 0x84, 0xaa, 0xc8, 0xa7, 0x30, 0x1b, 0xe0, 0xbd, + 0xa6, 0x4b, 0x5a, 0xa2, 0x38, 0x25, 0xb9, 0xaf, 0x69, 0xee, 0xcb, 0xc7, 0xb9, 0x6b, 0xa1, 0x48, + 0xb1, 0xd6, 0x42, 0xa1, 0x58, 0x67, 0x02, 0xbc, 0x57, 0x25, 0x2d, 0x81, 0xbe, 0x84, 0xd7, 0xb9, + 0xc0, 0x2d, 0xea, 0x53, 0xd1, 0x6f, 0x7e, 0x45, 0x48, 0x31, 0x7f, 0x26, 0xb5, 0x17, 0x13, 0xb2, + 0x4f, 0x08, 0x41, 0x1e, 0x2c, 0xa5, 0xb7, 0xa3, 0x43, 0x42, 0xec, 0x8b, 0x7e, 0x71, 0xfa, 0x6c, + 0xfb, 0x9e, 0xa2, 0xbc, 0xa3, 0x18, 0xd1, 0x7d, 0x98, 0x0f, 0x68, 0x28, 0x68, 0xe8, 0x49, 0x0f, + 0x33, 0x67, 0x2a, 0x00, 0x9a, 0x2a, 0x76, 0xf0, 0x36, 0x5c, 0x94, 0xdd, 0xd9, 0xe4, 0x4e, 0x44, + 0x3b, 0xa2, 0x38, 0xbb, 0x6e, 0x6c, 0x4c, 0x35, 0xe6, 0xe5, 0xb3, 0xbb, 0xf2, 0xd1, 0xe8, 0x38, + 0xcd, 0x9d, 0x7a, 0x9c, 0xb6, 0x97, 0xbf, 0x7f, 0x58, 0xce, 0xfd, 0xf5, 0xb0, 0x9c, 0x1b, 0x9d, + 0x8d, 0xca, 0x5b, 0xb0, 0x96, 0xd1, 0xda, 0x49, 0xeb, 0x3f, 0xcf, 0x43, 0x21, 0x19, 0x0b, 0xfe, + 0xaa, 0xf7, 0x5f, 0xf5, 0xfe, 0xff, 0xa8, 0xf7, 0x4b, 0xf0, 0x66, 0x56, 0x6f, 0x27, 0xcd, 0xff, + 0xcc, 0x80, 0x4b, 0x75, 0xee, 0xed, 0x46, 0x04, 0x0b, 0xf2, 0x59, 0x7c, 0xea, 0x20, 0x0b, 0xf2, + 0xec, 0x41, 0x48, 0xa2, 0x97, 0x9e, 0x64, 0x2a, 0x0c, 0x55, 0x01, 0x86, 0xc3, 0xa0, 0x4f, 0xb2, + 0x55, 0x4b, 0x67, 0xc4, 0xc7, 0xa8, 0xa5, 0x8f, 0x51, 0x6b, 0x97, 0xd1, 0x30, 0x7d, 0x98, 0xa5, + 0xf2, 0xd0, 0x47, 0x30, 0x1d, 0xef, 0x14, 0x71, 0x65, 0x87, 0x9f, 0x96, 0x41, 0xe7, 0x6c, 0xa3, + 0xb4, 0x7d, 0xa5, 0xab, 0x52, 0x84, 0xe5, 0x51, 0x67, 0x89, 0xe9, 0x5f, 0x0d, 0x80, 0x3a, 0xf7, + 0xaa, 0xa4, 0xc3, 0x38, 0x15, 0x68, 0x15, 0x66, 0xe5, 0x79, 0xdb, 0xa4, 0xae, 0xf4, 0x3c, 0xd5, + 0x98, 0x91, 0xeb, 0x9a, 0x8b, 0xae, 0xc1, 0x34, 0x27, 0xa1, 0x4b, 0x22, 0x3d, 0xde, 0x93, 0x37, + 0x43, 0xc7, 0xc5, 0x3e, 0x70, 0xc0, 0xba, 0xa1, 0xf8, 0x77, 0x3e, 0x54, 0xce, 0xf6, 0x52, 0xda, + 0x87, 0xa6, 0xac, 0x14, 0x00, 0x0d, 0xd5, 0x26, 0x26, 0x7e, 0x33, 0x60, 0xbe, 0xce, 0xbd, 0xfb, + 0x54, 0xb4, 0xdd, 0x08, 0x3f, 0x38, 0xf7, 0x2e, 0x2e, 0xcb, 0x0b, 0xc6, 0x40, 0x6e, 0x62, 0xe3, + 0x67, 0x03, 0x66, 0xea, 0xdc, 0xab, 0xd3, 0xf0, 0xfc, 0xff, 0x23, 0x16, 0xe5, 0xd5, 0x2f, 0x96, + 0x9a, 0xc8, 0xff, 0xc5, 0x80, 0xd9, 0x3a, 0xf7, 0x1a, 0xa4, 0x83, 0xfb, 0xe7, 0x5e, 0x3f, 0x82, + 0x85, 0x81, 0xd6, 0xc4, 0x80, 0x2f, 0xf5, 0xef, 0xfa, 0x8c, 0x93, 0xff, 0x54, 0xff, 0x49, 0x0a, + 0x64, 0xb5, 0x81, 0x82, 0xeb, 0x7f, 0xe7, 0xe1, 0x42, 0x9d, 0x7b, 0xe8, 0x73, 0xb8, 0x38, 0x72, + 0xab, 0x2e, 0x8f, 0xdf, 0x86, 0xc7, 0xee, 0xae, 0xe6, 0x7b, 0x2f, 0x09, 0x18, 0x54, 0x40, 0x2e, + 0x2c, 0x1c, 0xbb, 0xd8, 0x5e, 0xc9, 0x48, 0x1e, 0x0f, 0x32, 0xdf, 0x3f, 0x45, 0x50, 0x52, 0xc5, + 0x83, 0xc5, 0xe3, 0x77, 0x88, 0x77, 0x26, 0x6a, 0x4c, 0x45, 0x99, 0x1f, 0x9c, 0x26, 0x2a, 0x29, + 0x74, 0x0f, 0xe6, 0xd3, 0xef, 0xeb, 0x52, 0x46, 0x72, 0x0a, 0x37, 0xdf, 0x3d, 0x19, 0x4f, 0x68, + 0x6b, 0x30, 0x33, 0x78, 0x23, 0x9a, 0x19, 0x29, 0x1a, 0x33, 0x2b, 0x93, 0xb1, 0x84, 0xea, 0x36, + 0xcc, 0x26, 0xef, 0xa5, 0xb5, 0x8c, 0xf8, 0x01, 0x68, 0x5e, 0x39, 0x01, 0x4c, 0xd8, 0x3e, 0x86, + 0x29, 0xf9, 0x7a, 0x58, 0xc9, 0x08, 0x8e, 0x01, 0xb3, 0x3c, 0x01, 0x48, 0x18, 0x76, 0x21, 0xaf, + 0x26, 0xb4, 0x98, 0x11, 0x29, 0x11, 0x73, 0x7d, 0x12, 0x92, 0x26, 0x51, 0x63, 0x92, 0x45, 0x22, + 0x91, 0x4c, 0x92, 0x91, 0x66, 0x37, 0xf3, 0xdf, 0xc6, 0x63, 0xba, 0x53, 0x7b, 0x7c, 0x50, 0x32, + 0x9e, 0x1c, 0x94, 0x8c, 0x3f, 0x0f, 0x4a, 0xc6, 0x8f, 0x87, 0xa5, 0xdc, 0x93, 0xc3, 0x52, 0xee, + 0xd9, 0x61, 0x29, 0xf7, 0x85, 0xed, 0x51, 0xd1, 0xee, 0xb6, 0x2c, 0x87, 0x05, 0x36, 0x0b, 0x59, + 0xd0, 0x97, 0x9f, 0x9d, 0x0e, 0xf3, 0xed, 0xe1, 0xe7, 0xdd, 0xe0, 0xeb, 0xb9, 0xdf, 0x21, 0xbc, + 0x35, 0x2d, 0x03, 0x6e, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x2c, 0xe8, 0xfa, 0x5c, 0x0f, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // ActiveCollateral defines a method for enable a collateral asset + ActiveCollateral(ctx context.Context, in *MsgActiveCollateral, opts ...grpc.CallOption) (*MsgActiveCollateralResponse, error) + // UpdatesCollateral defines a method for update a collateral asset + UpdatesCollateral(ctx context.Context, in *MsgUpdatesCollateral, opts ...grpc.CallOption) (*MsgUpdatesCollateralResponse, error) + // CreateVault defines a method for creating a new vault and mint token + CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) + // Deposit defines a method for depositing collateral assets to vault + Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) + // Withdraw defines a method for withdrawing collateral assets out of the + // vault + Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) + // Mint defines a method for minting more tokens + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) + // Repay defines a method for reducing debt by burning tokens + Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) + // Close defines a method for close vault + Close(ctx context.Context, in *MsgClose, opts ...grpc.CallOption) (*MsgCloseResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ActiveCollateral(ctx context.Context, in *MsgActiveCollateral, opts ...grpc.CallOption) (*MsgActiveCollateralResponse, error) { + out := new(MsgActiveCollateralResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/ActiveCollateral", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdatesCollateral(ctx context.Context, in *MsgUpdatesCollateral, opts ...grpc.CallOption) (*MsgUpdatesCollateralResponse, error) { + out := new(MsgUpdatesCollateralResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/UpdatesCollateral", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) { + out := new(MsgCreateVaultResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/CreateVault", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { + out := new(MsgDepositResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) { + out := new(MsgWithdrawResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/Withdraw", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { + out := new(MsgMintResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/Mint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) { + out := new(MsgRepayResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/Repay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Close(ctx context.Context, in *MsgClose, opts ...grpc.CallOption) (*MsgCloseResponse, error) { + out := new(MsgCloseResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/Close", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // ActiveCollateral defines a method for enable a collateral asset + ActiveCollateral(context.Context, *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) + // UpdatesCollateral defines a method for update a collateral asset + UpdatesCollateral(context.Context, *MsgUpdatesCollateral) (*MsgUpdatesCollateralResponse, error) + // CreateVault defines a method for creating a new vault and mint token + CreateVault(context.Context, *MsgCreateVault) (*MsgCreateVaultResponse, error) + // Deposit defines a method for depositing collateral assets to vault + Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) + // Withdraw defines a method for withdrawing collateral assets out of the + // vault + Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) + // Mint defines a method for minting more tokens + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) + // Repay defines a method for reducing debt by burning tokens + Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) + // Close defines a method for close vault + Close(context.Context, *MsgClose) (*MsgCloseResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) ActiveCollateral(ctx context.Context, req *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ActiveCollateral not implemented") +} +func (*UnimplementedMsgServer) UpdatesCollateral(ctx context.Context, req *MsgUpdatesCollateral) (*MsgUpdatesCollateralResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatesCollateral not implemented") +} +func (*UnimplementedMsgServer) CreateVault(ctx context.Context, req *MsgCreateVault) (*MsgCreateVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateVault not implemented") +} +func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (*UnimplementedMsgServer) Withdraw(ctx context.Context, req *MsgWithdraw) (*MsgWithdrawResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") +} +func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} +func (*UnimplementedMsgServer) Repay(ctx context.Context, req *MsgRepay) (*MsgRepayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Repay not implemented") +} +func (*UnimplementedMsgServer) Close(ctx context.Context, req *MsgClose) (*MsgCloseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Close not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ActiveCollateral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgActiveCollateral) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ActiveCollateral(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/ActiveCollateral", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ActiveCollateral(ctx, req.(*MsgActiveCollateral)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdatesCollateral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdatesCollateral) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdatesCollateral(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/UpdatesCollateral", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdatesCollateral(ctx, req.(*MsgUpdatesCollateral)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateVault) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateVault(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/CreateVault", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateVault(ctx, req.(*MsgCreateVault)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdraw) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Withdraw(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/Withdraw", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdraw)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Mint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/Mint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Repay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRepay) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Repay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/Repay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Repay(ctx, req.(*MsgRepay)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClose) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Close(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/Close", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Close(ctx, req.(*MsgClose)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "reserve.vaults.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "ActiveCollateral", + Handler: _Msg_ActiveCollateral_Handler, + }, + { + MethodName: "UpdatesCollateral", + Handler: _Msg_UpdatesCollateral_Handler, + }, + { + MethodName: "CreateVault", + Handler: _Msg_CreateVault_Handler, + }, + { + MethodName: "Deposit", + Handler: _Msg_Deposit_Handler, + }, + { + MethodName: "Withdraw", + Handler: _Msg_Withdraw_Handler, + }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, + { + MethodName: "Repay", + Handler: _Msg_Repay_Handler, + }, + { + MethodName: "Close", + Handler: _Msg_Close_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "reserve/vaults/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgActiveCollateral) 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 *MsgActiveCollateral) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgActiveCollateral) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x4a + } + if m.OraclScript != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.OraclScript)) + i-- + dAtA[i] = 0x40 + } + { + size := m.MintingFee.Size() + i -= size + if _, err := m.MintingFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.LiquidationPenalty.Size() + i -= size + if _, err := m.LiquidationPenalty.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.StabilityFee.Size() + i -= size + if _, err := m.StabilityFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.MaxDebt.Size() + i -= size + if _, err := m.MaxDebt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.LiquidationRatio.Size() + i -= size + if _, err := m.LiquidationRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MinCollateralRatio.Size() + i -= size + if _, err := m.MinCollateralRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgActiveCollateralResponse) 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 *MsgActiveCollateralResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgActiveCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdatesCollateral) 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 *MsgUpdatesCollateral) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesCollateral) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x4a + } + if m.OraclScript != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.OraclScript)) + i-- + dAtA[i] = 0x40 + } + { + size := m.MintingFee.Size() + i -= size + if _, err := m.MintingFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.LiquidationPenalty.Size() + i -= size + if _, err := m.LiquidationPenalty.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.StabilityFee.Size() + i -= size + if _, err := m.StabilityFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.MaxDebt.Size() + i -= size + if _, err := m.MaxDebt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.LiquidationRatio.Size() + i -= size + if _, err := m.LiquidationRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MinCollateralRatio.Size() + i -= size + if _, err := m.MinCollateralRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdatesCollateralResponse) 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 *MsgUpdatesCollateralResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCreateVault) 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 *MsgCreateVault) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Minted.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateVaultResponse) 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 *MsgCreateVaultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.VaultId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositResponse) 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 *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdraw) 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 *MsgWithdraw) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.VaultId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawResponse) 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 *MsgWithdrawResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgMint) 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 *MsgMint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.VaultId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgMintResponse) 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 *MsgMintResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRepay) 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 *MsgRepay) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.VaultId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgRepayResponse) 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 *MsgRepayResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRepayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgClose) 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 *MsgClose) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClose) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.VaultId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgCloseResponse) 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 *MsgCloseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCloseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgActiveCollateral) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.MinCollateralRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.LiquidationRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxDebt.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.StabilityFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.LiquidationPenalty.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MintingFee.Size() + n += 1 + l + sovTx(uint64(l)) + if m.OraclScript != 0 { + n += 1 + sovTx(uint64(m.OraclScript)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgActiveCollateralResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdatesCollateral) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.MinCollateralRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.LiquidationRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxDebt.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.StabilityFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.LiquidationPenalty.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MintingFee.Size() + n += 1 + l + sovTx(uint64(l)) + if m.OraclScript != 0 { + n += 1 + sovTx(uint64(m.OraclScript)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdatesCollateralResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateVault) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Collateral.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Minted.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateVaultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdraw) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgWithdrawResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgMint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgMintResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRepay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRepayResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClose) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCloseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 + } + if err := m.Params.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 (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgActiveCollateral) 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: MsgActiveCollateral: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgActiveCollateral: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinCollateralRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StabilityFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StabilityFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationPenalty", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationPenalty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintingFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintingFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclScript", wireType) + } + m.OraclScript = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OraclScript |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + 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 (m *MsgActiveCollateralResponse) 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: MsgActiveCollateralResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgActiveCollateralResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgUpdatesCollateral) 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: MsgUpdatesCollateral: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatesCollateral: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinCollateralRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StabilityFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StabilityFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationPenalty", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationPenalty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintingFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintingFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclScript", wireType) + } + m.OraclScript = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OraclScript |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + 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 (m *MsgUpdatesCollateralResponse) 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: MsgUpdatesCollateralResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatesCollateralResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgCreateVault) 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: MsgCreateVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Collateral", 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 + } + if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Minted", 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 + } + if err := m.Minted.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 (m *MsgCreateVaultResponse) 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: MsgCreateVaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgDeposit) 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: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 (m *MsgDepositResponse) 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: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgWithdraw) 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: MsgWithdraw: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 (m *MsgWithdrawResponse) 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: MsgWithdrawResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgMint) 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: MsgMint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 (m *MsgMintResponse) 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: MsgMintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgRepay) 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: MsgRepay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRepay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 (m *MsgRepayResponse) 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: MsgRepayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRepayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 (m *MsgClose) 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: MsgClose: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClose: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + 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 (m *MsgCloseResponse) 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: MsgCloseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCloseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)